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.insert_node_on_out_edges_multiple#

PyDiGraph.insert_node_on_out_edges_multiple(node, ref_nodes, /)#

Insert a node between a list of reference nodes and all their successors

This essentially iterates over all edges leading out of the reference nodes specified in the ref_nodes parameter, removes those edges and then adds 2 edges, one from ref_node to node and the other one from node to the successor of ref_node. The edge payloads of the two newly created edges are copied by reference from the original edge that gets removed.

Parameters:
  • node (int) – The index of the node to insert

  • ref_nodes (list[int]) – The list of indices of reference nodes to be appended by node