0% found this document useful (0 votes)
13 views

Minimum Spanning Trees: Problem Definition

The document discusses minimum spanning trees, which are connected graphs that span all vertices of a graph using the minimum total cost of edges. It presents Prim's and Kruskal's algorithms for finding minimum spanning trees in graphs represented as adjacency lists in O(m log n) time using suitable data structures, where m is the number of edges and n is the number of vertices.

Uploaded by

sirj0_hn
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Minimum Spanning Trees: Problem Definition

The document discusses minimum spanning trees, which are connected graphs that span all vertices of a graph using the minimum total cost of edges. It presents Prim's and Kruskal's algorithms for finding minimum spanning trees in graphs represented as adjacency lists in O(m log n) time using suitable data structures, where m is the number of edges and n is the number of vertices.

Uploaded by

sirj0_hn
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Minimum

Spanning Trees

Problem Definition
Algorithms: Design
and Analysis, Part II
Overview
Informal Goal: Connect a bunch of points together as cheaply as
possible.

Applications: Clustering (more later), networking.

Blazingly Fast Greedy Algorithms:


- Prim’s Algorithm [1957; also Dijkstra 1959, Jarnik 1930]
- Kruskal’s algorithm [1956]
⇒ O( m log n ) time (using suitable data structures)

# of vertices
# of edges
Tim Roughgarden
Problem Definition
vertices edges
Input: Undirected graph G = ( V , E ) and a cost ce for each edge
e ∈ E.
- Assume adjacency list representation (see Part I for details)
- OK if edge costs are negative
Output: minimum cost tree T ⊆ E that spans all vertices .

i.e., sum of edge costs


I.e.: (1) T has no cycles, (2) the subgraph (V , T ) is connected
(i.e., contains path between each pair of vertices).
not a spanning tree
1
a b
the MST

4 2
3

c d
(disallowed) 5
Standing Assumptions
Assumption #1: Input graph G is connected.
- Else no spanning trees.
- Easy to check in preprocessing (e.g., depth-first search).

Assumption #2: Edge costs are distinct.


- Prim + Kruskal remain correct with ties (which can be broken
arbitrarily).
- Correctness proof a bit more annoying (will skip).

Tim Roughgarden

You might also like