An interactive visualization tool for comparing different pathfinding algorithms (A*, Greedy Best-First Search, and B* Search) in a grid-based environment.
- Interactive grid creation with customizable size and obstacle density
- Real-time visualization of pathfinding algorithms
- Performance comparison metrics and analysis
- Support for three algorithms:
- A* Search (optimal path finding)
- Greedy Best-First Search (fast, near-optimal paths)
- B* Search (beam search variant)
- Detailed performance metrics and visualization
- Interactive UI with matplotlib integration
- Clone the repository:
git clone https://github.com/yourusername/pathfinding-visualization.git
cd pathfinding-visualization- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txtRun the interactive visualization:
python interactive_pathfinding.py- Width and Height: Set the grid dimensions (max 100x100)
- Obstacle Density: Control the percentage of obstacles (0-1)
- Beam Width: Adjust the beam width for B* search
- Adaptive Beam: Toggle adaptive beam width adjustment
- Generate new grids with custom parameters
- Run individual algorithms
- Compare all algorithms simultaneously
- View detailed performance metrics
- Interactive visualization with zoom and pan
- Performance comparison graphs
- Optimal pathfinding algorithm
- Balances path cost and heuristic
- Guarantees shortest path
- Higher exploration in complex scenarios
- Heuristic-based pathfinding
- Fast execution with minimal exploration
- Near-optimal paths in many cases
- Efficient node expansion
- Limited-width search algorithm
- Adaptive beam width based on obstacle density
- Memory-efficient for large grids
- Trade-off between exploration and path quality
The tool provides detailed performance metrics:
- Path Length: Number of steps in the found path
- Nodes Explored: Total nodes visited
- Nodes Expanded: Total node expansions
- Path Efficiency: Relative to the best path found
- Exploration Rate: Nodes explored per path step
A* Analysis:
├─ Path Length: 129
├─ Nodes Explored: 173
├─ Nodes Expanded: 183
├─ Path Efficiency: 100.0%
└─ Exploration Rate: 1.34 nodes/step
Greedy Analysis:
├─ Path Length: 132
├─ Nodes Explored: 133
├─ Nodes Expanded: 133
├─ Path Efficiency: 97.7%
└─ Exploration Rate: 1.01 nodes/step
B* Analysis:
├─ Path Length: 151
├─ Nodes Explored: 290
├─ Nodes Expanded: 940
├─ Path Efficiency: 85.4%
└─ Exploration Rate: 1.92 nodes/step
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Python, Tkinter, and Matplotlib
- Inspired by pathfinding algorithm visualizations
- Thanks to all contributors and users
[Add screenshots of the application here]