







































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The minimum spanning tree (mst) problem in computer science, focusing on kruskal's algorithm and the cut property. The mst problem aims to build a communication network with the cheapest cost, given a set of computers and maintenance costs for potential links. Kruskal's algorithm builds a spanning tree by successively adding edges in order of increasing weights without forming a cycle with previously chosen edges.
Typology: Study notes
1 / 47
This page cannot be seen from the preview
Don't miss anything!








































nska [email protected]
CS3510 A, Fall 2005 ā p. 1/
Problem:
given a set of computers and a maintenance cost associated with every potential link, build a communicationnetwork which is connected and has the cheapest cost.
CS3510 A, Fall 2005 ā p. 2/
Problem:
given a set of computers and a maintenance cost associated with every potential link, build a communicationnetwork which is connected and has the cheapest cost.^34 B
1 4 4
2
4 6
5 C^
E F
A
D Observation:
the optimal set of edges cannot contain a cycle.
CS3510 A, Fall 2005 ā p. 2/
Problem:
given a set of computers and a maintenance cost associated with every potential link, build a communicationnetwork which is connected and has the cheapest cost.^34 B
1 4 4
2
4 6
5 C^
E F
A
D Observation:
the optimal set of edges cannot contain a cycle.Thus, the solution must be connected and acyclic -
TREE
CS3510 A, Fall 2005 ā p. 2/
INPUT: an undirected, connected graph
with edge weights
w(e)
OUTPUT: a tree
)^ spanning all the vertices of
G^ and
minimizing weight
ā ā² eāE w(e)
(^34) B 1 4 4
2
4 6
5 C^
E F
A
D MST cost in the example above is 16.
CS3510 A, Fall 2005 ā p. 3/
INPUT: an undirected, connected graph
with edge weights
w(e)
OUTPUT: a tree
)^ spanning all the vertices of
G^ and
minimizing weight
ā ā² eāE w(e)
(^34) B 1 4 4
2
4 6
5 C^
E F
A
D MST cost in the example above is 16.
CS3510 A, Fall 2005 ā p. 3/
INPUT: an undirected, connected graph
with edge weights
w(e)
OUTPUT: a tree
)^ spanning all the vertices of
G^ and
minimizing weight
ā ā² eāE w(e)
(^34) B 1 4 4
2
4 6
5 C^
E F
A
D MST cost in the example above is 16. Is it unique?
CS3510 A, Fall 2005 ā p. 3/
Algorithms?
CS3510 A, Fall 2005 ā p. 4/
Algorithms? "Greed ... is good. Greed is right. Greed works." Kruskalās greedy algorithm: build a spanning tree by successively adding edges inorder of increasing weights and in such a way that they donot form a cycle with those edges already chosen.
CS3510 A, Fall 2005 ā p. 4/
Algorithms? "Greed ... is good. Greed is right. Greed works." Kruskalās greedy algorithm: build a spanning tree by successively adding edges inorder of increasing weights and in such a way that they donot form a cycle with those edges already chosen. See example on the board.
CS3510 A, Fall 2005 ā p. 4/
We will proof a more general property first:
CS3510 A, Fall 2005 ā p. 5/
Cut property:
Let^ X
be part of some minimum spanning tree
of^ G^
).^ Pick any set of nodes
V^ such that there is no
edge in
X^ which connects a node in
S^ to one in
S.^ If^ e
is the
minimum-weight edge between
S^ and
S,^ then
e}^ is also
part of some MST.
CS3510 A, Fall 2005 ā p. 5/
Proof:
Assume
e /ā^ T.^ Then
e}^ contains a cycle
Now
C^ contains another edge
ā²^ eacross the cut
e eā S^
V^ ^ S
CS3510 A, Fall 2005 ā p. 6/
Proof:
Assume
e /ā^ T.^ Then
e}^ contains a cycle
Now
C^ contains another edge
ā²^ eacross the cut
e eā S^
V^ ^ S
Consider
e} ā {
ā²ā²e}.It is a tree with
ā² w(T ) =^ w
w(e)
ā^ w
ā²(e)^ ⤠w(T
),^ because
w(e)
ā¤^ w
ā²(e).^ Since
T^ is MST, so is
CS3510 A, Fall 2005 ā p. 6/