Reputation: 77
Is there a method in graph-tool through which checking whether two nodes are connected (as first neighbours) or not without having to iterate?
For example, something like graph_tool.is_connected(v,u)
which returns a boolean depending on whether v
and u
are or not connected vertices. Something like a function to check just whether a certain edge exists.
Thanks
Upvotes: 0
Views: 769
Reputation: 77
It is solved by checking the result of the function g.edge(v,u)
. If add_missing=False
it just returns None
whenever the edge does not exist. Thanks to @NerdOnTour for the comment
Upvotes: 1