a prins s algorithm
play

A Prins's algorithm repeatedly adds the minimum one endpoint in T - PDF document

Minimum Spanning Trees Kent by Quanrud f EE Kkk G EYE Undirected graph Input f mn Ff IR E edge weights w A spanning tree G is tree in a containing all of V leg n t edges compute the Goal minimum weight abbr MST spanning tree


  1. Minimum Spanning Trees Kent by Quanrud f EE Kkk

  2. G EYE Undirected graph Input f mn Ff IR E edge weights w A spanning tree G is tree in a containing all of V leg n t edges compute the Goal minimum weight abbr MST spanning tree G in sum of edge weights weight of tree wCe T w ee if t.EE z

  3. Applications Network design harder for Approximations like Traveling salesman problems theory deep connections across comb OPT THA r a n EE EE I 4 3 tl E rEi f rE Connect town minimum GOAL w out electrical of wire am

  4. obs Preliminary min ST WAH ST WHA max w w that CWLOG assume we can all edge weights are distinct by consistently breaking ties e g number em edges es ez i less than is ei weighs ej since nice and nice _Wcg isj or

  5. Outline different 4 Describe 1 algorithms their Prove all of correctness 2 at the time same 3 and Discuss data structures the pin down time running Running example A

  6. Prins's algorithm repeatedly adds the minimum one endpoint in T weight edge w PRIM G YE E 7113 W SEV 0 S some vertex 1 for I s while St V 2 min weight edge crossings a e 6 TL SU e3 Eu is S Tte see e 3 return e u u T a Stv S VES UES connecting S 11 Key invariant T tree is a ia

  7. i

  8. Kruskal's algorithm minimum weight repeatedly adds the a cycle edge that does not create G YE KRUSKAL w 1 1 2 while T does not span all of min weight edge F IT in a e is acyclic set Tte 6 T Tt e 3 T return Akey invariant forest T is a gag l l I 1 I p y i i o a

  9. xnxx.tn i IT in

  10. Borivka grow all connected components w in parallel min weight crossing edge Borivka 1 1 of not spanning 2 while T is A 0 U Wlr H for each component B T SCV i 1 weight edge min e w A endpoint in S IIIa te 3 T return T 17 titties r e og o g o_0 to

  11. simulation iii

  12. delete reverse repeatedly weight removes max edge that does disconnect not graph REVERSE GREEDY G YE w 1 T E E FO while 2 max weight edge in A E e B E E e C connected T if is e i T 1 e T 3 return H key a connected T invariant is V subgraph spanning

  13. E z Ex IIT to proofs On

  14. E o V 4 T y be aspanning Tree ETI let T Lemme ee unique cycle which Tte contains Then a contains e T Proof is let since a r e u unique path P there is spanning a T to from U is in V Pte cycle our cykle another there is Suppose Ite DE e ED id T is in D path e a Pte D the unique path P is

  15. An edge e is safe Safee dges if there is 5 such that the set of vertices is e a one endpoint S min weight edge in w s p Leming Any safe edge in every MST is e safe edge whet Gay S be let Proof a e T MST s.T.EE be Let T an twee ICT in CTD w T w

  16. in Tte let be the cycle C unique 5 in a path C starting is e Vhs ending

  17. distinct Lemmas Supposeedge weights are Primlkruskall Borurka Then compute where is safe trees spanning every edge Proof min weight add s inspection Cross

  18. distinct theorem suppose edge weights are safe edges and There l exactly n are the they form MST unique Proof MST safe E Lemma first I safe edges E n Kruskal Pri m's safe Eh Z safe zn i edges

  19. Kruskal's Borivka's Prim's Corollary MST's all return algos Proof I

  20. an edge unsafe is if Unsafeedgese e there cycle C the where is is e a uniquely maximum weight edge 100 49 3 0 14 7

  21. suppose distinct edge weights Femina either safe All unsafe edges or are let T Proot safe not is suppose e be the EET MST let C be the Tte cycle in a 9eI e f has smaller then Ste T weight and a cycle is safe C is suppose e e containing week wcf

  22. Let a connected subgraph T be Lemmy and EET Then weight edgett the max unsafe edge is e an still connected T is e Proof since T connected is e C containing a cycle T contains e them weight k unsafe on cycle corollary works Reverse greedy

  23. Implementation Borivka OCmlogn Kruskal OCmloyn Prim Ocmtrilogn

  24. Borivka grow all connected components w in parallel min weight crossing edge Boruovka 1 1 of not spanning 2 while T is A of U for each component wlrH B T SCV i 1 weight edge min e w endpoint in S ii create C T TO U 3 T return

  25. l ime Boruorkarunning Hadds edges crossing each component in parallel connected Each round halves comp Oclogn rounds at each edge round Each look we one edge per pick out component round 0cm per 0cm login total

  26. Kruskal's algorithm minimum weight repeatedly adds the a cycle edge that does not create G YE KRUSKAL w 1 1 2 while T does not span all of min weight edge E T in a e is acyclic st Tte 6 T Tt e 3 T return H key invariant forest T is a K H t

  27. Kruskal refactored 0 T 2 2 u v3 in increasing order of wce for each e diff components of T if u u are in 1 Tt e 3 T return we need to connected components maintain T a of 6 quickly decide if 2 vertices in same are component

  28. Union Finddatastructuref of disjoint sets maintains collection s.T set containing Union Lu v the combine u set containing and the V and iff True returns Together n yr in the set V are same q u v 0CdCnD be implemented find union very can fast amortized almost 04 per op is sorting Kruskal of Bottleneck 0cm log n

  29. Prins's algorithm repeatedly adds the minimum one endpoint in T weight edge w PRIM G YE E 7113 W SEV 0 S some vertex 1 for T s while St V 2 min weight edge crossing S a e b T SU e3 S Tte 3 return T H key connecting S invariant T tree is a 9 I D I I b

  30. Need quickly identify nearest vertex the outside the tree to tree Prioritygueuedatastructuref insert key insert CK p K priority p w the priority K p decrease decrease a key of k already in the queue to smaller priority a p the and extract min return remove the key minimum priority w

  31. Prim's algo For the keys Tree vertices in not min of any edge priority weight from vertex to Tree Fibonacci Heap OCI Och insertions 0cm extract Ocloyn min keyOCDamortized OCm decrease OCmtrilogn

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend