1 / 82

Distributed Algorithm for MST

Gallager, Humblet and Spira Productions Present:. Distributed Algorithm for MST. Lecture Outline. Problem description The distinct weights demand Review of spanning trees Properties of spanning trees Kruskal’s algorithm – reminder. The distributed algorithm The idea Preliminaries

gonzalezd
Download Presentation

Distributed Algorithm for MST

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Gallager, Humblet and Spira Productions Present: Distributed Algorithm for MST

  2. Lecture Outline • Problem description • The distinct weights demand • Review of spanning trees • Properties of spanning trees • Kruskal’s algorithm – reminder. • The distributed algorithm • The idea • Preliminaries • The algorithm – Finding the minimum weight outgoing edge • The algorithm – changing the core • The algorithm – Connecting fragments • Correctness • Message complexity • Time complexity

  3. General Description • In this problem we are given an undirected graph (communication network) with N nodes and E edges. • Each edge is associated with a weight which is finite and distinct. • Messages can be transmitted independently in both directions of an edge.

  4. General Description • All messages arrive after a finite but unpredictable delay, without errors and in sequence (FIFO). • The algorithm is uniform (identical code for all nodes)

  5. Lecture Outline • Problem description • The distinct weights demand • Review of spanning trees • Properties of spanning trees • Kruskal’s algorithm – reminder. • The distributed algorithm • The idea • Preliminaries • The algorithm – Finding the minimum weight outgoing edge • The algorithm – changing the core • The algorithm – Connecting fragments • Correctness • Message complexity • Time complexity

  6. Distinct weights? • If the weights are not distinct but the nodes have distinct identities, we can use the nodes’ identities to make the edges’ weight distinct. 5 1 7

  7. Distinct weights? • If the nodes don’t have distinct identities and the weights are not distinct then no uniform distributed algorithm exists.

  8. Distinct weights? • A natural approach is to try and have the nodes select random identities and send a message with these identities to their neighbors. • Even though the expected number of times needed until all identities are distinct is small, for any finite number of trials the probability of failure is not zero.

  9. Lecture Outline • Problem description • The distinct weights demand • Review of spanning trees • Properties of spanning trees • Kruskal’s algorithm – reminder. • The distributed algorithm • The idea • Preliminaries • The algorithm – Finding the minimum weight outgoing edge • The algorithm – changing the core • The algorithm – Connecting fragments • Correctness • Message complexity • Time complexity

  10. Review of spanning trees • A fragment of an MST is a sub-tree, that is, a connected set of nodes and edges of the MST • An outgoing edge is defined as an edge with exactly one end in the fragment Outgoing edge Outgoing edge

  11. Property 1 Given a fragment of an MST, let e be a min. weight outgoing edge of the fragment. Then joining e and its adjacent non-fragment node to the fragment yields another fragment of an MST.

  12. Property 1 - Proof • Suppose e is not in an MST containing the fragment. Adding e to the MST will create a cycle. x e

  13. Property 2 If all edges of a connected graph have different weights, then the MST is unique. Proof:Suppose there are 2 different MSTs. Let e be the minimum weight edge such that e belongs to one MST and not the other.

  14. Property 2 - Proof Proof:Suppose there are 2 different MSTs. Let e be the minimum weight edge such that e belongs to T and does not belong to T’. m e m belongs to T’ and does not belong to T

  15. An Idea The idea of the algorithm will be based on these two properties. We start with N fragments containing a single node. Using property 1 we can enlarge the fragments. Property 2 assures us that when two fragments have a common node, their union is also a fragment.

  16. An Idea Our algorithm will be similar in some ways to Kruskal’s algorithm. • Sort the edges • For each edge, if it connects 2 previously unconnected components, add it. 11 11 7 7 3 3 12 12 5 5 9 9 1 1 ( , , , , , , , , ) 15 15 4 4

  17. Lecture Outline • Problem description • The distinct weights demand • Review of spanning trees • Properties of spanning trees • Kruskal’s algorithm – reminder. • The distributed algorithm • The idea • Preliminaries • The algorithm – Finding the minimum weight outgoing edge • The algorithm – changing the core • The algorithm – Connecting fragments • Correctness • Message complexity • Time complexity

  18. The Idea In the algorithm each fragment finds its minimum weight outgoing edge (asynchronously) and tries to combine with the fragment on the other side of the edge. Exactly how and when this takes place depends on the fragments’ levels. A fragment containing a single node is at level 0.

  19. Case 1 If two fragments have the same level L and the same minimum weight outgoing edge, they combine to form a new fragment at level (L+1). 11 11 Fragment F at level 1 7 7 3 3 12 12 Fragment Fnew at level 2 Core nodes Fragment F at level 1 5 5 9 9 1 Core of Fnew 15 4 4 Fragment F’ at level 1

  20. A low level fragment trying to connect to a higher level fragment never waits Case 2 If fragment F is at level L and fragment F’ at level L’>L is at the other end of the minimum outgoing edge of F, then fragment F is absorbed by F’ (The level remains L’). 11 11 7 7 17 19 Fragment F at level 0 16 9 9 1 15 4 4 Fragment F’ at level 1

  21. Case 3? If fragment F is at level L and fragment F’ at level L>L’ is at the other end of the minimum outgoing edge of F, then no absorption occurs. 11 11 7 7 8 19 Fragment F’ at level 0 16 9 1 15 4 4 Fragment F at level 1

  22. Lecture Outline • Problem description • The distinct weights demand • Review of spanning trees • Properties of spanning trees • Kruskal’s algorithm – reminder. • The distributed algorithm • The idea • Preliminaries • The algorithm – Finding the minimum weight outgoing edge • The algorithm – changing the core • The algorithm – Connecting fragments • Correctness • Message complexity • Time complexity

  23. The nodes • Each node can be in one of three states: Sleeping, Find and Found. • Sleeping is the initial state of all nodes. • The node will be in state Find, when looking for the min. weight outgoing edge of the fragment it belongs to. • In all other times the node will be in state Found.

  24. The nodes • The algorithm starts when one or more nodes wake up spontaneously (or are awaken). • A Sleeping node is awakened by the receipt of any algorithm message.

  25. The edges • For each edge e=(u,v) nodes u and v will have a variable with the edge’s state. • An edge’s state can be one of the following three: Branch, Rejected and Basic. Branch: The edge is part of the MST Rejected: The edge is not part of the MST Basic: No decision has been made thus far

  26. Lecture Outline • Problem description • The distinct weights demand • Review of spanning trees • Properties of spanning trees • Kruskal’s algorithm – reminder. • The distributed algorithm • The idea • Preliminaries • The algorithm – Finding the minimum weight outgoing edge • The algorithm – changing the core • The algorithm – Connecting fragments • Correctness • Message complexity • Time complexity

  27. Finding the min. outgoing edge Level 0 (Single node) When the node awakens: Details to come… • It chooses its minimum weight adjacent edge. • It marks it as a branch of the MST. • It sends a “Connect(0)” message on this edge. • It goes into state Found (waiting for a reply from the node on the other side).

  28. Finding the min. outgoing edge Level 0 (Single node) 11 7 3 12 5 9 1 basic branch basic Connect(0) State=found 15 4 basic

  29. Finding the min. outgoing edge Level L>0: Assume that two level L-1 components with the same minimum outgoing edge e, have just merged to form a new component at level L. The core of the new component’s weight w(e) is the new component’s identity.

  30. Finding the min. outgoing edge Level L>0:The core nodes send initiate messages which are flooded through the branch edges. • Initiate contains: • Fragment Level • Fragment ID • Find basic rejected branch 3 core 5

  31. Finding the min. outgoing edge If two fragments have the same level L but not the same minimum weight outgoing edge. Conclusion: When flooding the initiate message, if there are any components of level L-1 waiting to connect, we send the message to them as well. Fragment Fnew at level 2 11 11 Fragment F’’ at level 1 7 7 3 3 12 12 5 5 9 9 1 Fragment F’ at level 1 15 4 4 Fragment F at level 1

  32. Finding the min. outgoing edge Level L>0:The core nodes send initiate messages which are flooded through the branch edges and (L-1) fragments waiting to connect. basic rejected branch 3 core 5 Level (L-1) fragment waiting to connect on the 5 edge

  33. Finding the min. outgoing edge remember where the message came from Fragment ID (core weight) Go to state Find Fragment level In response to receiving initiate message each node performs the following code: • Response to receipt of Initiate (L, F, S) on edge j • LN  L; FN  F; SN  S; in-branch  j; • best-edgenil; best-wt∞; • for all i ≠j such that SE(i) = Branch do • send Initiate(L, F, S) on edge i; • if S = Find then find-count  find-count + 1 • end; • if S = Find then execute procedure test • end The (L-1) fragments do not get the initiate here but in procedure (2)

  34. When a node receives a test message with an ID identical to it’s own it sends back reject. An exception to this rule is when the node already sent a test messageon this edge and while waiting for the reply it received a test message with ID identical to it’s own accept initiate initiate test(id,L) test(id,L) reject Finding the min. outgoing edge When the other fragments level is greater than or equal to L it sends accept. If the level of the other fragment is smaller, it delays the answer until it’s level is large enough. basic rejected branch 1 3 state=find state= find 2 5 state= find

  35. Finding the min. outgoing edge In response to receiving test message the node performs the following code: • procedure test • if there are adjacent edges in the state Basic then • test-edge the minimum-weight adjacent edge in state Basic; • send Test(LN, FN) on test-edge • end • else • test-edge  nil; execute procedure report • end

  36. Finding the min. outgoing edge This means that all the reports from the “sons” have been received When the node has no basic edges left, receives a report from one of it’s “sons” or receives accept message it perform report. This means that we found an edge or have gone through all the options • procedure report • if find-count = 0 and test-edge = nil then • SN  Found; • send Report(best-wt) on in-branch • end

  37. accept initiate initiate test(id,L) test(id,L) report(3) report(∞) reject Finding the min. outgoing edge basic rejected branch 1 3 state=find state= find state= found 2 5 state= found state= find

  38. Now both core nodes know in which side the minimum weight outgoing edge is Now both core nodes know in which side the minimum weight outgoing edge is Finding the min. outgoing edge Level L>0:The nodes send report messages back through the edge on which they received the initialize message. basic rejected branch 3 core 5

  39. Lecture Outline • Problem description • The distinct weights demand • Review of spanning trees • Properties of spanning trees • Kruskal’s algorithm – reminder. • The distributed algorithm • The idea • Preliminaries • The algorithm – Finding the minimum weight outgoing edge • The algorithm – changing the core • The algorithm – Connecting fragments • Correctness • Message complexity • Time complexity

  40. Changing the core After the minimum outgoing edge of the fragment has been identified, a change-core message is sent from the core node which is on the side of the minimum outgoing edge. The change-core message is passed on to all the nodes on the path from the core node to the minimum outgoing edge.

  41. change-core change-core connect(L) Changing the core basic rejected branch 5 core 3

  42. When we reach the node that found the minimum weight outgoing edge: • we mark the edge as part of the MST • attempt to connect to the fragment on the other side Changing the core This checks if the current node is the one that found the minimum weight outgoing edge In response to receiving change-core message the node performs the following code: • procedure change-core • if SE (best-edge) = Branch then • send Change-core on best-edge • else • send Connect(LN) on best-edge; • SE (best-edge)  Branch • end • Response to receipt of Change-core • execute procedure change-core

  43. Change core for all? As we saw the change-core message is not flooded to all the nodes, but instead, only on the nodes which are on the path from the core nodes to the node with the minimum weight of the best edge. Is that enough?

  44. change-core change-core Change core for all? All the nodes on this side continue sending their messages to the old core which knows of the change. Yes!!! new core basic rejected branch 3 old core 5

  45. Lecture Outline • Problem description • The distinct weights demand • Review of spanning trees • Properties of spanning trees • Kruskal’s algorithm – reminder. • The distributed algorithm • The idea • Preliminaries • The algorithm – Finding the minimum weight outgoing edge • The algorithm – changing the core • The algorithm – Connecting fragments • Correctness • Message complexity • Time complexity

  46. Connecting fragments If two fragments at level L have the same minimum outgoing edge, each sends the message connect(L) over this edge, one in each direction. 11 11 This edge now becomes the core for the component with level (L+1). 7 3 3 12 12 5 5 New initiate messages are sent by the new core’s nodes and the process of finding the minimum weight outgoing edge starts over. 9 9 1 15 4 4

  47. change-core change-core change-core connect(L) connect(L) Connecting fragments basic rejected branch new core L L L+1

  48. Connecting fragments Finally, consider a connect message from node n in a low level fragment with level L and identity F reaches a node n’ in a higher level L’ with identity F’. As we said before a lower level fragment never waits Node n’ immediately sends an initiate message with parameters F’ and L’ to n (which is flooded to all nodes in F)

  49. change-core connect(L) Initiate(L’,F’,?) Initiate(L’,F’,?) Connecting fragments basic rejected branch “new” core L<L’ L L’ L’

  50. basic rejected branch v Initiate(L’,F’,?) L L’ Why ‘?’ If the node sending the initiate has not yet sent its report, then ?=Find The fragment F joins the search (The node will not send report until it also receives a report from v) L<L’

More Related