AT
AtharvaKulkarniIT/internet-packet-flow-simulator
π°οΈ An interactive visual simulator that models internet packet flow across a custom network using max-flow algorithms. It helps analyze routing efficiency using Dinic, Edmonds-Karp, Goldberg-Tarjan, Boykov-Kolmogorov and MCMF algorithms in real-time.
π¦ Internet Packet Flow Simulator
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
π§ Setup Instructions
1. Clone the Repository
git clone https://github.com/AtharvaKulkarniIT/internet-packet-flow-simulator.git
cd internet-packet-flow-simulator2. Compile C++ Algorithms
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_kolmogorov3. Install React Frontend
cd frontend
npm install4. Start the Flask Server
Make sure Python and Flask are installed.
cd server
python server.py5. Start the Frontend
In another terminal:
cd frontend
npm run devπ₯οΈ Recommended Split Terminal Setup
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π Project Overview
- 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
βοΈ Algorithms
| 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) |
π Project Structure
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π License
This project is licensed under the MIT License β use freely, modify and distribute with attribution.
On this page
Languages
C++63.1%JavaScript30.2%Python2.7%CSS2.6%HTML0.7%C0.7%
Contributors
MIT License
Created April 17, 2025
Updated October 9, 2025