Kruskal’s Greedy...

46
Kruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan Slavov Primes-Switzerland 23.Juni 2018 Mentor: Kaloyan Slavov 1 / 12

Transcript of Kruskal’s Greedy...

Page 1: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Kruskal’s Greedy Algorithm

Jonas HofmannKantonsschule Uster 5th year

Mentor: Kaloyan SlavovPrimes-Switzerland

23.Juni 2018

Mentor: Kaloyan Slavov

1 / 12

Page 2: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

ProblemYou have a graph G and a function ω : E(G)→ R+.Find a spanning-tree T such that the sum of the weight of all edgesin T is minimal.

What is a Graph?

What is a Tree?

2 / 12

Page 3: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

ProblemYou have a graph G and a function ω : E(G)→ R+.Find a spanning-tree T such that the sum of the weight of all edgesin T is minimal.

What is a Graph?

What is a Tree?

2 / 12

Page 4: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

ProblemYou have a graph G and a function ω : E(G)→ R+.Find a spanning-tree T such that the sum of the weight of all edgesin T is minimal.

What is a Graph?

What is a Tree?

2 / 12

Page 5: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

What is a graph?

A set of vertices connected by edges

The edges don’t have to be straight, and they’re allowed to intersect

3 / 12

Page 6: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

What is a graph?

A set of vertices connected by edges

The edges don’t have to be straight, and they’re allowed to intersect

3 / 12

Page 7: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

What is a graph?

A set of vertices connected by edges

The edges don’t have to be straight, and they’re allowed to intersect

3 / 12

Page 8: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

What is a tree?

A connected graph without any cycles

4 / 12

Page 9: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

What is a tree?

A connected graph without any cycles

4 / 12

Page 10: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

What is a tree?

A connected graph without any cycles

4 / 12

Page 11: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

What is a tree?

A connected graph without any cycles

4 / 12

Page 12: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

What is a forest?

Like a tree, but it doesn’t need to be connected.⇒ A graph without a cycle

5 / 12

Page 13: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

What is a forest?

Like a tree, but it doesn’t need to be connected.⇒ A graph without a cycle

5 / 12

Page 14: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

ProblemYou have a graph G and a function ω : E(G)→ R+.Find a tree T such that the sum of the weight of all edges in T isminimal.

22

3

4

4 3

5

6 / 12

Page 15: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

ProblemYou have a graph G and a function ω : E(G)→ R+.Find a tree T such that the sum of the weight of all edges in T isminimal.

22

3

4

4 3

5

6 / 12

Page 16: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

ProblemYou have a graph G and a function ω : E(G)→ R+.Find a tree T such that the sum of the weight of all edges in T isminimal.

22

3

4

4 3

5

6 / 12

Page 17: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

ProblemYou have a graph G and a function ω : E(G)→ R+.Find a tree T such that the sum of the weight of all edges in T isminimal.

22

3

4

4 3

5

6 / 12

Page 18: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

That is Kruskal’s algorithm

Always add a edge with the lowest weight, which isn’t already in theforest and doesn’t create a cycle.

7 / 12

Page 19: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 1A graph is a tree on n vertices ⇒ it has n− 1 edges

Induction on the number of vertices.

8 / 12

Page 20: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 1A graph is a tree on n vertices ⇒ it has n− 1 edges

Induction on the number of vertices.Trivial case: 1 vertex

8 / 12

Page 21: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 1A graph is a tree on n vertices ⇒ it has n− 1 edges

Induction on the number of vertices.Suppose it holds for n vertices. Let T be a tree on n+ 1 vertices.Find a longest path.

8 / 12

Page 22: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 1A graph is a tree on n vertices ⇒ it has n− 1 edges

Induction on the number of vertices.Suppose it holds for n vertices. Let T be a graph on n+ 1 vertices.Find a longest path. Remove one of the vertices where it ends, youget a new tree T ′

T ′ is a tree on n vertices ⇒ (inductive hypothesis) it has n− 1edges. ⇒ T has n edges.�

8 / 12

Page 23: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 2A graph is a forest on n vertices with k components ⇒ it has n− kedges.

Apply Lemma 1 on all components

by Lemma 1 : in every component # edges = # vertices - 1⇒ # all edges = # all vertices - k�

9 / 12

Page 24: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 2A graph is a forest on n vertices with k components ⇒ it has n− kedges.

Apply Lemma 1 on all components

by Lemma 1 : in every component # edges = # vertices - 1

⇒ # all edges = # all vertices - k�

9 / 12

Page 25: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 2A graph is a forest on n vertices with k components ⇒ it has n− kedges.

Apply Lemma 1 on all components

by Lemma 1 : in every component # edges = # vertices - 1⇒ # all edges = # all vertices - k�

