rustworkx icon indicating copy to clipboard operation
rustworkx copied to clipboard

Add equivalent of cycle_basis that returns an edge list

Open IvanIsCoding opened this issue 4 years ago • 3 comments

What is the expected enhancement?

Create an equivalent of the retworkx.cycle_basis method but returning edges instead of nodes.

https://github.com/Qiskit/retworkx/blob/5b90ee7821398625b16aec2e4d782dd2ec26daf2/src/connectivity/mod.rs#L67-L135

The original paper (http://www.cs.kent.edu/~dragan/GraphAn/CycleBasis/p514-paton.pdf) which we implement returns a set of nodes instead a set of edges. #505 pointed out that returning a set of edges is more useful in many cases. The expected enhancement is to have a method for each such that users can get a cycle basis both with nodes and with edges.

IvanIsCoding avatar Jan 14 '22 02:01 IvanIsCoding

This should be fairly straightforward to implement, without needing to refer to a paper for guidance. The idea is to create a spanning tree through graph traversal, then let each non-tree edge induce a cycle in the tree. The key is to do the graph traversal in terms of edges rather than vertices. Then multi-edges won't be a problem.

szhorvat avatar Jan 19 '22 19:01 szhorvat

I'd like to take a closer look into this issue. Can I be assigned?

raynelfss avatar May 26 '23 20:05 raynelfss

Sure thing, I've assigned you to this issue

mtreinish avatar May 26 '23 20:05 mtreinish