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

Add options to path finding algorithms: max cost and max length #130

Open
dmbianco opened this issue Sep 23, 2021 · 1 comment
Open

Add options to path finding algorithms: max cost and max length #130

dmbianco opened this issue Sep 23, 2021 · 1 comment
Labels
feature request A suggestion for a new feature

Comments

@dmbianco
Copy link

Path finding algorithms can be very slow if graph contains millions of nodes and relationships.
Consider Yens algorithm, it is computationally expensive since it should "explore all paths" from source to target; however, in most business contexts, too long or too costly paths are not interesting and are nonetheless discarded ex-post.

I suggest to add two new parameters to path finding algorithms (at least Dijkstra source-target, Dijkstra single source, Yens): max cost and max path length. In this way, one could be able to filter out irrelevant paths during computation. Implementing this parameters could reduce dramatically computation time taking advantage of business constraints.

I have patched GDS library adding these parameters to SourceNodeConfig (for simplicity, it is not the best implementation) and hours have become minutes in our path finding applications in a graph with 10 million nodes and 100 million relationships. This two parameters are very simple to add and could transform a global and too expensive research into a local and fast one.
The complete patch requires to change HugeLongPriorityQueue so that it can store path lengths and Dijkstra so that nodes are not added to queue if they are "too far" from source.

Finally, I think this new features will allow your customers to run path finding algorithms even on big graphs where "local" connections are fundamental and this will allow them to exploit business constraints reducing compute time.

@dmbianco dmbianco added the feature request A suggestion for a new feature label Sep 23, 2021
@knutwalker
Copy link
Member

Hi @dmbianco

thanks for the request. It's a good idea and we have added the feature to our backlog, at least for the Dijkstra-based ones, that you also mentioned. I can give no ETA on when we are starting the work on that, though.

If you like - since you already did some changes on the code - you can also contribute you code under the contribution guidelines, and we can help you clean it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A suggestion for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants