The depth first search is not implemented yet, but it's easy to

implement it:

def dfsiter(graph, root):

stack = [root]

visited = set(stack)

while stack:

vertex = stack.pop()

yield vertex

not_visited_neis = set(graph.neighbors(vertex)) - visited

stack.extend(not_visited_neis)

visited.update(not_visited_neis)

for vertex in tree.dfsiter(0):

print vertex.index

if it is not too time consuming can someone write an R code for DFS?

thanks

> and for finding a certain path from the root to a leaf node.

See the get_shortest_paths() method of the Graph object:

>>> g.shortest_paths(0, [5])

[[0, 2, 5]]

Note that g.shortest_paths can be used to determine the shortest paths

from a given vertex to more than one other vertex:

>>> g.shortest_paths(0, [5, 7])

[[0, 2, 5], [0, 1, 3, 7]]

--

Tamas