Solverbfs
Breadth-First Search (BFS)
Expands in layers and guarantees shortest path in unweighted mazes.
Time: O(V + E)Space: O(V)
How It Works
- Push start cell into a queue.
- Pop in FIFO order and visit neighbors.
- Record each neighbor's parent when first discovered.
- When goal is reached, reconstruct path via parents.
Pros
- Optimal path for unit weights
- Simple and robust
Cons
- Can explore many irrelevant nodes
- Large frontier on wide-open maps
Best use: Reliable shortest path on unweighted grids.
Interesting fact: BFS is equivalent to Dijkstra when every edge has identical weight.
Solverdfs
Depth-First Search (DFS)
Follows one branch deeply before backing up.
Time: O(V + E)Space: O(V)
How It Works
- Push start cell onto a stack.
- Pop and explore a neighbor branch deeply.
- Track discovery parents for reconstruction.
- Backtrack naturally when stack unwinds.
Pros
- Very low overhead
- Strong step-by-step visual clarity
Cons
- No shortest-path guarantee
- Can take long detours
Best use: Showing exploratory behavior rather than shortest paths.
Interesting fact: On tree mazes (perfect mazes), DFS still finds the unique path but may explore much more first.
Solverastar
A* Search
Combines actual cost and heuristic distance to guide exploration.
Time: O(E) to O(E log V), depending on priority structureSpace: O(V)
How It Works
- Maintain open set prioritized by f(n)=g(n)+h(n).
- Expand the cell with lowest estimated total cost.
- Relax neighbors if a better g-cost is found.
- Stop at goal and reconstruct via parents.
Pros
- Usually much faster than BFS
- Optimal with admissible heuristic
Cons
- Needs heuristic tuning
- Bookkeeping heavier than BFS/DFS
Best use: Fast near-optimal routing on grid mazes.
Interesting fact: Manhattan distance is a natural heuristic for 4-directional grids.
Solverastar-euclidean
A* (Euclidean)
A* variant using straight-line distance heuristic.
Time: O(E) to O(E log V), depending on queueSpace: O(V)
How It Works
- Score candidates with f(n)=g(n)+h(n), where h is Euclidean distance.
- Expand the lowest f-score node.
- Relax neighbors with improved g-cost and update parents.
- Stop and reconstruct when reaching goal.
Pros
- Admissible and consistent on grid movement
- Often smooth directional guidance
Cons
- Can expand more than Manhattan A* on 4-neighbor grids
- Still more bookkeeping than BFS
Best use: Comparing heuristic behavior and exploring geometric distance cues.
Interesting fact: Euclidean is tighter for continuous geometry, while Manhattan better matches axis-only moves.
Solverweighted-astar
Weighted A*
Biases A* harder toward the heuristic for more aggressive search.
Time: Often faster than A* in practiceSpace: O(V)
How It Works
- Use f(n)=g(n)+w*h(n) with w>1.
- Expand the node with smallest weighted estimate.
- Continue relaxing neighbors and updating parents.
- Return reconstructed path when goal is dequeued.
Pros
- Lower exploration count
- Good speed at high grid sizes
Cons
- Can lose optimality
- Quality depends on weight
Best use: When responsiveness matters more than guaranteed shortest path.
Interesting fact: Weighted A* is common in games and robotics where near-optimal is acceptable for speed.
Solverdijkstra
Dijkstra
Uniform-cost expansion from the source, optimal for nonnegative weights.
Time: O(E) to O(E log V), depending on queueSpace: O(V)
How It Works
- Initialize start with distance 0 and others with infinity.
- Expand the currently known minimum-distance node.
- Relax each outgoing neighbor distance.
- Stop when goal is finalized.
Pros
- Optimal
- Generalizes to weighted edges
Cons
- More work than BFS on unit weights
- No heuristic acceleration
Best use: Reference optimal solver and weighted-path baselines.
Interesting fact: Dijkstra published his algorithm in 1956 and reportedly designed it in about twenty minutes.
Solvergreedy-best-first
Greedy Best-First
Chooses nodes closest to goal by heuristic only.
Time: Highly input-dependentSpace: O(V)
How It Works
- Keep frontier ordered by heuristic h(n).
- Expand the most goal-looking node.
- Add newly discovered neighbors.
- Reconstruct once goal is found.
Pros
- Very fast in easy layouts
- Small control overhead
Cons
- Not optimal
- Can be misled by local geometry
Best use: Quick approximate solving and heuristic demonstrations.
Interesting fact: Greedy best-first can outperform optimal methods on easy maps but degrade sharply on deceptive ones.
Solverbidirectional-bfs
Bidirectional BFS
Runs two BFS waves from start and goal until they meet.
Time: Often far less than single-source BFSSpace: O(V)
How It Works
- Initialize one queue at start and another at goal.
- Alternate expanding the smaller frontier.
- Detect when a node is seen by both searches.
- Stitch both parent chains into one path.
Pros
- Big practical speedups on long corridors
- Still optimal on unweighted graphs
Cons
- More bookkeeping
- Path merge logic is trickier
Best use: Large mazes with distant start/goal pairs.
Interesting fact: Meeting in the middle can reduce explored states exponentially in branching factor terms.
Solverdead-end-filling
Dead-End Filling
Prunes leaves iteratively until only solution corridor remains.
Time: O(V + E)Space: O(V)
How It Works
- Compute each cell degree in the maze graph.
- Queue non-start/non-goal dead ends (degree <= 1).
- Remove dead ends and update neighbor degrees.
- Remaining cells form the final path corridor.
Pros
- Very different visual style
- No heuristic needed
Cons
- Less intuitive to users expecting search waves
- Best suited to perfect mazes
Best use: Teaching maze topology and pruning-based solving.
Interesting fact: This method solves by elimination, not by explicitly chasing the goal first.
Solverlee-wavefront
Lee Wavefront
Distance-wave flood fill from goal, then gradient backtrace from start.
Time: O(V + E)Space: O(V)
How It Works
- Run BFS-like wavefront from the goal and assign distance labels.
- Stop once start is labeled (or all reachable nodes are processed).
- Trace from start by repeatedly moving to a neighbor with smaller distance.
- Mark traced cells as the final path.
Pros
- Optimal in unweighted mazes
- Path extraction is simple and deterministic
Cons
- Needs full distance map storage
- Can explore broad regions like BFS
Best use: Wave-propagation visualizations and shortest-path extraction via gradients.
Interesting fact: Lee's algorithm is a classic in PCB routing and grid-based shortest-path problems.
Solverwall-follower
Wall Follower (Right-Hand)
Follows one wall consistently to eventually find the goal in simply connected mazes.
Time: Input-dependent, typically O(E) in tree mazesSpace: O(V) with parent tracking
How It Works
- Keep a heading and prefer right turn, then straight, then left, then back.
- Move through open passages while maintaining wall contact.
- Record discovery parents for path reconstruction.
- When goal is reached, reconstruct and display the route.
Pros
- Very intuitive
- Great for demonstrating local decision rules
Cons
- Not generally optimal
- Can fail in non-simply-connected wall topologies
Best use: Educational demos of local navigation strategies.
Interesting fact: In perfect mazes (tree mazes), wall following always reaches the goal because there are no isolated loops.
Solverleft-wall-follower
Wall Follower (Left-Hand)
Left-hand counterpart of wall following with mirrored turn preference.
Time: Input-dependent, typically O(E) in tree mazesSpace: O(V) with parent tracking
How It Works
- Keep one hand on the left wall while moving.
- Prefer left turn, then straight, then right, then back.
- Track visited/discovered cells and parent links.
- Reconstruct path after goal is reached.
Pros
- Simple local rule
- Useful for comparing handedness behavior
Cons
- Not generally optimal
- Same topology limits as right-hand variant
Best use: Educational side-by-side comparison with right-hand wall following.
Interesting fact: In simply connected mazes, left-hand and right-hand rules both solve, but can produce very different traversal traces.
Solverrandom-mouse
Random Mouse
Chooses random moves at junctions with no directional strategy.
Time: Highly variable; can be very largeSpace: O(V) with parent/discovery tracking
How It Works
- Start at entrance and pick random open move each step.
- Record first-discovery parents for optional reconstruction.
- Continue until goal is reached (or fallback solver is applied).
Pros
- Extremely simple
- Great baseline for comparison
Cons
- Unreliable performance
- No optimality guarantees
Best use: Baseline and educational contrast against informed solvers.
Interesting fact: Random Mouse is often used as the lower-bound benchmark in maze-solver studies.
Solverflood-fill
Flood Fill
Floods distance labels, then follows descending gradient to goal.
Time: O(V + E)Space: O(V)
How It Works
- Run wavefront from goal to compute distances.
- Once start distance is known, trace to smaller-distance neighbors.
- Mark traced route as the final shortest path.
Pros
- Shortest path in unweighted mazes
- Clear wave visualization
Cons
- Needs full distance map
- Can expand broad regions
Best use: Micromouse-style distance-field solving demonstrations.
Interesting fact: Flood fill and Lee wavefront are closely related formulations on grid graphs.
Solverpledge
Pledge Algorithm
Wall-following with turn accounting to escape loops/islands.
Time: Input-dependentSpace: Low local memory (higher in visualizer for tracing)
How It Works
- Pick preferred heading.
- Move straight when possible; otherwise follow wall.
- Track net turn count while wall-following.
- Leave wall when heading and turn count reset conditions are met.
Pros
- More robust than naive wall following
- Good local-navigation concept
Cons
- Still not shortest-path optimal
- More state than hand-on-wall rule
Best use: Comparing local heuristics in non-trivial topologies.
Interesting fact: Pledge specifically addresses wall-follower failures around detached wall islands.
Solvertremaux
Tremaux
Mark-based exploration that avoids repeatedly traversing passages.
Time: O(V + E) typicalSpace: O(V + E) for marks
How It Works
- Mark edges/passages as they are traversed.
- Prefer unmarked exits; backtrack on marked branches.
- Avoid over-marked branches unless forced.
- Eventually reaches exit if reachable.
Pros
- Guaranteed for finite mazes
- Human-doable with marks
Cons
- Not shortest-path optimal
- Needs marking memory
Best use: Historical human-solvable guaranteed strategy demos.
Interesting fact: Tremaux's algorithm predates modern graph-search terminology but maps well to DFS ideas.
Solverchain
Chain
Global-map style chaining method that links expansion fronts.
Time: Implementation-dependentSpace: O(V)
How It Works
- Maintain connected exploration chains from endpoints.
- Expand chains while preserving linkage structure.
- Detect and connect chain intersections.
- Reconstruct resulting route(s).
Pros
- Global structural reasoning
- Useful for comparative studies
Cons
- Less common in mainstream libraries
- Harder to implement cleanly
Best use: Advanced solver comparison sets.
Interesting fact: Chain-style methods are documented in Think Labyrinth as broad-topology solvers.
Solvercul-de-sac-filler
Cul-de-sac Filler
Extends dead-end elimination to prune cul-de-sac style branches.
Time: O(V + E)Space: O(V)
How It Works
- Identify dead-end-like and cul-de-sac candidates.
- Iteratively remove non-solution side branches.
- Repeat until only core route structure remains.
Pros
- Topology-first solving
- Useful structural visualization
Cons
- Less intuitive than path search
- Best with full maze map
Best use: Map-analysis style solving workflows.
Interesting fact: Cul-de-sac pruning can be seen as generalized leaf stripping on maze graphs.
Solverblind-alley-sealer
Blind Alley Sealer
Seals blind alleys to reveal viable route corridors.
Time: O(V + E)Space: O(V)
How It Works
- Detect blind alley candidates.
- Seal candidates and update neighborhood state.
- Iterate until no additional blind alleys are found.
Pros
- Strong structural interpretation
- Highlights non-solution regions
Cons
- Requires global map view
- Less direct than shortest-path search
Best use: Structural maze analysis and elimination visuals.
Interesting fact: Sealer variants preserve structural context while removing navigational noise.
Solverblind-alley-filler
Blind Alley Filler
Fills blind alleys iteratively, leaving only viable route cores.
Time: O(V + E)Space: O(V)
How It Works
- Find current blind alleys.
- Fill one or more blind alleys.
- Update neighboring alley status and continue.
Pros
- Simple elimination concept
- Works well in map-view mode
Cons
- Not a local in-maze strategy
- Can be slower than direct search
Best use: Comparing elimination solvers with search-based solvers.
Interesting fact: Blind alley filling is conceptually similar to iterative graph leaf removal.
Solvercollision-solver
Collision Solver
Expands from both ends and solves where search waves collide.
Time: Near bidirectional BFS behaviorSpace: O(V)
How It Works
- Start simultaneous expansion from start and goal.
- Track visited sets and parent links for both waves.
- When waves collide, stitch the two partial paths.
- Output one or multiple shortest collision routes.
Pros
- Fast for distant endpoints
- Natural two-wave visualization
Cons
- More merge bookkeeping
- Depends on collision tie handling
Best use: Bidirectional shortest-path comparisons.
Interesting fact: Collision-style solving is closely tied to bidirectional search theory.
Solvershortest-paths-finder
Shortest Paths Finder (All)
Identifies the full set of cells that belong to shortest routes.
Time: O(V + E)Space: O(V)
How It Works
- Compute distances from start.
- Compute distances from goal.
- Keep cells where dStart + dGoal equals shortest distance.
- Mark resulting shortest-path manifold.
Pros
- Shows all shortest alternatives
- Great for route multiplicity analysis
Cons
- More data than single-path methods
- Can look dense in open areas
Best use: Analyzing alternative optimal routes.
Interesting fact: A single shortest path is just one sample from this full shortest-path set.
Solvershortest-path-finder
Shortest Path Finder
Finds one shortest route from start to goal.
Time: O(V + E) on unweighted mazesSpace: O(V)
How It Works
- Run shortest-path wave expansion.
- Track predecessor for first arrival at each node.
- Reconstruct one optimal route at goal.
Pros
- Deterministic and optimal
- Low conceptual overhead
Cons
- Returns one path only
- Does not enumerate all optimal alternatives
Best use: Practical shortest-route extraction.
Interesting fact: On unweighted grids, this is equivalent to BFS shortest-path recovery.