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.