Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Pratham71/Discrete-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒ Optimal Network Topology Designer

Minimum Spanning Tree (MST) Visualizer using Primโ€™s & Kruskalโ€™s Algorithms

This application provides an interactive way to design, analyze, and optimize network layouts using Minimum Spanning Tree algorithms.

It is especially useful for academic demonstrations in Discrete Mathematics, Graph Theory, Computer Networks, and Algorithm Design.


๐Ÿ“Œ Project Overview

The tool simulates real-world network design problems:

  • Campus backbone cabling (LAN / fiber)
  • Regional electrical power grid
  • Rural water distribution pipelines
  • Circuit board (PCB) wiring

Users can:

  • Choose predefined scenarios or generate custom graphs
  • Select between Primโ€™s or Kruskalโ€™s algorithm
  • Watch MST construction step-by-step
  • Calculate total network cost based on unit cable price
  • Compare algorithm performance across different graph sizes
  • View network roles: Core, Distribution, Access

๐Ÿง  Key Concepts

Concept Meaning
Spanning Tree A connected acyclic subgraph containing all nodes
MST (Minimal Spanning Tree) A spanning tree with minimum total edge weight
Primโ€™s Algorithm Node-based greedy selection
Kruskalโ€™s Algorithm Edge-based greedy selection

Algorithm Complexity

Algorithm Complexity Recommended Use
Primโ€™s O(E log V) Dense networks
Kruskalโ€™s O(E log E) Sparse networks

๐Ÿš€ Features

  • Real-time MST visualization
  • Adjustable animation step slider
  • Custom adjacency matrix editor
  • Path highlight mode (shortest MST path between nodes)
  • Cluster mode (remove Kโ€“1 highest cost edges)
  • Automatic role classification based on degree
  • Algorithm benchmark simulator
  • Built-in theory tab for quick revision

๐Ÿ“‚ Installation

1. Clone / download the project

git clone git@github.com:Pratham71/Discrete-Project.git
cd Discrete-Project

2. Install dependencies

pip install -r requirements.txt

3. Run the application

streamlit run main.py

๐Ÿ— Project Architecture (Simplified)

main.py
 โ”œโ”€ MST Algorithms
 โ”‚   โ”œโ”€ run_prims()
 โ”‚   โ””โ”€ run_kruskals()
 โ”œโ”€ UnionFind class (cycle detection for Kruskal)
 โ”œโ”€ Scenario dataset generator
 โ”œโ”€ Custom topology graph generator
 โ”œโ”€ Benchmark engine (timing 50 iterations)
 โ””โ”€ Streamlit UI (tabs: Design โ€ข Benchmark โ€ข Theory)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages