Skip to content

Commented python algorithms for network MST and SP (with visualization via networkx)

Notifications You must be signed in to change notification settings

pbogre/network-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

network-algorithms

Python implementations of common network algorithms and network visualization through networkx

Image of Matplotlib Visualization

algorithms

  • Dijkstra's Shortest Path Algorithm
  • Kruskal's Minimum Spanning Tree Algorithm
  • Prim's Minimum Spanning Tree Algorithm

network representation

Networks are represented with an adjacency matrix e.g.

[0, 0, 5, 2],
[0, 0, 0, 4],
[5, 0, 0, 0],
[2, 4, 0, 0]

main functions

# Algorithms:
Dijkstra(Network N, int Starting Node, [int Finish Node]) # Run and Display Dijkstra's Algorithm
Kruskal(Network N) # Run and Display Kruskal's Algorithm
Prim(Network N) # Run and Display Prim's Algorithm
# Network:
Network(int[] AdjacencyMatrix, [int Seed]) # Initialize network with given adjacency matrix
Network.drawNetwork() # Show network through plotmatlib
Network.printNetwork() # Print network in terminal
# Arguments:
python main.py {seed}

Releases

No releases published

Packages

No packages published

Languages