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.
- PyDAG.remove_node_retain_edges(node, /, use_outgoing=None, condition=None)#
Remove a node from the graph and add edges from all predecessors to all successors
By default the data/weight on edges into the removed node will be used for the retained edges.
node (int) – The index of the node to remove. If the index is not present in the graph it will be ingored and this function willl have no effect.
use_outgoing (bool) – If set to true the weight/data from the edge outgoing from
nodewill be used in the retained edge instead of the default weight/data from the incoming edge.
A callable that will be passed 2 edge weight/data objects, one from the incoming edge to
nodethe other for the outgoing edge, and will return a
boolon whether an edge should be retained. For example setting this kwarg to:
lambda in_edge, out_edge: in_edge == out_edge
would only retain edges if the input edge to
nodehad the same data payload as the outgoing edge.