Kruskal's Algorithm Visualizer

Find the Minimum Spanning Tree using Kruskal's greedy approach

Controls

Fast Slow

Algorithm Status

Step: 0
Edges in MST: 0 / 4
Total Weight: 0

Complexity Analysis

Time Complexity: O(E log E)
Space Complexity: O(V + E)

Where E = edges, V = vertices

Pseudocode

1. Sort all edges by weight (ascending)
2. Initialize parent array for Union-Find
3. FOR each edge in sorted edges:
4. Find parent of both vertices
5. IF vertices in different sets:
6. Add edge to MST
7. Union the two sets
8. ELSE: Skip edge (creates cycle)
9. Return MST

Current Step Explanation

Click Start or Step to begin the visualization.

Graph Visualization

Edge Processing Order