Minimal Spanning Tree

Similar documents
Minimal Spanning Tree

Distributed Algorithms

Routing Algorithms. CS60002: Distributed Systems. Pallab Dasgupta Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur

Agreement Protocols. CS60002: Distributed Systems. Pallab Dasgupta Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur

IS 709/809: Computational Methods in IS Research Fall Exam Review

Minimum Spanning Trees

Minimum spanning tree

UNIVERSITY OF YORK. MSc Examinations 2004 MATHEMATICS Networks. Time Allowed: 3 hours.

Homework Assignment 1 Solutions

1 Some loose ends from last time

ICS 252 Introduction to Computer Design

Fast and compact self-stabilizing verification, computation, and fault detection of an MST

Maximum Flow Problem (Ford and Fulkerson, 1956)

Time Complexity. CS60001: Foundations of Computing Science

CS325: Analysis of Algorithms, Fall Final Exam

Algorithm Design Strategies V

Ordering and Consistent Cuts Nicole Caruso

(tree searching technique) (Boolean formulas) satisfying assignment: (X 1, X 2 )

Fault-Tolerant Consensus

AGREEMENT PROBLEMS (1) Agreement problems arise in many practical applications:

Math Models of OR: Branch-and-Bound

INF2220: algorithms and data structures Series 1

The Leader Election Protocol (IEEE 1394)

Discrete Wiskunde II. Lecture 5: Shortest Paths & Spanning Trees

Symmetric Rendezvous in Graphs: Deterministic Approaches

Today. Vector Clocks and Distributed Snapshots. Motivation: Distributed discussion board. Distributed discussion board. 1. Logical Time: Vector clocks

Minimal Spanning Tree From a Minimum Dominating Set

Discrete Optimization 2010 Lecture 2 Matroids & Shortest Paths

Chapter 7 Network Flow Problems, I

Clock Synchronization

Lecture 17: Trees and Merge Sort 10:00 AM, Oct 15, 2018

Counting and Constructing Minimal Spanning Trees. Perrin Wright. Department of Mathematics. Florida State University. Tallahassee, FL

1. Problem I calculated these out by hand. It was tedious, but kind of fun, in a a computer should really be doing this sort of way.

Algorithm Design and Analysis

CMPSCI611: The Matroid Theorem Lecture 5

arxiv: v1 [cs.dc] 19 Oct 2017

VIII. NP-completeness

Problem Set 1. CSE 373 Spring Out: February 9, 2016

CS60007 Algorithm Design and Analysis 2018 Assignment 1

Figure 10.1 Skew between computer clocks in a distributed system

Divide and Conquer Algorithms

Computing Connected Components Given a graph G = (V; E) compute the connected components of G. Connected-Components(G) 1 for each vertex v 2 V [G] 2 d

Information System Design IT60105

CS 161: Design and Analysis of Algorithms

