Note
This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.
rustworkx.PyGraph.add_edge#
- PyGraph.add_edge(node_a, node_b, edge, /)#
Add an edge between 2 nodes.
If
multigraph
isFalse
and an edge already exists betweennode_a
andnode_b
the 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