node-dijkstra icon indicating copy to clipboard operation
node-dijkstra copied to clipboard

Find all shortest paths

Open retorquere opened this issue 3 years ago • 4 comments

Is it possible to return all shortest paths in the case that there is more than one path with the same (minimal) cost?

retorquere avatar Jan 16 '22 08:01 retorquere

I can't think of any easy way.

Given that this implementation uses a couple of optimizations to be the fastest possible, it never attempts to calculate any second paths, it exclusively considers the first least-costly path

albertorestifo avatar Jan 17 '22 09:01 albertorestifo

I can see that. Speed is a reasonable goal for what Dijkstra is used for.

Are there benchmarks for this library against others?

retorquere avatar Jan 17 '22 09:01 retorquere

I didn't do any, not sure if somebody in the community did.

If you feel like doing them, feel free to open a PR to update the README with the results 👍

albertorestifo avatar Jan 17 '22 09:01 albertorestifo

I've gone for an internal implementation (https://github.com/retorquere/zotero-erdos/blob/master/content/dijkstra.ts)

retorquere avatar Jan 17 '22 09:01 retorquere

I'll close this issue given that I think find all path will impact perforce of finding the shortest, and this library focuses on this last use-case.

albertorestifo avatar Dec 13 '22 11:12 albertorestifo