CZ
CalcyZone
computer-science Verified Precision Tool

Kruskal's Minimum Spanning Tree Visualizer

Step-by-step Kruskal's MST calculator showing sorted edge processing, disjoint-set (DSU) cycle checks, and accepted/rejected edges.

Interactive Algorithm Visualizer

Kruskal's MST

Enter your custom input data → Run the real algorithm engine → Observe step transitions.

⚙️ Customize Algorithm Input Data

Step 1 of 7⚡ Algorithm Running
WHAT HAPPENED?

Sorted 6 edges by weight

WHY?

Kruskal's algorithm processes smallest edges first

WHAT CHANGED?

Initialized Disjoint Set Union (DSU)

Interactive SVG Graph Canvas

421582ABCDE

Mathematical Formula

Sort edges by weight. Add edge if find(u) != find(v); union(u, v)

Overview & Explanation

Kruskal algorithm finds a Minimum Spanning Tree for a connected weighted graph.

How It Works

  • Sort all edges in non-decreasing order of weight.
  • Pick the smallest edge and check if it forms a cycle with the spanning tree formed so far.
  • Repeat until V-1 edges are included.

Practical Applications

  • Network cable layout optimization
  • Cluster analysis

Kruskal MST Example

Edges: (A-B, 1), (B-C, 2), (A-C, 3), (C-D, 4)

1

Edge A-B

Weight 1

= ACCEPT
2

Edge B-C

Weight 2

= ACCEPT

Frequently Asked Questions

What is the time complexity of Kruskal's algorithm?
Kruskal runs in O(E log E) time due to edge sorting.