Skip to content

This project is a Computer Networks mini-project that demonstrates the working of routing algorithms in a simulated network environment. The application is developed entirely in Python using Streamlit for the frontend interface and NetworkX for graph-based routing computations.

Notifications You must be signed in to change notification settings

shrutmpatil/routing_simulator_cn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unidirectional Routing Algorithm Simulator

This project is a Computer Networks mini-project that demonstrates the working of routing algorithms in a simulated network environment. The application is developed entirely in Python using Streamlit for the frontend interface and NetworkX for graph-based routing computations. It allows users to define a unidirectional network topology and observe how routing decisions are made using algorithms such as Dijkstra (OSPF) and Bellman-Ford (RIP). The simulator provides a visual and analytical understanding of how packets travel through directed paths between routers in a network.

Overview

In this project, users can manually input the routers (nodes), connections (edges), and their respective link costs to form a custom network topology. Each connection in the network is unidirectional, meaning that if a link exists from A → B, it does not necessarily exist from B → A. This approach aligns with real-world computer networks where communication links can have asymmetric properties such as different bandwidths or delays.

The simulator calculates and compares both shortest and longest paths between a chosen source and destination router. It uses visual representation and data tables to display routing results, making it ideal for educational use in understanding routing protocols, network topology design, and path optimization.

Key Features

Allows users to define custom network topologies with directed (one-way) links.

Supports two classical routing algorithms:

Dijkstra’s Algorithm (OSPF) — simulates link-state routing.

Bellman-Ford Algorithm (RIP) — simulates distance-vector routing.

Provides both shortest and longest path analysis between routers.

Displays total path cost, hop count, and intermediate routers.

Uses interactive visualization to show the network and highlight routes.

Developed with Streamlit, offering a clean, browser-based user interface.

Includes graph plotting with direction arrows for clarity in link orientation.

Conceptual Mapping

The project closely relates to concepts taught in Computer Networks, where data packets are transmitted between routers based on routing algorithms and metrics. The simulator models:

Routers as graph nodes.

Unidirectional links as directed graph edges with associated costs.

Link costs as the metrics determining route efficiency.

Routing tables as algorithmic outputs containing optimal paths and total costs.

Path visualization as a means to understand routing convergence and connectivity.

Tools and Technologies

_Programming Language: Python 3.9 or later_

_Frontend Framework: Streamlit_

_Graph & Algorithms Library: NetworkX_

_Visualization Library: Matplotlib_

_Data Handling: Pandas_

Working Principle

The user defines a number of network links (edges), and for each link specifies:

The source node (From)

The destination node (To)

The cost or weight associated with the link

The network is built internally as a directed graph (nx.DiGraph()).

Upon selecting a source and destination router, the app:

Computes the shortest path using Dijkstra’s Algorithm (OSPF).

Computes another shortest path using Bellman-Ford (RIP).

Optionally identifies the longest path for analysis.

Displays results in a data table (algorithm, path, total cost, hops).

Visually highlights the computed route on the topology map.

Example Scenario

Consider the following links in a unidirectional network:

A → B with cost 4

B → C with cost 2

C → D with cost 3

Source Router: A Destination Router: D

Results:

Dijkstra (OSPF): Path → A → B → C → D, Cost → 9, Hops → 3

Bellman-Ford (RIP): Path → A → B → C → D, Cost → 9, Hops → 3

Longest Path: Path → A → B → C → D, Cost → 9, Hops → 3

This shows that both algorithms find the same shortest path, verifying the correctness of the routing logic.

Learning Outcomes

Through this project, students gain practical insights into:

How routing algorithms compute optimal paths in a directed network.

The difference between link-state (OSPF) and distance-vector (RIP) routing protocols.

The impact of unidirectional vs. bidirectional links on network reachability.

Visualization of routing decisions, costs, and topology connectivity.

Real-world relevance of graph theory in Computer Networks.

Future Enhancements

To make the simulator more realistic and powerful, future versions can include:

Automatic routing table generation for each router (showing next hop and total cost).

Simulation of link failures or congestion and dynamic re-routing.

Option to export routing results as CSV or PDF reports.

Visualization of packet forwarding and transmission delay.

Integration of protocol-specific features like RIP hop limits or OSPF area hierarchy.

Project Details

Project Title: Unidirectional Routing Algorithm Simulator

Course: Computer Networks

Author: Shrut Mahendra Patil

Institution: Vidyalankar Institute of Technology, Mumbai

Technology Stack: Python, Streamlit, NetworkX, Matplotlib

Installation & Execution

To set up and run the project:

Clone the repository or download the project folder.

Open a terminal inside the project directory.

(Optional) Create a virtual environment:

python -m venv venv venv\Scripts\activate

Install required dependencies:

pip install -r requirements.txt

Launch the simulator:

streamlit run app.py

Open the provided local URL (usually http://localhost:8501) in a browser.

About

This project is a Computer Networks mini-project that demonstrates the working of routing algorithms in a simulated network environment. The application is developed entirely in Python using Streamlit for the frontend interface and NetworkX for graph-based routing computations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages