Used to find the minimum spanning tree of a weighted circuit.
By Zechariah, C21B02
I used to take a subject called Logic and Mathematics, where I learnt about things like Graphs and Trees. We were taught ho to find a minimum spanning tree in the subject, but we did it ourselves and I wanted a way for a computer to do it for me. This lead me to write this script so I can find the minimum spanning tree with a visual representation of the tree.
Go to Algorithm Visualizer
Copy and paste the code in main.js into the right side of the screen where the code is
Press Build then press Play to start the calculation of the minimum spanning tree.
The variable named vertices is just the list of vertices that are on the graph.
The variable named edges contains 3 things: Edge 1, Edge 2 and the Weight of the edge
- JavaScript