Practice Final Solutions. 1. Consider the following algorithm. Assume that n 1. line code 1 alg(n) { 2 j = 0 3 if (n = 0) { 4 return j

Discrete Mathematics, Spring 2004 Homework 9 Sample Solutions

Greedy Alg: Huffman abhi shelat

Outline. The Leader Election Protocol (IEEE 1394) IEEE 1394 High Performance Serial Bus (FireWire) Motivation. Background. Protocol Descriptions

JOURNAL OF ALGORITHMS 3, (1982) An O(n log n) Unidirectional Distributed Algorithm for Extrema Finding in a Circle DANNY DOLEV, MARIA KLAWE, A

Divide and Conquer Algorithms

Preliminaries. Graphs. E : set of edges (arcs) (Undirected) Graph : (i, j) = (j, i) (edges) V = {1, 2, 3, 4, 5}, E = {(1, 3), (3, 2), (2, 4)}

6.852: Distributed Algorithms Fall, Class 24

Unreliable Failure Detectors for Reliable Distributed Systems

Lecture 4 : Introduction to Low-density Parity-check Codes

Fast self-stabilizing k-independent dominating set construction Labri Technical Report RR

6.852: Distributed Algorithms Fall, Class 8

Fibonacci (Min-)Heap. (I draw dashed lines in place of of circular lists.) 1 / 17

SFM-11:CONNECT Summer School, Bertinoro, June 2011

Divide & Conquer. CS 320, Fall Dr. Geri Georg, Instructor CS320 Div&Conq 1

Variations on Itai-Rodeh Leader Election for Anonymous Rings and their Analysis in PRISM

Disjoint-Set Forests

25. Minimum Spanning Trees

25. Minimum Spanning Trees

Combinatorial Optimization

Distributed MST for constant diameter graphs

Graph-theoretic Problems

2 GRAPH AND NETWORK OPTIMIZATION. E. Amaldi Introduction to Operations Research Politecnico Milano 1

Fundamental Algorithms

Total Algorithms. Gerard Tel. Department of Computer Science, University of Utrecht, P.O. Box , 3508 TB Utrecht, The Netherlands.

Data Structures and Algorithms

Introduction. Foundations of Computing Science. Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

CSE 613: Parallel Programming. Lecture 9 ( Divide-and-Conquer: Partitioning for Selection and Sorting )

Slides for Chapter 14: Time and Global States

Analysis of Algorithms. Outline 1 Introduction Basic Definitions Ordered Trees. Fibonacci Heaps. Andres Mendez-Vazquez. October 29, Notes.

Discrete Optimization 2010 Lecture 1 Introduction / Algorithms & Spanning Trees

The Complexity of a Reliable Distributed System

On shredders and vertex connectivity augmentation

CptS 464/564 Fall Prof. Dave Bakken. Cpt. S 464/564 Lecture January 26, 2014

CS781 Lecture 3 January 27, 2011

Our Problem. Model. Clock Synchronization. Global Predicate Detection and Event Ordering

CSE 202: Design and Analysis of Algorithms Lecture 3

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

CS 347 Parallel and Distributed Data Processing

Network Algorithms and Complexity (NTUA-MPLA) Reliable Broadcast. Aris Pagourtzis, Giorgos Panagiotakos, Dimitris Sakavalas

Machine Learning for Data Science (CS4786) Lecture 24

An O(1) RMRs Leader Election Algorithm

Data selection. Lower complexity bound for sorting

2. A vertex in G is central if its greatest distance from any other vertex is as small as possible. This distance is the radius of G.

University of New Mexico Department of Computer Science. Final Examination. CS 362 Data Structures and Algorithms Spring, 2007

Growth of Functions. As an example for an estimate of computation time, let us consider the sequential search algorithm.

1 Introduction (January 21)

Midterm 1 for CS 170

Binary Search Trees. Motivation

Bounds on the Traveling Salesman Problem

Termination Problem of the APO Algorithm

CS599: Convex and Combinatorial Optimization Fall 2013 Lecture 17: Combinatorial Problems as Linear Programs III. Instructor: Shaddin Dughmi

Binary Decision Diagrams

Section 6 Fault-Tolerant Consensus

3.4 Relaxations and bounds

Transcription:

1 Minimal Spanning Tree CS60002: Distributed Systems Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur

2 Leader Election versus Spanning Tree Let C E be message complexity of the election problem and C T be the message complexity of finding a spanning tree Given a spanning tree, we can run election algorithm on tree to find a leader in O(N) time Thus: C E C T + O(N) Given a leader, we can run the echo algorithm to find a spanning tree with 2 E messages Thus: C T C E + 2 E Any comparison election algorithm for arbitrary networks has a (worst case and average case) message complexity of at least ( E + NlogN) Therefore the two problems are of the same order of magnitude

3 Minimal Spanning Tree Let G = (V, E) be a weighted graph, where (e) denotes the weight of edge e. The weight of a spanning tree T of G equals the sum of the weights of the N 1 edges contained in T T is called a minimal spanning tree if no spanning tree has a smaller weight than T. If all edge weights are different, there is only one MST

4 The notion of a fragment A fragment is a subtree of a MST If F is a fragment and e is the least-weight outgoing edge of F, then F U {e} is a fragment Prim s Algorithm: Start with a single fragment and enlarges it in each step with the lowest-weight outgoing edge of the current fragment Kruskal s Algorithm: Starts with a collection of single-node fragments and merges fragments by adding the lowest-weight outgoing edge of some fragment

5 Gallager-Humblet-Spira Algorithm Distributed algorithm based on Kruskal s algorithm Assumptions: Each edge e has a unique edge weight (e) All nodes though initially asleep awaken before they start the execution of the algorithm. When a process is woken up by a message, it first executes the local initialization procedure, then processes the message

6 Gallager-Humblet-Spira Algorithm Algorithm Outline: 1) Start with each node as a one-node fragment 2) The nodes in a fragment cooperate to find the lowest-weight outgoing edge of the fragment 3) When the lowest-weight outgoing edge of a fragment is known, the fragment will be combined with another fragment by adding the outgoing edge, in cooperation with the other fragment 4) The algorithm terminates when only one fragment remains