9 / 12

Page 26: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 3F, F ′ are forests on the same n vertices, with |E(F )| < |E(F ′)|.⇒ There exists e ∈ F ′ such that F ∪ e is still a forest.

If that wasn’t the case, adding any e ∈ F ′ to F would create a cycle.⇒ All e ∈ F ′ connect two vertices in a component in F

10 / 12

Page 27: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 3F, F ′ are forests on the same n vertices, with |E(F )| < |E(F ′)|.⇒ There exists e ∈ F ′ such that F ∪ e is still a forest.

If that wasn’t the case, adding any e ∈ F ′ to F would create a cycle.

⇒ All e ∈ F ′ connect two vertices in a component in F

10 / 12

Page 28: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 3F, F ′ are forests on the same n vertices, with |E(F )| < |E(F ′)|.⇒ There exists e ∈ F ′ such that F ∪ e is still a forest.

If that wasn’t the case, adding any e ∈ F ′ to F would create a cycle.⇒ All e ∈ F ′ connect two vertices in a component in F

10 / 12

Page 29: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 3F, F ′ are forests on the same n vertices, with |E(F )| < |E(F ′)|.⇒ There exists e ∈ F ′ such that F ∪ e is still a forest.

If that wasn’t the case, adding any e ∈ F ′ to F would create a cycle.⇒ All e ∈ F ′ connect two vertices in a component in F

10 / 12

Page 30: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 3F, F ′ are forests on the same n vertices, with |E(F )| < |E(F ′)|.⇒ There exists e ∈ F ′ such that F ∪ e is still a forest.

If that wasn’t the case, adding any e ∈ F ′ to F would create a cycle.⇒ All e ∈ F ′ connect two vertices in a component in F

10 / 12

Page 31: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 3F, F ′ are forests on the same n vertices, with |E(F )| < |E(F ′)|.⇒ There exists e ∈ F ′ such that F ∪ e is still a forest.

If that wasn’t the case, adding any e ∈ F ′ to F would create a cycle.⇒ All e ∈ F ′ connect two vertices in a component in F

⇒ # components in F ≤ #components in F ′.

10 / 12

Page 32: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 3F, F ′ are forests on the same n vertices, with |E(F )| < |E(F ′)|.⇒ There exists e ∈ F ′ such that F ∪ e is still a forest.

If that wasn’t the case, adding any e ∈ F ′ to F would create a cycle.⇒ All e ∈ F ′ connect two vertices in a component in F

⇒ |C(F )| ≤ |C(F ′)|

10 / 12

Page 33: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 3F, F ′ are forests on the same n vertices, with |E(F )| < |E(F ′)|.⇒ There exists e ∈ F ′ such that F ∪ e is still a forest.

If that wasn’t the case, adding any e ∈ F ′ to F would create a cycle.⇒ All e ∈ F ′ connect two vertices in a component in F

⇒ |C(F )| ≤ |C(F ′)||E(F )| < |E(F ′)|

10 / 12

Page 34: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 3F, F ′ are forests on the same n vertices, with |E(F )| < |E(F ′)|.⇒ There exists e ∈ F ′ such that F ∪ e is still a forest.

If that wasn’t the case, adding any e ∈ F ′ to F would create a cycle.⇒ All e ∈ F ′ connect two vertices in a component in F

⇒ |C(F )| ≤ |C(F ′)||E(F )| < |E(F ′)|

⇒ n− |C(F )| < n− |C(F ′)|

10 / 12

Page 35: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Lemma 3F, F ′ are forests on the same n vertices, with |E(F )| < |E(F ′)|.⇒ There exists e ∈ F ′ such that F ∪ e is still a forest.

If that wasn’t the case, adding any e ∈ F ′ to F would create a cycle.⇒ All e ∈ F ′ connect two vertices in a component in F

⇒ |C(F )| ≤ |C(F ′)||E(F )| < |E(F ′)|

⇒ n− |C(F )| < n− |C(F ′)|contradiction! �

10 / 12

Page 36: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Graph G, trees T and H, with ω(T ) > ω(H)Sort the edges in H and T by weight. ⇒ h1, ..., hn and t1, ..., tnHi and Ti are the forests made by the first i edges of H and T

t1t2

t3

t4

Let k be the first step ω(Hk) is smaller than ω(Tk)i.e ω(Hk) < ω(Tk) but ω(Hk−1) ≥ ω(Tk−1) ⇒ ω(hk) < ω(tk)

11 / 12

Page 37: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Graph G, trees T and H, with ω(T ) > ω(H)Sort the edges in H and T by weight. ⇒ h1, ..., hn and t1, ..., tnHi and Ti are the forests made by the first i edges of H and T

t1t2

t3

t4

