Lecture19-greedy-minspanningtree

# Kruskals algorithm 1 2 3 1 2 4 5 6 3 8 7 4 6 4 5 6 7

• Notes
• 35

This preview shows page 23 - 35 out of 35 pages.

Kruskal’s Algorithm 1 2 3 1 2 4 5 6 3 8 7 4 6 4 5 6 7 3 4 1: {1,2} 2: {2,3} 3: {4,5} 3: {6,7} 4: {1,4} 4: {2,5} 4: {4,7} 5: {3,5} {1,2}{3}{4}{5}{6}{7} Process each edge in order {1,2,3}{4}{5}{6}{7}

Subscribe to view the full document.

Kruskal’s Algorithm 1 2 3 1 2 4 5 6 3 8 7 4 6 4 5 6 7 3 4 1: {1,2} 2: {2,3} 3: {4,5} 3: {6,7} 4: {1,4} 4: {2,5} 4: {4,7} 5: {3,5} {1,2}{3}{4}{5}{6}{7} {1,2,3}{4}{5}{6}{7} {1,2,3}{4,5}{6}{7}
Kruskal’s Algorithm 1 2 3 1 2 4 5 6 3 8 7 4 6 4 5 6 7 3 4 1: {1,2} 2: {2,3} 3: {4,5} 3: {6,7} 4: {1,4} 4: {2,5} 4: {4,7} 5: {3,5} {1,2}{3}{4}{5}{6}{7} {1,2,3}{4}{5}{6}{7} {1,2,3}{4,5}{6}{7} {1,2,3}{4,5}{6,7}

Subscribe to view the full document.

Kruskal’s Algorithm 1 2 3 1 2 4 5 6 3 8 7 4 6 4 5 6 7 3 4 1: {1,2} 2: {2,3} 3: {4,5} 3: {6,7} 4: {1,4} 4: {2,5} 4: {4,7} 5: {3,5} {1,2}{3}{4}{5}{6}{7} {1,2,3}{4}{5}{6}{7} {1,2,3}{4,5}{6}{7} {1,2,3}{4,5}{6,7} {1,2,3,4,5}{6,7}
Kruskal’s Algorithm 1 2 3 1 2 4 5 6 3 8 7 4 6 4 5 6 7 3 4 1: {1,2} 2: {2,3} 3: {4,5} 3: {6,7} 4: {1,4} 4: {2,5} 4: {4,7} 5: {3,5} {1,2}{3}{4}{5}{6}{7} Must join separate components {1,2,3}{4}{5}{6}{7} {1,2,3}{4,5}{6}{7} {1,2,3}{4,5}{6,7} {1,2,3,4,5}{6,7} rejected

Subscribe to view the full document.

Kruskal’s Algorithm 1 2 3 1 2 4 5 6 3 8 7 4 6 4 5 6 7 3 4 1: {1,2} 2: {2,3} 3: {4,5} 3: {6,7} 4: {1,4} 4: {2,5} 4: {4,7} 5: {3,5} {1,2}{3}{4}{5}{6}{7} Stop when all vertices connected {1,2,3}{4}{5}{6}{7} {1,2,3}{4,5}{6}{7} {1,2,3}{4,5}{6,7} {1,2,3,4,5}{6,7} rejected {1,2,3,4,5,6,7} done
Kruskal’s Algorithm Objective: Identify: - Important operations - Elements of a Greedy algorithm break if size(X) == |V|-1

Subscribe to view the full document.

Kruskal’s Algorithm Objective: Identify: - Important operations - Elements of a Greedy algorithm break if size(X) == |V|-1
3 Questions § Is it correct? § Now § How long does it take? § Next time § Can we do better? § Next time

Subscribe to view the full document.

Correctness § Depends on the idea of a “cut” § Cut Property (a Lemma) : Suppose edges X are part of a minimum spanning tree of G=(V,E). Pick any subset of nodes S for which X does not cross between S and V-S, and let e be the lightest edge across this partition. Then X U {e} is part of some MST
Correctness: Kruskal’s Algorithm Theorem: Kruskal’s Algorithm finds a minimum spanning tree Basis : X =  and G is connected so a solution must exist

Subscribe to view the full document.

Correctness: Kruskal’s Algorithm Theorem: Kruskal’s Algorithm finds a minimum spanning tree Induction Step : Assume X is part of an MST u 1 2 v 3 8 4 6 4 5 6 7 3 4 S X E S vs. V-S is a cut No edge in X leaves S e ={ u,v } is lightest edge that leaves X Cut Property holds X U {e} is part of an MST
Assignment § HW #13 § Due Tuesday (virtual Monday)
You've reached the end of this preview.
• Spring '08
• Jones,M
• Greedy algorithm, Kruskal's algorithm

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern