Skip to content

Comments

Replace Dijkstra with BFS for unit-weight shortest_paths#101

Open
hongjun7 wants to merge 1 commit intoawslabs:mainfrom
hongjun7:update/GTraversal-bfs
Open

Replace Dijkstra with BFS for unit-weight shortest_paths#101
hongjun7 wants to merge 1 commit intoawslabs:mainfrom
hongjun7:update/GTraversal-bfs

Conversation

@hongjun7
Copy link

Issue #, if available:

N/A

Description of changes:

  • Replaced Dijkstra-based shortest path search O(E log V) with Breadth-First Search O(V + E) for unit-weight edges.
  • Switched from a priority queue to collections.deque and simplified traversal accordingly.
  • Preserved existing behavior: supports multiple sources/targets, optional max_distance, and returns paths as lists of (src, rel, dst) triplets.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@cmavro
Copy link
Collaborator

cmavro commented Feb 24, 2026

Thanks @hongjun7 for the PR!

I will run some qualitative tests on my side, good to see the latency improvement!

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.

3 participants