rustworkx.PyDiGraph.remove_node_retain_edges_by_id#
- PyDiGraph.remove_node_retain_edges_by_id(node, /)#
Remove a node from the graph and add edges from predecessors to successors in cases where an incoming and outgoing edge have the same weight by Python object identity.
This function has a minimum time complexity of \(\mathcal O(e_i + e_o)\), where \(e_i\) is the number of incoming edges and \(e_o\) the number of outgoing edges (the full complexity depends on the number of new edges to be created).
Edges will be added between all pairs of predecessor and successor nodes that have the same weight. As a consequence, any weight which appears only on predecessor edges will not appear in the output, as there are no successors to pair it with.
- Parameters:
node (int) – The index of the node to remove. If the index is not present in the graph it will be ignored and this function will have no effect.