[Top][All Lists]

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

[igraph] Getting all vertices reachable from a particular vertex

From: Colin Morris
Subject: [igraph] Getting all vertices reachable from a particular vertex
Date: Mon, 15 Apr 2013 13:25:54 -0400

I'm wondering what the most efficient/idiomatic way to get all vertices reachable from a given vertex.

Could I do graph.neighbourhood(vertex, float('inf')) ? 

(The 'order' param to neighbourhood actually isn't documented here: http://igraph.sourceforge.net/doc/python/igraph.GraphBase-class.html#neighborhood so I'm not sure if there's an issue with giving it infinite order - e.g. if it might loop infinitely in the case of a cycle.)

Would it be better to do something like...

for v in graph.vs:
    if graph.vertex_connectivity(v, vertex, neighbours='infinity') == 0:
        yield v

(This seems inefficient)

Any thoughts on the best way to do this?


reply via email to

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