Minimum Spanning Tree

Generate a connected weighted graph and compare Prim's and Kruskal's algorithms step by step.

Ready.

Prim's Algorithm

Starts from one vertex and repeatedly selects the cheapest edge that connects the current tree to a new vertex.

Kruskal's Algorithm

Processes edges from smallest weight to largest and adds an edge only if it does not create a cycle.