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 generalized Dijkstra algorithm #9

Open
wants to merge 142 commits into
base: master
Choose a base branch
from
Open

Add generalized Dijkstra algorithm #9

wants to merge 142 commits into from

Conversation

runeksvendsen
Copy link
Owner

@runeksvendsen runeksvendsen commented Jan 28, 2024

Supports e.g. k shortest paths.

TODO:

  • Clean up code in Dijkstra module
  • Make IndexMinPQ growable and use that
  • Test algorithms in Dijkstra module

Also: add debug tracing to all functions that modify the state arrays
Noting that it empties the queue
TODO: test that BellmanFord and Dijkstra give the same results given a graph with non-negative weights.
TODO: re-enable once #5 and #6 are fixed.
Because Bellman-Ford and Dijkstra find two different shortest paths with the same weight sum.

Possible solution: deterministic sorting of output paths with equal length: `map (sortOn uniquePathId) (groupBy pathWeight resultPaths)`.
Also: improve assertion failure message
Synonym for "updateEdge"
Also: remove unused HasWeight constraints
How the hell was this not caught by any tests?!

TODO: Write actually useful tests
If an item with index i is popped, then decrementing `size` will make the next `pop` overwrite the previous push (assuming that i /= the index of the previous push).

Use a counter that keeps incrementing indefinitely instead of `size`.
instead of shortest path

also: update "level" semantics (see docs)
Tracing would produce a crash since we tried to show "bottom" elements in the "keys" array. Get around that by using `showArrayWithBottoms`.
On `insert` of item that would otherwise fail with an "index >= capacity"-error.
Also: delete unused DotGraph test
instead of just the "label" attribute
Wasn't using the dependencies defined in shell.nix
Let the consumer of the query function do the lookup instead of embedding this into all query functions.
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 this pull request may close these issues.

1 participant