igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [igraph] spanningtree


From: Harun Pirim
Subject: RE: [igraph] spanningtree
Date: Mon, 8 Mar 2010 12:47:01 -0600

Thank you Tamas for your quick response but I couldn't find a function in R
called graph.bfs(), do you mean I should define this function using shortest
paths?

Harun

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Tamas Nepusz
Sent: Monday, March 08, 2010 5:20 AM
To: Help for igraph users
Subject: Re: [igraph] spanningtree

> Is there a way to find spanning trees with the flexibility of
> choosing the source vertex and is there a way to run BFS or DFS to
> end up with a spanning tree?
I assume that you are interested in an arbitrary spanning tree only and
not all of them (or those that satisfy some criterion). In this case,
calculating all the shortest paths from a given source vertex to all
others will give you a spanning tree if the graph is connected. If you
are using R, try graph.bfs() and set the "father" argument to TRUE. The
result vector will contain a $father component that gives you the
"parent" of each vertex in the BFS tree. Connecting each vertex with its
parent will give you a spanning tree.

-- 
Tamas


_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help





reply via email to

[Prev in Thread] Current Thread [Next in Thread]