rustworkx.PyGraph.add_edge¶
- PyGraph.add_edge(node_a, node_b, edge, /)¶
Add an edge between 2 nodes.
If
multigraphisFalseand an edge already exists betweennode_aandnode_bthe weight/payload of that existing edge will be updated to beedge.- Parameters:
node_a (int) – Index of the parent node
node_b (int) – Index of the child node
edge – The object to set as the data for the edge. It can be any python object.
- Returns:
The edge index for the newly created (or updated in the case of an existing edge with
multigraph=False) edge.- Return type:
int