# csc 213 – large scale programming. minimum spanning tree (mst) spanning subgraph subgraph w/ all...

of 35 /35
LECTURE 35: SPANNING TREES CSC 213 – Large Scale Programming

Author: jasmin-sharp

Post on 18-Jan-2016

222 views

Category:

## Documents

Tags:

• #### vertices p

Embed Size (px)

TRANSCRIPT

Splay Trees

Lecture 35:Spanning TreesCSC 213 Large Scale Programming#Minimum Spanning Tree (MST)Spanning subgraphSubgraph w/ all verticesSpanning treeCombinesspanning subgraph + treeORDPITATLSTLDENDFWDCA10198632574#Minimum Spanning Tree (MST)Spanning subgraphSubgraph w/ all verticesSpanning treeCombinesspanning subgraph + treeMSTSpanning tree which minimizes sum of edge weightsORDPITATLSTLDENDFWDCA10198632574#No Cycles in MSTEdge in MST cheaper than one making cycleAssume there exists an edge e not in MSTCycle, C, occurs after adding e to min. spanning treeAssume that f in C heavier than eShrink MST using e and dropping f from C842367798ef842367798ef#Partition PropertyGiven partitioning of vertices in a graphRequired that each vertex in exactly 1 partitionUse smallest edge to connect each of theTo complete following MST, can use either f or e742857398#Kruskals AlgorithmSimilar to Prim-Jarnik, including finding MSTAlso like Prim-Jarnik, adds edges greedilyBut Kruskal processes Edges using PriorityQueueCheck if Edge makes cycle before adding to MSTNo cycles in an MST, so add Edge if no cycle occursDetecting cycles hard, however#Kruskals AlgorithmSimilar to Prim-Jarnik, including finding MSTAlso like Prim-Jarnik, adds edges greedilyBut Kruskal processes Edges using PriorityQueueCheck if Edge makes cycle before adding to MSTNo cycles in an MST, so add Edge if no cycle occursDetecting cycles hard, however

#Kruskals AlgorithmSimilar to Prim-Jarnik, including finding MSTAlso like Prim-Jarnik, adds edges greedilyBut Kruskal processes Edges using PriorityQueueCheck if Edge makes cycle before adding to MSTNo cycles in an MST, so add Edge if no cycle occursDetecting cycles hard, however