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.
- Campus backbone cabling (LAN / fiber)
- Regional electrical power grid
- Rural water distribution pipelines
- Circuit board (PCB) wiring
- 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
| 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 | Recommended Use |
|---|---|---|
| Primโs | O(E log V) | Dense networks |
| Kruskalโs | O(E log E) | Sparse networks |
- 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
git clone git@github.com:Pratham71/Discrete-Project.git
cd Discrete-Projectpip install -r requirements.txtstreamlit run main.pymain.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)