-
Notifications
You must be signed in to change notification settings - Fork 69
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
Yen's Algorithm cannot handle multiple edges #516
Labels
Comments
Hi. You are right, the current edges representation does not allow edges distinction. The kind of graph that can be represented should probably be described in the documentation, or we should think of a possible backward compatible change which would allow to return ids along with edges (the default one being the couple (start, end)). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello !
I noticed that the shortest path in this crate is represented using vertices
Vec<N>
, assuming that there are no multiple edges.This assumption is not an issue when finding the shortest path (as it will only consider the shortest edge among multiple edges). However, for the k-shortest path problem, I believe multiple edges could lead to different scenarios.
Consider the problem of finding 2 shortest loopless paths from A to B in the following graph:
Yen's Algorithm only finds one:
Because currently edges are filtered by (head vertex, tail vertex).
Sadly the pseudocode on Wikipedia also does the same thing 😭.
Have I missed something / is there a simple way to solve this?
The text was updated successfully, but these errors were encountered: