Does graph-tool have any equivalent function to NetworkX's has_path? I'd like to return True if there's a valid path between any given nodes.
Asked
Active
Viewed 137 times
0
-
can you check the docs? – ehacinom Sep 19 '18 at 21:40
-
I did, but I couldn't find anything unfortunately. – ofey Sep 19 '18 at 21:43
1 Answers
1
This is trivially achieved by checking if there is a finite distance between two vertices:
has_path = shortest_distance(g, u, v) < g.num_vertices()

Tiago Peixoto
- 5,149
- 2
- 28
- 28