igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] spanningtree


From: Tamas Nepusz
Subject: Re: [igraph] spanningtree
Date: Mon, 8 Mar 2010 11:19:32 +0000
User-agent: Mutt/1.5.20 (2009-06-14)

> 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




reply via email to

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