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.PyDiGraph.merge_nodes#

PyDiGraph.merge_nodes(u, v, /)#

Merge two nodes in the graph.

If the nodes have equal weight objects then all the edges into and out of u will be added to v and u will be removed from the graph. If the nodes don’t have equal weight objects then no changes will be made and no error raised

Parameters:
  • u (int) – The source node that is going to be merged

  • v (int) – The target node that is going to be the new node