I would like to find a spanning tree in a graph using igraph function graph.bfs
.
Could you show me how?
PS: I try to use the $father
info of the returned value from graph.bfs
, but the result confuses me. Here is an example:
g <- graph(c(1,2,2,6,1,4,4,6,5,6,1,5,5,3,3,4), directed=FALSE)
plot(g)
tmp <- graph.bfs(g, root=1, neimode='all', order=TRUE, father=TRUE,callback=f)
The result is :
tmp$order = 1 2 4 5 6 3
and tmp$father=0 1 4 1 1 2
Can I use the $father
info to find all the spanning tree?