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

Implement Bellman–Ford #87

Open
dionyziz opened this issue Aug 18, 2018 · 3 comments · May be fixed by #88
Open

Implement Bellman–Ford #87

dionyziz opened this issue Aug 18, 2018 · 3 comments · May be fixed by #88

Comments

@dionyziz
Copy link

dionyziz commented Aug 18, 2018

The current implementation only includes a way to find single source shortest paths in graphs with positive edges using Dijkstra. It would be useful to have an implementation where this restriction is not necessary. This would require the Bellman–Ford algorithm.

Ideally, I would like to see three functions: .dijkstra and .bellmanFord and simply .shortestPaths which chooses the appropriate underlying algorithm among the previous two. This would require keeping track of whether there are any negative edges (by counting them).

@mstou mstou linked a pull request Aug 24, 2018 that will close this issue
@mstou
Copy link

mstou commented Aug 29, 2018

Given that checking for negative edges requires Θ(E) ( maybe until edges are handled diffrently by the library #90 ) , is the .shortestPaths function still wanted? Should I include it in #88 ?

@dionyziz
Copy link
Author

All shortestPath implementations we have are Ω(E) so the asymptotic complexity is not harmed by including an initial check for negative edges. Hence I think it makes sense even if #90 is not implemented.

@mstou
Copy link

mstou commented Aug 29, 2018

Yes, you're right, i'll add it in #88

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

Successfully merging a pull request may close this issue.

2 participants