https://github.com/aymanmomin/the-harry-potter-reunion
https://github.com/aymanmomin/the-harry-potter-reunion
adjacency-list bfs-algorithm dijkstra-algorithm graph matplotlib networkx normalization python3 shortest-path-algorithm shortest-time-path
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/aymanmomin/the-harry-potter-reunion
- Owner: aymanmomin
- License: mit
- Created: 2025-03-24T15:26:28.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-03-24T15:26:47.000Z (3 months ago)
- Last Synced: 2025-03-24T16:32:37.578Z (3 months ago)
- Topics: adjacency-list, bfs-algorithm, dijkstra-algorithm, graph, matplotlib, networkx, normalization, python3, shortest-path-algorithm, shortest-time-path
- Language: Python
- Homepage:
- Size: 327 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# The Harry Potter Reunion
## Overview
This Python program helps Hogwarts alumni find optimal paths to reunite in Ottawa, Canada. It calculates routes based on:
- Shortest hop path
- Shortest distance path
- Shortest time path
- Fewest Dementors path
- Combined optimal path (extra credit)## Features
- Graph representation of provinces and magical paths
- Pathfinding algorithms (BFS, Dijkstra)
- Visualization of the magical network
- Output for all 4 criteria + combined path (extra credit)## Installation
1. Ensure Python 3.x is installed.
2. Install required libraries:
```bash
pip install networkx matplotlib
```## Usage
1. Save the code as `Assignment4.py`.
2. Run the script:
```bash
python Assignment4.py
```
3. Output:
- Optimal paths printed in the terminal
- Graph visualization saved as `magical_network.png`## Example Output
```python
=== Harry Potter (British Columbia) ===
SHP: British Columbia -> Quebec -> Ottawa (Hops: 2)
SDP: British Columbia -> Saskatchewan -> Ottawa (Distance: 1400 km)
STP: British Columbia -> Alberta -> Ottawa (Time: 42 hrs)
FDP: British Columbia -> Quebec -> Ottawa (Dementors: 9)
== Extra Credit: Combined Optimal Path (All Criteria Minimized) ==
Path: British Columbia -> Saskatchewan -> Quebec -> Ottawa
Hops: 3, Distance: 1400 km, Time: 24 hrs, Dementors: 9
Combined Score: 0.4321
```## Outputs
1. **User Joins**: 🐼 Sarah joined the grove!
2. **ASCII Art Broadcast**: "Test it your self 😜"
3. **Invalid Command (Private Error)**: 🐼 No ASCII found for this mood! Try: hey, shy, sleeping, dab, shocked, swag, thanks,## Referred Links
1. Python `socket` module: [Official Documentation](https://docs.python.org/3/library/socket.html)
2. ASCII Art Inspiration/Used from: [ASCII Archive](https://www.asciiart.eu/) and [Emoji Combos](https://emojicombos.com/panda)