![Page 1: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/1.jpg)
DefinitionsCommon Algorithms
Applications
Minimum Spanning TreesAlgorithms and Applications
Varun Ganesan
18.304 Presentation
Varun Ganesan MSTs
![Page 2: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/2.jpg)
DefinitionsCommon Algorithms
Applications
Outline
1 DefinitionsGraph TerminologyMinimum Spanning Trees
2 Common AlgorithmsKruskal’s AlgorithmPrim’s Algorithm
3 Applications
Varun Ganesan MSTs
![Page 3: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/3.jpg)
DefinitionsCommon Algorithms
Applications
Graph TerminologyMinimum Spanning Trees
Outline
1 DefinitionsGraph TerminologyMinimum Spanning Trees
2 Common AlgorithmsKruskal’s AlgorithmPrim’s Algorithm
3 Applications
Varun Ganesan MSTs
![Page 4: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/4.jpg)
DefinitionsCommon Algorithms
Applications
Graph TerminologyMinimum Spanning Trees
Graphs
In graph theory, a graph is an ordered pair G = (V ,E)comprising a set of vertices or nodes together with a setof edges.
Edges are 2-element subsets of V which represent aconnection between two vertices.
Edges can either be directed or undirected.Edges can also have a weight attribute.
Varun Ganesan MSTs
![Page 5: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/5.jpg)
DefinitionsCommon Algorithms
Applications
Graph TerminologyMinimum Spanning Trees
Graphs
In graph theory, a graph is an ordered pair G = (V ,E)comprising a set of vertices or nodes together with a setof edges.
Edges are 2-element subsets of V which represent aconnection between two vertices.
Edges can either be directed or undirected.Edges can also have a weight attribute.
Varun Ganesan MSTs
![Page 6: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/6.jpg)
DefinitionsCommon Algorithms
Applications
Graph TerminologyMinimum Spanning Trees
Graphs
In graph theory, a graph is an ordered pair G = (V ,E)comprising a set of vertices or nodes together with a setof edges.
Edges are 2-element subsets of V which represent aconnection between two vertices.
Edges can either be directed or undirected.Edges can also have a weight attribute.
Varun Ganesan MSTs
![Page 7: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/7.jpg)
DefinitionsCommon Algorithms
Applications
Graph TerminologyMinimum Spanning Trees
Graphs
In graph theory, a graph is an ordered pair G = (V ,E)comprising a set of vertices or nodes together with a setof edges.
Edges are 2-element subsets of V which represent aconnection between two vertices.
Edges can either be directed or undirected.Edges can also have a weight attribute.
Varun Ganesan MSTs
![Page 8: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/8.jpg)
DefinitionsCommon Algorithms
Applications
Graph TerminologyMinimum Spanning Trees
Connectivity
A graph is connected when there is a path between everypair of vertices.
A cycle is a path that starts and ends with the samevertex.
A tree is a connected, acyclic graph.
Varun Ganesan MSTs
![Page 9: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/9.jpg)
DefinitionsCommon Algorithms
Applications
Graph TerminologyMinimum Spanning Trees
Connectivity
A graph is connected when there is a path between everypair of vertices.
A cycle is a path that starts and ends with the samevertex.
A tree is a connected, acyclic graph.
Varun Ganesan MSTs
![Page 10: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/10.jpg)
DefinitionsCommon Algorithms
Applications
Graph TerminologyMinimum Spanning Trees
Connectivity
A graph is connected when there is a path between everypair of vertices.
A cycle is a path that starts and ends with the samevertex.
A tree is a connected, acyclic graph.
Varun Ganesan MSTs
![Page 11: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/11.jpg)
DefinitionsCommon Algorithms
Applications
Graph TerminologyMinimum Spanning Trees
Outline
1 DefinitionsGraph TerminologyMinimum Spanning Trees
2 Common AlgorithmsKruskal’s AlgorithmPrim’s Algorithm
3 Applications
Varun Ganesan MSTs
![Page 12: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/12.jpg)
DefinitionsCommon Algorithms
Applications
Graph TerminologyMinimum Spanning Trees
Spanning Trees
Formally, for a graph G = (V ,E), the spanning tree isE ′ ⊆ E such that:
∃u ∈ V : (u, v) ∈ E ′ ∨ (v ,u) ∈ E ′ ∀v ∈ VIn other words: the subset of edges spans all vertices.
Linear Graph
|E ′| = |V | − 1In other words: the number of edges is one less than thenumber of vertices, so that there are no cycles.
Varun Ganesan MSTs
![Page 13: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/13.jpg)
DefinitionsCommon Algorithms
Applications
Graph TerminologyMinimum Spanning Trees
Spanning Trees
Formally, for a graph G = (V ,E), the spanning tree isE ′ ⊆ E such that:
∃u ∈ V : (u, v) ∈ E ′ ∨ (v ,u) ∈ E ′ ∀v ∈ VIn other words: the subset of edges spans all vertices.
Linear Graph
|E ′| = |V | − 1In other words: the number of edges is one less than thenumber of vertices, so that there are no cycles.
Varun Ganesan MSTs
![Page 14: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/14.jpg)
DefinitionsCommon Algorithms
Applications
Graph TerminologyMinimum Spanning Trees
Spanning Trees
Formally, for a graph G = (V ,E), the spanning tree isE ′ ⊆ E such that:
∃u ∈ V : (u, v) ∈ E ′ ∨ (v ,u) ∈ E ′ ∀v ∈ VIn other words: the subset of edges spans all vertices.
Linear Graph
|E ′| = |V | − 1In other words: the number of edges is one less than thenumber of vertices, so that there are no cycles.
Varun Ganesan MSTs
![Page 15: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/15.jpg)
DefinitionsCommon Algorithms
Applications
Graph TerminologyMinimum Spanning Trees
What Makes A Spanning Tree The Minimum?
MST Criterion: When the sum of the edge weights in aspanning tree is the minimum over all spanning trees of a graph
Figure: Suppose (b, f ) is removed and (c, f ) is added...
Varun Ganesan MSTs
![Page 16: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/16.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Outline
1 DefinitionsGraph TerminologyMinimum Spanning Trees
2 Common AlgorithmsKruskal’s AlgorithmPrim’s Algorithm
3 Applications
Varun Ganesan MSTs
![Page 17: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/17.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Main Idea
Start with |V | disjoint components.
Consider lesser weight edges first to incrementally connectcomponents.
Make certain to avoid cycles.
Continue until spanning tree is created.
Varun Ganesan MSTs
![Page 18: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/18.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Main Idea
Start with |V | disjoint components.
Consider lesser weight edges first to incrementally connectcomponents.
Make certain to avoid cycles.
Continue until spanning tree is created.
Varun Ganesan MSTs
![Page 19: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/19.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Main Idea
Start with |V | disjoint components.
Consider lesser weight edges first to incrementally connectcomponents.
Make certain to avoid cycles.
Continue until spanning tree is created.
Varun Ganesan MSTs
![Page 20: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/20.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Main Idea
Start with |V | disjoint components.
Consider lesser weight edges first to incrementally connectcomponents.
Make certain to avoid cycles.
Continue until spanning tree is created.
Varun Ganesan MSTs
![Page 21: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/21.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Pseudocode
Kruskal’s Algorithm1 A = 02 foreach v ∈ G.V :3 MAKE-SET(v)4 foreach (u, v) ordered by weight(u, v), increasing:5 if FIND-SET (u) 6= FIND-SET (v ):6 A = A ∪ (u, v)7 UNION(u, v)8 return A
Varun Ganesan MSTs
![Page 22: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/22.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Example
Varun Ganesan MSTs
![Page 23: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/23.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Example
Varun Ganesan MSTs
![Page 24: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/24.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Example
Varun Ganesan MSTs
![Page 25: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/25.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Example
Varun Ganesan MSTs
![Page 26: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/26.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Example
Varun Ganesan MSTs
![Page 27: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/27.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Example
Varun Ganesan MSTs
![Page 28: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/28.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Proof Of Correctness
Spanning Tree ValidityBy avoiding connecting two already connected vertices,output has no cycles.If G is connected, output must be connected.
MinimalityConsider a lesser total weight spanning tree with at leastone different edge e = (u, v).If e leads to less weight, then e would have beenconsidered before some edge that connects u and v in ouroutput.
Varun Ganesan MSTs
![Page 29: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/29.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Proof Of Correctness
Spanning Tree ValidityBy avoiding connecting two already connected vertices,output has no cycles.If G is connected, output must be connected.
MinimalityConsider a lesser total weight spanning tree with at leastone different edge e = (u, v).If e leads to less weight, then e would have beenconsidered before some edge that connects u and v in ouroutput.
Varun Ganesan MSTs
![Page 30: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/30.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Proof Of Correctness
Spanning Tree ValidityBy avoiding connecting two already connected vertices,output has no cycles.If G is connected, output must be connected.
MinimalityConsider a lesser total weight spanning tree with at leastone different edge e = (u, v).If e leads to less weight, then e would have beenconsidered before some edge that connects u and v in ouroutput.
Varun Ganesan MSTs
![Page 31: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/31.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Proof Of Correctness
Spanning Tree ValidityBy avoiding connecting two already connected vertices,output has no cycles.If G is connected, output must be connected.
MinimalityConsider a lesser total weight spanning tree with at leastone different edge e = (u, v).If e leads to less weight, then e would have beenconsidered before some edge that connects u and v in ouroutput.
Varun Ganesan MSTs
![Page 32: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/32.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Proof Of Correctness
Spanning Tree ValidityBy avoiding connecting two already connected vertices,output has no cycles.If G is connected, output must be connected.
MinimalityConsider a lesser total weight spanning tree with at leastone different edge e = (u, v).If e leads to less weight, then e would have beenconsidered before some edge that connects u and v in ouroutput.
Varun Ganesan MSTs
![Page 33: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/33.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Proof Of Correctness
Spanning Tree ValidityBy avoiding connecting two already connected vertices,output has no cycles.If G is connected, output must be connected.
MinimalityConsider a lesser total weight spanning tree with at leastone different edge e = (u, v).If e leads to less weight, then e would have beenconsidered before some edge that connects u and v in ouroutput.
Varun Ganesan MSTs
![Page 34: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/34.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Outline
1 DefinitionsGraph TerminologyMinimum Spanning Trees
2 Common AlgorithmsKruskal’s AlgorithmPrim’s Algorithm
3 Applications
Varun Ganesan MSTs
![Page 35: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/35.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Main Idea
Start with one (any) vertex.
Branch outwards to grow your connected component.
Consider only edges that leave the connected component.
Add smallest considered edge to your connectedcomponent.
Continue until a spanning tree is created.
Varun Ganesan MSTs
![Page 36: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/36.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Main Idea
Start with one (any) vertex.
Branch outwards to grow your connected component.
Consider only edges that leave the connected component.
Add smallest considered edge to your connectedcomponent.
Continue until a spanning tree is created.
Varun Ganesan MSTs
![Page 37: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/37.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Main Idea
Start with one (any) vertex.
Branch outwards to grow your connected component.
Consider only edges that leave the connected component.
Add smallest considered edge to your connectedcomponent.
Continue until a spanning tree is created.
Varun Ganesan MSTs
![Page 38: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/38.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Main Idea
Start with one (any) vertex.
Branch outwards to grow your connected component.
Consider only edges that leave the connected component.
Add smallest considered edge to your connectedcomponent.
Continue until a spanning tree is created.
Varun Ganesan MSTs
![Page 39: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/39.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Main Idea
Start with one (any) vertex.
Branch outwards to grow your connected component.
Consider only edges that leave the connected component.
Add smallest considered edge to your connectedcomponent.
Continue until a spanning tree is created.
Varun Ganesan MSTs
![Page 40: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/40.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Example
Varun Ganesan MSTs
![Page 41: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/41.jpg)
DefinitionsCommon Algorithms
Applications
Kruskal’s AlgorithmPrim’s Algorithm
Proof of Correctness
Both the spanning tree and minimality argument are nearlyidentical for Prim’s as they are for Kruskal’s.
Varun Ganesan MSTs
![Page 42: Minimum Spanning Trees - Massachusetts Institute of …math.mit.edu/~rothvoss/18.304.1PM/Presentations/1-Varun-MST... · Definitions Common Algorithms Applications Kruskal’s Algorithm](https://reader031.vdocuments.us/reader031/viewer/2022020315/5aa069c87f8b9a62178e146f/html5/thumbnails/42.jpg)
DefinitionsCommon Algorithms
Applications
Some Applications
Taxonomy
Clustering Analysis
Traveling Salesman Problem Approximation
Varun Ganesan MSTs