Reputation: 133
Is an edge created by networkx python package multi directional?
eg:
graph.add_edge(0,1)
This implies there is a path from node 0 to 1, but does this also imply a path from 1 to 0?
Upvotes: 1
Views: 3392
Reputation: 23827
It depends on how you've defined your graph graph
.
If you create it by
graph = nx.Graph()
graph.add_edge(0,1)
graph.has_edge(1,0)
> True
then yes, the edges go in both directions. On the other hand, if you use a directed graph
graph = nx.DiGraph()
graph.add_edge(0,1)
graph.has_edge(1,0)
> False
then no, the edge has direction.
Upvotes: 2