Interactive Jupyter Notebook Game for Visualizing Shortest Path Algorithms on a Campus Map
Campus Path Finder is an interactive Jupyter Notebook game that visualizes and computes paths across a virtual university campus.
It helps users (students or learners) understand graph traversal algorithms and shortest path computation in an engaging, visual way.
Players can select start and target locations (like “Main Gate” → “Library”), explore different routes, and compare their chosen path with the optimal one calculated using Dijkstra’s algorithm.
Once launched, the notebook displays an interactive map built using NetworkX and Matplotlib.
- Choose your Start and Target locations.
- Optionally check “Prefer lifts / avoid stairs”.
- Click Start Game to begin.
- Use dropdowns to move step-by-step between connected buildings.
- Click Finish Route to compare your path against the optimal route.
- Buttons available:
- ✅ Start Game
- ↩ Undo Move
- 🏁 Finish Route
- 💡 Show Hint (reveals shortest path)
- 🔁 Reset Game
You’ll see colorful nodes and edges showing buildings, entrances, under-construction zones, and external areas like hostels or parking.
- Graph Representation: The campus map is modeled as a
NetworkX.Graphwhere:- Nodes represent campus locations (Blocks, Library, Church, Hostel, etc.)
- Edges represent paths or corridors connecting them.
- Weighted Edges: Edges have distances (
length) and attributes likestairs,lift, orclosed. - Shortest Path Computation: Uses
nx.shortest_path()with edge weights to calculate optimal routes. - Interactive Visualization: The graph layout uses a spring layout to minimize clutter and overlap.
- Dynamic UI: Built using
ipywidgetsfor buttons, dropdowns, and game state display.
| Component | Purpose |
|---|---|
| Python 3 | Core programming language |
| NetworkX | Graph creation, traversal, and pathfinding |
| Matplotlib | Visualization of nodes, edges, and paths |
| IpyWidgets | Interactive controls (buttons, dropdowns) |
| Jupyter Notebook | Interactive development and execution |
The visual graph shows different node types:
- 🟦 Regular nodes (classrooms, library)
- 🟩 Entrances
- 🟨 External areas (hostels, parking)
- 🟥 Under construction areas