-
Notifications
You must be signed in to change notification settings - Fork 188
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
Option to have multiple paths #6
Comments
同问 |
Looking for this as well, though the problem is that you'd have to somehow tell the graph to avoid minute variations. The graph has no way to know what constitutes a sufficiently unique path. The best way to solve this is perhaps to tell the graph to avoid
Would love to see a more elegant implementation though. |
That's right! All you need to do to get this is:
When you repeat second time the path will be different, as we've made one previous edge impassible. |
A suggestion is to make a link "impassible" if the weight is set to "undefined". I've tried setting it to MAX_SAFE_INTEGER. The problem is that when the pathfinding becomes impossible (e.g. you block off all the routes) with this method, the pathfinder will still treat MAX_SAFE_INTEGER as a number and return a path rather than failing. This contradicts the mental model, leads to silent failures/bugs and is just more overhead to manage. EDIT: I tried using Number.POSITIVE_INFINITY, when all the paths are blocked, it just returns the last Node instead of an array of nodes. |
Is there a way to have an option to show at least 3 shortest paths for given nodes?
The text was updated successfully, but these errors were encountered: