Visualize and simulate internet packet routing using graph-based Max-Flow algorithms. Built using React + React Flow for frontend and C++ for high-performance backend algorithms served via Flask server.py
git clone https://github.com/AtharvaKulkarniIT/internet-packet-flow-simulator.git
cd internet-packet-flow-simulator
Make sure you have g++
installed.
g++ backend/dinic.cpp -o bin/dinic
g++ backend/edmonds_karp.cpp -o bin/edmonds_karp
g++ backend/goldberg_tarjan.cpp -o bin/goldberg_tarjan
g++ backend/mcmf.cpp -o bin/mcmf
g++ backend/boykov_kolmogorov.cpp -o bin/boykov_kolmogorov
cd frontend
npm install
Make sure Python and Flask are installed.
cd server
python server.py
In another terminal:
cd frontend
npm run dev
Split your terminal into 3 panes:
# Pane 1 - Flask Server
cd server
python server.py
# Pane 2 - Compile C++ once
cd backend
g++ dinic.cpp -o ../bin/dinic && g++ edmonds_karp.cpp -o ../bin/edmonds_karp
g++ goldberg_tarjan.cpp -o ../bin/goldberg_tarjan && g++ mcmf.cpp -o ../bin/mcmf
g++ boykov_kolmogorov.cpp -o ../bin/boykov_kolmogorov
# Pane 3 - React App
cd frontend
npm run dev
- Interactive UI to add/delete routers (nodes) and connections (edges)
- Select source/destination nodes
- Run simulations using Dinicβs, Edmonds-Karp, Goldberg-Tarjan, MCMF, or Boykov-Kolmogorov
- Visual flow animation on the React Flow canvas
- Backed by high-performance C++ for real-time simulation
Algorithm | Description | Time Complexity | Space Complexity |
---|---|---|---|
Dinicβs | Uses BFS + layered DFS to send flow | O(V^2 * E) |
O(V + E) |
Edmonds-Karp | BFS-based Ford-Fulkerson | O(V * E^2) |
O(V + E) |
Goldberg-Tarjan | Push-relabel with height + excess flow | O(V^2 * sqrt(E)) |
O(V^2) |
MCMF | Min-cost max-flow using SPFA/Dijkstra | O(F * E * logV) |
O(V + E) |
Boykov-Kolmogorov | Augmenting paths via search trees (good for vision) | O(n^2) (practical fast) |
O(V + E) |
internet-packet-simulator/
βββ backend/
β βββ dinic.cpp
β βββ edmonds_karp.cpp
β βββ goldberg_tarjan.cpp
β βββ mcmf.cpp
β βββ boykov_kolmogorov.cpp
β βββ *.h
βββ bin/ # Compiled binaries
β βββ dinic
β βββ edmonds_karp
β βββ goldberg_tarjan
β βββ mcmf
β βββ boykov_kolmogorov
βββ server/
β βββ server.py
βββ frontend/
β βββ src/
β βββ public/
β βββ index.html
β βββ vite.config.js
This project is licensed under the MIT License β use freely, modify and distribute with attribution.