Skip to content
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

Find k shortest paths using Yen's Algorithm #1363

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

nitsatiisc
Copy link

This pull request provides the function get_k_shortest_paths_yen which finds k shortest paths between a source
vertex and a target vertex in a graph. If less than k paths exist between source and target, then all the paths are
returned. We require edge-weights to be positive.

  • [ * ] I ran rustfmt locally
  • [ * ] I have added the tests to cover my changes.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

Nitin added 4 commits December 11, 2024 19:59
…Yen's algorithm to find the k paths in time O(kn^3).
…Yen's algorithm to find the k paths in time O(kn^3).
…Yen's algorithm to find the k paths in time O(kn^3).
@CLAassistant
Copy link

CLAassistant commented Jan 15, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ ranjana-mishra
❌ Nitin


Nitin seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Nitin seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@ranjana-mishra
Copy link

This pull request provides the function get_k_shortest_paths_yen which finds k shortest paths between a source vertex and a target vertex in a graph. If less than k paths exist between source and target, then all the paths are returned. We require edge-weights to be positive.

  • [ * ] I ran rustfmt locally
  • [ * ] I have added the tests to cover my changes.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

closing PR #1284 , as it is duplicate. ( both worked by Nitin )

Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening a PR adding this feature. I haven't looked at the code in any detail yet, before I did I saw some small administrative details:

  1. Can you remove the .idea directory from the commit. Not everyone uses jetbrains ides and the config is often specific to a local environment anyway. I'd suggest setting up a global git ignore so .idea/ is always ignored by git by default.
  2. Could you sign the CLA following the bot's comments in: Find k shortest paths using Yen's Algorithm #1363 (comment) this is a requirement before we can accept any code contributions to the repository.
  3. Can you run cargo fmt and fix anything lint, formatting, tests, etc flag. We document how to run these things locally in: https://github.com/Qiskit/rustworkx/blob/main/CONTRIBUTING.md

Co-authored-by: Kalyan <[email protected]>
Co-authored-by: Nitin <[email protected]>
Co-authored-by: Ranjana <[email protected]>
Co-authored-by: Kalyan <[email protected]>
Co-authored-by: Nitin <[email protected]>
Co-authored-by: Ranjana <[email protected]>
@kaldag
Copy link

kaldag commented Jan 16, 2025

Yen's algorithm was used to get the k-shortest path. This builds on top of an existing shortest path algorithm, like the Dijkstra's algorithm, etc. More on Yen's algorithm - https://people.csail.mit.edu/minilek/yen_kth_shortest.pdf

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

Successfully merging this pull request may close these issues.

5 participants