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

Multigraph? #2

Open
cryo75 opened this issue May 20, 2016 · 1 comment
Open

Multigraph? #2

cryo75 opened this issue May 20, 2016 · 1 comment

Comments

@cryo75
Copy link

cryo75 commented May 20, 2016

is it possible to change the main Dijkstra algorithm to search multigraphs? Most probably yes, but what are the changes required because the edges are added to a HashMap?

@mcourteaux
Copy link

You can insert auxiliary nodes yourself, connected by a zero-cost edge.

A -----> B
 \______/

Becomes:

A ---> A1 ---> B
\             /
 \---> A2 ---/

Where the edges from A to A1 and from A to A2 have zero cost. The other edges have the same cost as before.

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