A comprehensive Java implementation comparing pathfinding algorithms (DFS, BFS, A*) on 2D mazes with statistical analysis of performance across varying obstacle densities.
This project analyzes the performance characteristics of three fundamental pathfinding algorithms through extensive maze simulations. Using custom data structures and 10,000+ test cases per configuration, the study reveals how obstacle density affects algorithm efficiency and solution quality.
- Multiple Pathfinding Algorithms: DFS, BFS, A*, and custom Human-Inspired Search
- Custom Data Structures: Stack, Queue, Heap, Priority Queue, and LinkedList implementations
- Statistical Analysis: Large-scale simulations (10,000+ mazes) with performance metrics
- Visual Interface: Real-time maze generation and pathfinding visualization
- Configurable Parameters: Variable maze sizes (30x30, 50x50) and obstacle densities (0.00-0.99)
- Advanced Heuristics: Manhattan and Euclidean distance functions with weighted optimization
- Depth-First Search (DFS): Stack-based exploration following single paths
- Breadth-First Search (BFS): Queue-based level-by-level exploration
- A Search*: Priority queue with Manhattan distance heuristic
- Human-Inspired Search: Enhanced A* with neighbor quality assessment
- Stack: LIFO structure for DFS backtracking
- Queue: FIFO structure for BFS level exploration
- Heap: Binary heap for priority queue operations
- Priority Queue: Optimized A* cell selection
- LinkedList: Custom implementation with iterator support
Statistical analysis of 10,000 mazes revealed a sigmoid-like probability curve:
- Low density (0.0-0.3): High solvability (~90-100%)
- Critical range (0.3-0.6): Rapid probability decline
- High density (0.6+): Near-zero solvability (~0-5%)
| Algorithm | Path Quality | Performance Notes |
|---|---|---|
| BFS | Optimal (shortest path) | Guaranteed minimum distance |
| A* | Optimal (shortest path) | Matches BFS optimality |
| DFS | Suboptimal | Significantly longer paths |
Cells explored before finding solution:
- A (optimized)*: Most efficient - minimal exploration
- BFS: Moderate efficiency - systematic exploration
- DFS: Least efficient - often explores unnecessary paths
- Human Search: Superior performance through intelligent neighbor selection
// Optimized heuristic function
priority = 5.0 * euclideanDistance + pathCost + 0.5 * neighborQuality- Good/Bad Neighbors: Cells evaluated based on surrounding free space
- Euclidean Distance: More accurate distance estimation than Manhattan
- Weighted Heuristics: 5x weight for distance estimation, 0.5x for neighbor quality
- Human-Inspired A*: Best performance across all densities
- Weighted A*: Nearly matches human search with proper weight factors
- Standard A*: Good performance but suboptimal weighting
- BFS: Reliable but explores more cells than necessary
- DFS: Poorest performance due to non-optimal exploration
- Optimal performance range: 0.1-0.3 obstacle density
- Performance degradation: Begins around 0.4 density
- Algorithm convergence: All algorithms show similar behavior at extreme densities
- Maze.java: Grid representation with obstacle generation
- Cell.java: Individual cell with type and pathfinding metadata
- AbstractMazeSearch.java: Base class for all pathfinding algorithms
- MazeSearchDisplay.java: Visualization interface
- Exploration.java: Main analysis runner for standard algorithms
- MazeHumanSearch.java: Extended analysis with optimized implementations
javac Exploration.java
java Explorationjavac MazeHumanSearch.java
java MazeHumanSearch- Heuristic Optimization: Demonstrated significant improvement through weighted distance functions
- Density Analysis: Quantified relationship between obstacle density and algorithm performance
- Human-Inspired AI: Successfully integrated intuitive pathfinding strategies into algorithmic approach
- Statistical Validation: Large-scale empirical analysis with 10,000+ test cases per configuration
- Custom ADT Implementation: All data structures built from scratch for educational completeness
- Performance Profiling: Comprehensive metrics including path length, cells explored, and success rates
- Algorithm Hybridization: Novel combination of A* with human-intuitive neighbor evaluation
- Scalable Architecture: Supports variable maze sizes and density configurations
Aayan Shah
Computer Science & Physics Student
GitHub Profile