Skip to content

add simple cycle enumeration by k shortest simple path algorithm #40145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

kappybar
Copy link
Contributor

Add another algorithm of enumearting simple cycles in digraph, which is based on k shortest simple path algorithm.

For each edge e=uv, delete e from the original graph and enumerate vu simple path in increasing length order by k shortest simple path algorithm to obtain simple cycles that contain e in increasing length order.

Using iterators for each edge e and priority queue makes it possible to enumerate simple cycles in increasing length order.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

#40114

@dcoudert
Copy link
Contributor

I think that the algorithm is not what we want: If I understand well, with the current proposal, you start an iterator from each edge of the graph, so some cycles may be reported more than once.

The correct algorithm should be like:

  1. take edge e=uv and remove it from G
  2. use an kSSP iterator to enumerate all vu paths in G-uv, and so the cycles containing uv
  3. decompose G-uv into strongly connected components and apply the same algorithm from step 1 on each SCC.

We now get a collection of iterators that you can put in a priority queue to enumerate the cycles in the right order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants