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_in_edges#
- PyDiGraph.insert_node_on_in_edges(node, ref_node, /)#
Insert a node between a reference node and all its predecessor nodes
This essentially iterates over all edges leading into the reference node specified in the
ref_node
parameter, removes those edges and then adds 2 edges, one from the predecessor ofref_node
tonode
and the other one fromnode
toref_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_node (int) – The index of the reference node to be prepended by
node