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.PyDAG.can_contract_without_cycle#

PyDAG.can_contract_without_cycle(nodes, /)#

Check if contracting the specified nodes can occur without introducing cycles.

Parameters:

nodes (list[int]) – A set of node indices to check for contraction.

Returns:

True if contraction can proceed without creating cycles, False otherwise.