7 Gallager-Humblet-Spira Algorithm Notations and Definitions: 1) Fragment name. To determine whether an edge is an outgoing edge, we need to give each fragment a name. 2) Fragment levels. Each fragment is assigned a level, which is initially 0 for an initial one-node fragment. 3) Combining large and small level fragments. The smaller level fragment combines into the larger level fragment by adopting the fragment name and level of the larger level fragment. Fragments of the same level combine to form a fragment of a level which is one higher than the two fragments. The new name is the weight of the combining edge, which is called the core edge of the new fragment.

8 Gallager-Humblet-Spira Algorithm Summary of combining strategy: A fragment F with name FN and level L is denoted as F = (FN, L); let e F denote the lowest-weight outgoing edge of F. Rule A. If e F leads to a fragment F = (FN, L ) with L < L, F combined into F, after which the new fragment has name FN and level L. These new values are sent to all processes in F Rule B. If e F leads to a fragment F = (FN, L ) with L = L and e F = e F, the two fragments combine into a new fragment with level L+1 and name (e F ). These new values are sent to all processes in F and F. Rule C. In all other cases fragment F must wait until rule A or B applies

9 Gallager-Humblet-Spira Algorithm Node and link status: statch p [q]: Node p maintains the status of the edge pq. The status is branch if the edge is known to be in the MST, reject if the edge is known not to be in the MST, and basic otherwise. father p : For each process p in the fragment, father p is the edge leading to the core edge of the fragment. state p : State of node p is find if p is currently engaged in the fragment s search for the lowest-weight outgoing edge and found otherwise. Initially it is in state sleep.

GHS Algorithm: Part-1 var state p : (sleep, find, found) ; 10 statch p [q] : (basic, branch, reject) for each q Neigh p ; name p, bestwt p : real ; level p : integer ; testch p, bestch p, father p : Neigh p ; rec p : integer; (1) As the first action of each process, the algorithm must be initialized: begin let pq be the channel of p with smallest weight ; statch p [q] := branch ; level p := 0 ; state p := found ; rec p := 0 ; s connect, 0 to q

11 GHS Algorithm: Part-1 (2) Upon receipt of connect, L from q: begin if L < level p then (* Combine with rule A *) else begin statch p [q] := branch ; s initiate, level p, name p, state p to q if statch p [q] = basic then (* Rule C *) process the message later else (* Rule B *) s initiate, level p + 1, (pq), find to q

