rustworkx icon indicating copy to clipboard operation
rustworkx copied to clipboard

Add `reverse` argument to topological sorters

Open jakelishman opened this issue 6 months ago • 1 comments

This allows lexicographical_topological_sort and TopologicalSorter to produce a topological sort that would have been found if the edges in the graph had reversed directions, without constructing the edge-flipped graph.

This is useful for graphs where we might want to do topological analysis from both ends of the data flow, for example in Qiskit where we occasionally want to find the "final" operations topologically.

Close #1105

jakelishman avatar Feb 21 '24 17:02 jakelishman

Pull Request Test Coverage Report for Build 8116939754

Details

  • 18 of 18 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 96.517%

Totals Coverage Status
Change from base Build 8105396148: 0.03%
Covered Lines: 16820
Relevant Lines: 17427

💛 - Coveralls

coveralls avatar Feb 21 '24 17:02 coveralls

Sorry for disappearing for a while there. I've added the helper in 12a91ec.

jakelishman avatar Mar 01 '24 17:03 jakelishman