An interactive web-based visualizer for classic AI search algorithms built with Brython (Python in the browser).
π View Live Demo
Uninformed Search:
- π΅ Breadth-First Search (BFS)
- π΄ Depth-First Search (DFS)
- π‘ Depth-Limited Search (DLS)
- π’ Iterative Deepening Search (IDS)
- π£ Uniform Cost Search (UCS)
- πΆ Bidirectional Search
Informed Search:
- π Greedy Best-First Search
- β A* Search
- Step-by-step animation with play/pause controls
- Forward/backward stepping through algorithm execution
- Adjustable animation speed (1x to 10x)
- Real-time data display showing Fringe, Visited, and Path
- Color-coded node states for easy tracking
- Responsive canvas with zoom, pan, and grid
- β Add/Delete Nodes
- π Add/Delete Edges
- β Drag to move nodes
- π― Set source and goal nodes
- π’ Edit heuristic values
- βοΈ Edit edge weights
- π Undo/Redo support
- π· PNG: Export static graph images
- π¬ GIF: Record animated algorithm execution
- π PDF: Generate comprehensive reports
- π¨ SVG: Vector graphics for publications
- πΎ JSON: Save/load graph structures
- π CSV: Export performance metrics
-
Standalone Version (GitHub Pages)
- No installation required
- Works entirely in the browser
- Uses Brython (Python in browser)
- Perfect for quick demonstrations
-
Next.js Application (Full-featured)
- User authentication (email/password, OAuth)
- Save and manage multiple graphs
- Version history
- Sharing capabilities
- Advanced analytics
-
Clone the repository:
git clone https://github.com/ashfaknawshad/aisearch-v2.git cd aisearch-v2 -
Open in browser: Simply open
index.htmlin your web browser, or:# Using Python's built-in server python -m http.server 8000Then navigate to
http://localhost:8000 -
Deploy to GitHub Pages:
- Push to GitHub
- Go to repository Settings β Pages
- Select
mainbranch as source - Your site will be live at
https://yourusername.github.io/aisearch-v2/
- Add Nodes: Click "Add Node" tool and click on canvas
- Connect Nodes: Click "Add Edge" tool, click two nodes to connect
- Set Source: The first node is automatically the source (red)
- Set Goal: Click "Set Goal" tool and click a node (green)
- Add Heuristics: For A*/Greedy, click "Edit Heuristic" and click a node
- Add Weights: For UCS/A*, click "Edit Weight" and click an edge
- Select Algorithm: Choose from the dropdown menu
- Start Search: Click "
βΆοΈ Start Search" to begin animation - Control Playback: Use Pause, Step Forward/Back buttons
- Adjust Speed: Use the slider to control animation speed
- View Results: Check the right panel for statistics and path found
| Key | Action |
|---|---|
A |
Add Node tool |
E |
Add Edge tool |
M |
Move Node tool |
D |
Delete Node tool |
G |
Set Goal tool |
H |
Edit Heuristic tool |
Space |
Start/Pause search |
β/β |
Step Backward/Forward |
Ctrl+Z |
Undo |
Ctrl+Y |
Redo |
Ctrl+S |
Save Graph |
R |
Reset View |
L |
Toggle Labels |
- Algorithm Guide - Detailed explanation of all 8 algorithms
- API Reference - Python class documentation
- Deployment Guide - Step-by-step deployment instructions
ai-search-v2/
βββ index.html # Standalone visualizer entry point
βββ main.py # Brython visualization logic
βββ SearchAgent.py # Algorithm implementations
βββ Node.py # Node data structure
βββ PriorityQueue.py # Priority queue & data structures
βββ styles.css # Styling with dark mode
βββ README.md # This file
βββ LICENSE # MIT License
βββ .gitignore # Git ignore rules
βββ docs/ # Documentation
β βββ algorithm-guide.md
β βββ api-reference.md
β βββ deployment-guide.md
βββ nextjs-app/ # Next.js application
βββ package.json
βββ next.config.js
βββ tsconfig.json
βββ prisma/
β βββ schema.prisma
βββ src/
β βββ app/
β βββ components/
β βββ lib/
βββ public/
| Algorithm | Complete | Optimal | Time Complexity | Space Complexity |
|---|---|---|---|---|
| BFS | β Yes | β Yes* | O(V + E) | O(V) |
| DFS | β No | β No | O(V + E) | O(V) |
| DLS | β No** | β No | O(b^l) | O(l) |
| IDS | β Yes | β Yes* | O(b^d) | O(d) |
| UCS | β Yes | β Yes | O(b^(1+βC*/Ξ΅β)) | O(b^(1+βC*/Ξ΅β)) |
| Bidirectional | β Yes | β Yes* | O(b^(d/2)) | O(b^(d/2)) |
| Greedy | β No | β No | O(b^m) | O(b^m) |
| A* | β Yes | β Yes*** | O(b^d) | O(b^d) |
* For unweighted graphs
** Only if goal within depth limit
*** With admissible heuristic
This visualizer is perfect for:
- Computer Science students learning AI search algorithms
- Teachers demonstrating algorithm behavior
- Researchers prototyping and testing heuristics
- Interview preparation for algorithm questions
- Self-learners understanding pathfinding concepts
- HTML5 Canvas for rendering
- Brython (Python in browser)
- Vanilla CSS with CSS variables
- GIF.js for animation export
- jsPDF for PDF reports
- Next.js 14+ (App Router)
- TypeScript
- Prisma ORM
- NextAuth.js
- Tailwind CSS
- PostgreSQL/MongoDB
- Lucide Icons
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Algorithm concepts from "Artificial Intelligence: A Modern Approach" by Russell & Norvig
- Inspired by various online pathfinding visualizers
- Built with β€οΈ for the AI education community
- GitHub: @ashfaknawshad
- Project Link: https://github.com/ashfaknawshad/aisearch-v2
- Add more algorithms (Dijkstra's, Bellman-Ford)
- 3D graph visualization
- Collaborative editing
- Mobile app version
- Algorithm performance comparison tool
- Custom algorithm plugin system
- Tutorial mode with guided walkthroughs
- Integration with graph theory libraries
If you find this project useful, please consider giving it a star! β