12 GHS Algorithm: Part-1 (3) Upon receipt of initiate, L, F, S from q: begin level p := L ; name p := F ; state p := S ; father p := q ; bestch p := udef ; bestwt p := ; forall r Neigh p : statch p [r] = branch r q do s initiate, L, F, S to r ; if state p = find then begin rec p := 0; test

13 Testing the edges To find its lowest-weight outgoing edge, node p inspects its outgoing edges in increasing order of weight. To inspect edge pq, p ss a test, level p, name p message to q and waits for an answer A reject message is sent by process q if q finds that p s fragment name is the same as q s fragment name. On receiving the reject message, p continues its local search. If the fragment name differs q ss an accept message. The processing of a test, L, F message is deferred by q if L > level q because p and q may actually belong to the same fragment, but the initiate, L, F, S message has not yet reached q

14 A simple optimization To inspect edge pq, p ss a test, level p, name p message to q and waits for an answer A reject message is sent by process q if q finds that p s fragment name is the same as q s fragment name. If the edge pq was just used by q to s a test, L, F message then p will know (in a symmetrical way) that the edge pq is to be rejected. In this case, the reject message need not be sent by q.

15 GHS Algorithm: Part-2 (4) procedure test begin if q Neigh p : statch p [q] = basic then begin testch p := q with statch p [q] = basic and (pq) minimal ; s test, level p, name p to testch p else begin testch p := udef ; report

16 GHS Algorithm: Part-2 (5) Upon receipt of test, L, F from q: begin if L > level p then (* Answer must wait *) process the message later else if F = name p then (* internal edge *) begin if statch p [q] = basic then statch p [q] := reject ; if q testch p then s reject to q else test else s accept to q

17 GHS Algorithm: Part-2 (6) Upon receipt of accept from q: begin testch p := udef ; if (pq) < best p then begin bestwt p := (pq) ; bestch p := q ; report (7) Upon receipt of reject from q: begin if statch p [q] = basic then statch p [q] := reject ; test

18 Reporting the lowest-weight outgoing edge The lowest-weight outgoing edge is reported for each sub tree using report, messages Node p counts the number of report, messages it receives, using the variable rec p. The report, messages are sent in the direction of the core edge by each process. The messages of the two core nodes cross on the edge; both receive the message from their father When this happens, the algorithm terminates if no outgoing edge was reported. Otherwise a connect, L message must be sent through this edge.

19 Reorientation of the tree If an outgoing edge was reported, the lowest-weight outgoing edge is found by following the bestch pointer in each node, starting from the core node on whose side the best edge was reported A connect, L message must be sent through this edge, and all father pointers in the fragment must point in this direction This is done by sing a changeroot message. When the changeroot message arrives at the node incident to the lowest-weight outgoing edge, this node ss a connect, L message via the lowest-weight outgoing edge.

20 GHS Algorithm: Part-3 (8) procedure report: begin if rec p = #{ q : statch p [q] = branch q father p } and testch p = udef then begin state p := found ; s report, bestwt p to father p

21 GHS Algorithm: Part-3 (9) Upon receipt of report, from q: begin if q father p then (* reply for initiate message *) begin if < bestwt p then begin bestwt p := ; bestch p := q ; rec p := rec p + 1 ; report else (* pq is the core edge *) if state p = find then process this message later else if > bestwt p then changeroot else if = bestwt p = then stop

22 GHS Algorithm: Part-3 (10) procedure changeroot: begin if statch p [bestch p ] = branch then s changeroot to bestch p else begin s connect, level p to bestch p ; statch p [bestch p ] := branch (11) Upon receipt of changeroot : begin changeroot

23 Complexity The Gallager-Humblet-Spira algorithm computes the minimal spanning tree using at most 5N logn + 2 E messages Each edge is rejected at most once and this requires two messages (test and reject). This accounts for at most 2 E messages. At any level, a node receives at most one initiate and one accept message, and ss at most one report, one changeroot or connect message, and one test message not leading to a rejection. For logn levels, this accounts for a total of 5N logn messages.