HomeAbout Me

Minimum Spanning Tree

By Daniel Nguyen
Published in Algorithm
April 17, 2024
1 min read
Minimum Spanning Tree

Spanning Tree

  • Given an undirected, weighted graph G(V, E)
  • A spanning tree is a set of edges:
    • no cycle
    • connect all nodes of graph
  • It is indeed a tree
  • 1 graph can have multiple spanning trees

example
example

Kruskal Algorithm

  • sort the edges in ascending order
  • consider each node as a separacted node in the beginning
  • iterate each edge: (u, v, w)
    • if u and v is not in the same tree:
      • add (u,v) to the spanning tree
      • union(u,v)

Note: for undirected graph only


Tags

#Algorithm

Share

Previous Article
System Design
Next Article
Linked List

Related Posts

Hash Table
April 26, 2024
1 min
© 2025, All Rights Reserved.
Powered By

Quick Links

About Me

Legal Stuff

Social Media