Let k be the first step ω(Hk) is smaller than ω(Tk)i.e ω(Hk) < ω(Tk) but ω(Hk−1) ≥ ω(Tk−1)

⇒ ω(hk) < ω(tk)

11 / 12

Page 38: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Graph G, trees T and H, with ω(T ) > ω(H)Sort the edges in H and T by weight. ⇒ h1, ..., hn and t1, ..., tnHi and Ti are the forests made by the first i edges of H and T

t1t2

t3

t4

Let k be the first step ω(Hk) is smaller than ω(Tk)i.e ω(Hk) < ω(Tk) but ω(Hk−1) ≥ ω(Tk−1) ⇒ ω(hk) < ω(tk)

11 / 12

Page 39: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Graph G, trees T and H, with ω(T ) > ω(H)Sort the edges in H and T by weight. ⇒ h1, ..., hn and t1, ..., tnHi and Ti are the forests made by the first i edges of H and T

t1t2

t3

t4

Let k be the first step ω(Hk) is smaller than ω(Tk)i.e ω(Hk) < ω(Tk) but ω(Hk−1) ≥ ω(Tk−1) ⇒ ω(hk) < ω(tk)

11 / 12

Page 40: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

Graph G, trees T and H, with ω(T ) > ω(H)Sort the edges in H and T by weight. ⇒ h1, ..., hn and t1, ..., tnHi and Ti are the forests made by the first i edges of H and T

t1t2

t3

t4

Let k be the first step ω(Hk) is smaller than ω(Tk)i.e ω(Hk) < ω(Tk) but ω(Hk−1) ≥ ω(Tk−1) ⇒ ω(hk) < ω(tk)

11 / 12

Page 41: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

ω(hk) < ω(tk)

Lemma 3 ⇒ there is a hj ∈ Hk such that Tk−1 ∪ hj is a forest.We know ω(hj) ≤ ω(hk) because h is sorted.⇒ ω(hj) ≤ ω(hk) < ω(tk)Kruskal’s algorithm wouldn’t chose tk at step k.⇒ contradiction ⇒ Kruskal’s Algorithm finds a minimum weightspanning-tree!

12 / 12

Page 42: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

ω(hk) < ω(tk)Lemma 3 ⇒ there is a hj ∈ Hk such that Tk−1 ∪ hj is a forest.

We know ω(hj) ≤ ω(hk) because h is sorted.⇒ ω(hj) ≤ ω(hk) < ω(tk)Kruskal’s algorithm wouldn’t chose tk at step k.⇒ contradiction ⇒ Kruskal’s Algorithm finds a minimum weightspanning-tree!

12 / 12

Page 43: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

ω(hk) < ω(tk)Lemma 3 ⇒ there is a hj ∈ Hk such that Tk−1 ∪ hj is a forest.We know ω(hj) ≤ ω(hk) because h is sorted.

⇒ ω(hj) ≤ ω(hk) < ω(tk)Kruskal’s algorithm wouldn’t chose tk at step k.⇒ contradiction ⇒ Kruskal’s Algorithm finds a minimum weightspanning-tree!

12 / 12

Page 44: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

ω(hk) < ω(tk)Lemma 3 ⇒ there is a hj ∈ Hk such that Tk−1 ∪ hj is a forest.We know ω(hj) ≤ ω(hk) because h is sorted.⇒ ω(hj) ≤ ω(hk) < ω(tk)

Kruskal’s algorithm wouldn’t chose tk at step k.⇒ contradiction ⇒ Kruskal’s Algorithm finds a minimum weightspanning-tree!

12 / 12

Page 45: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

ω(hk) < ω(tk)Lemma 3 ⇒ there is a hj ∈ Hk such that Tk−1 ∪ hj is a forest.We know ω(hj) ≤ ω(hk) because h is sorted.⇒ ω(hj) ≤ ω(hk) < ω(tk)Kruskal’s algorithm wouldn’t chose tk at step k.

⇒ contradiction ⇒ Kruskal’s Algorithm finds a minimum weightspanning-tree!

12 / 12

Page 46: Kruskal’s Greedy Algorithmmath.mit.edu/research/highschool/primes/Switzerland/2018/5-Trees.pdfKruskal’s Greedy Algorithm Jonas Hofmann Kantonsschule Uster 5th year Mentor: Kaloyan

ω(hk) < ω(tk)Lemma 3 ⇒ there is a hj ∈ Hk such that Tk−1 ∪ hj is a forest.We know ω(hj) ≤ ω(hk) because h is sorted.⇒ ω(hj) ≤ ω(hk) < ω(tk)Kruskal’s algorithm wouldn’t chose tk at step k.⇒ contradiction ⇒ Kruskal’s Algorithm finds a minimum weightspanning-tree!

12 / 12