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

Getting all nodes' shortest path cost #4

Open
MicalKarl opened this issue Jan 30, 2019 · 1 comment
Open

Getting all nodes' shortest path cost #4

MicalKarl opened this issue Jan 30, 2019 · 1 comment

Comments

@MicalKarl
Copy link

Since dijkstar algorithm can get a node to another node's shortest path and the node to all other nodes' shortest path. But the project only shows the shortest path from node u to node v, the remaining information of the shortest paths from node u to all other nodes can not be retrieved, some usage of this remaining information can be used! Can you add the interface of getting node u to all other nodes' shortest paths? I'm looking for your rely!

@wylee
Copy link
Owner

wylee commented Jan 30, 2019

Finding paths to all nodes reachable from a given start node isn't well-tested because I haven't had a need for that functionality myself. In theory, you should be able to repeatedly call extract_shortest_path_from_predecessor_list() with the predecessor map returned from single_source_shortest_paths() and each reachable destination node.

Thinking about it now, I suppose the problem is knowing what all the destination nodes are. It should be possible to extract them from the predecessor map, but that's currently not very convenient. I might look into adding a find_all_paths function if I find some time, but in the meantime I would happily accept a patch that includes tests.

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

No branches or pull requests

2 participants