Uses asyncio to simulate all routers concurrently exchanging messages and executing algorithms in:
- Distance Vector Routing: Routers with decentralized information about their neighbors update their vectors using the Bellman-Ford algorithm to find optimal routing paths.
- Link State Routing: Routers with a global network view create a shortest path tree using Dijkstra's algorithm to find optimal routing paths.
- Python 3.x, git
- Clone the repository:
git clone https://github.com/Chloe2330/dynamic-routing.git- Set the
PYTHONPATH
cd dynamic-routing
export PYTHONPATH="$(pwd):$PYTHONPATH"- Run DVR Simulation
python -u "distance_vector/dvr.py"- Run LSR Simulation
python -u "link_state/lsr.py"- Typically, each router floods the network with advertisements and constructs its own network graph from the received data. For simplicity, I create the graph once for all routers to share.
- Scope: Only supports simple, undirected network graph topologies.
- Live Update:
- Disable auto-save in VS Code to avoid premature JSON processing
- Manually save
config.jsonafter finalizing changes
- Restrictions: Invalid or complex graphs (e.g., non-existent nodes, multiple edges between nodes) will cause errors or invalid results