Overview
Implement Bidirectional BFS in the pathfinding engine. It simultaneously expands two frontiers — one from the source node and one from the target node — meeting in the middle to halve search depth and explore significantly fewer nodes.
Implementation Details & File Reference
- Algorithm Model: Create
backend/src/main/java/com/algorithmrace/visualizer/algorithms/pathfinding/BidirectionalBFSModel.java extending PathfindingModel.
- Maintain forward queue (
start) and backward queue (end), alternating step expansions.
- Record visited cells with distinct
CellState values (VISITED_FORWARD, VISITED_BACKWARD) for visual distinction.
- Join parent chains when frontiers intersect to reconstruct the complete path.
- Factory Registration: Register
"Bidirectional BFS" in PathfindingFactory.java.
- Complexity Catalog: Add entry with
O(b^(d/2)) time note in ComplexityCatalog.java.
- Frontend Metadata: Add entry in
frontend/src/data/algorithmMetadata.ts.
Definition of Done
- Bidirectional BFS appears in the Pathfinding Arena.
- Grid visualization displays two expanding frontiers converging in the middle.
- Metrics accurately display total cells visited and optimal path length.
Skill Level
Medium — requires dual-frontier state management and path stitching at intersection.
Overview
Implement Bidirectional BFS in the pathfinding engine. It simultaneously expands two frontiers — one from the source node and one from the target node — meeting in the middle to halve search depth and explore significantly fewer nodes.
Implementation Details & File Reference
backend/src/main/java/com/algorithmrace/visualizer/algorithms/pathfinding/BidirectionalBFSModel.javaextendingPathfindingModel.start) and backward queue (end), alternating step expansions.CellStatevalues (VISITED_FORWARD,VISITED_BACKWARD) for visual distinction."Bidirectional BFS"inPathfindingFactory.java.O(b^(d/2))time note inComplexityCatalog.java.frontend/src/data/algorithmMetadata.ts.Definition of Done
Skill Level
Medium — requires dual-frontier state management and path stitching at intersection.