(IVl -1) messages. In [3], both the time and com-

Similar documents
An Efficient Method for Constructing a Distributed Depth-First Search Tree

Trees. Arash Rafiey. 20 October, 2015

Designing Efficient Algorithms for Distributed Systems.

MAL 376: Graph Algorithms I Semester Lecture 1: July 24

1 Random Walks on Graphs

Theory of Computing. Lecture 4/5 MAS 714 Hartmut Klauck

Concurrent Reading and Writing of Clocks

Treewidth and graph minors

An algorithm for Performance Analysis of Single-Source Acyclic graphs

A distributed algorithm for constructing an Eulerian tour

Byzantine Consensus in Directed Graphs

2. CONNECTIVITY Connectivity

Distributed Computing over Communication Networks: Leader Election

The Postal Network: A Versatile Interconnection Topology

THE FIRST APPROXIMATED DISTRIBUTED ALGORITHM FOR THE MINIMUM DEGREE SPANNING TREE PROBLEM ON GENERAL GRAPHS. and

Notes 4 : Approximating Maximum Parsimony

CS 161 Lecture 11 BFS, Dijkstra s algorithm Jessica Su (some parts copied from CLRS) 1 Review

Lecture 3: Graphs and flows

Ramsey s Theorem on Graphs

CPS 102: Discrete Mathematics. Quiz 3 Date: Wednesday November 30, Instructor: Bruce Maggs NAME: Prob # Score. Total 60

Number Theory and Graph Theory

Fundamental Algorithms

Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret

Matchings in Graphs. Definition 1 Let G = (V, E) be a graph. M E is called as a matching of G if v V we have {e M : v is incident on e E} 1.

A DAG-BASED ALGORITHM FOR DISTRIBUTED MUTUAL EXCLUSION ATHESIS MASTER OF SCIENCE

Leveraging Transitive Relations for Crowdsourced Joins*

The Encoding Complexity of Network Coding

On the Balanced Case of the Brualdi-Shen Conjecture on 4-Cycle Decompositions of Eulerian Bipartite Tournaments

CS525 Winter 2012 \ Class Assignment #2 Preparation

Distributed minimum spanning tree problem

Graph Algorithms Using Depth First Search

COMP3121/3821/9101/ s1 Assignment 1

Graphs. Pseudograph: multiple edges and loops allowed

A synchronizer generates sequences of clock pulses at each node of the network satisfying the condition given by the following definition.

A Dag-Based Algorithm for Distributed Mutual Exclusion. Kansas State University. Manhattan, Kansas maintains [18]. algorithms [11].

Notes for Lecture 24

Figure 1: An example of a hypercube 1: Given that the source and destination addresses are n-bit vectors, consider the following simple choice of rout

Algorithm 23 works. Instead of a spanning tree, one can use routing.

An Efficient Decoding Technique for Huffman Codes Abstract 1. Introduction

Distributed Leader Election Algorithms in Synchronous Networks

implementing the breadth-first search algorithm implementing the depth-first search algorithm

Lecture 3. Brute Force

High Dimensional Indexing by Clustering

Algorithms: Lecture 10. Chalmers University of Technology

Module 6 NP-Complete Problems and Heuristics

Backtracking and Branch-and-Bound

Concurrent Reading and Writing of Clocks

arxiv: v3 [cs.ds] 18 Apr 2011

Graph Algorithms. Definition

Throughout this course, we use the terms vertex and node interchangeably.

Log-Space. A log-space Turing Machine is comprised of two tapes: the input tape of size n which is cannot be written on, and the work tape of size.

Definition: A graph G = (V, E) is called a tree if G is connected and acyclic. The following theorem captures many important facts about trees.

st-orientations September 29, 2005

Searching in Graphs (cut points)

Minimum sum multicoloring on the edges of trees

NP-completeness of generalized multi-skolem sequences

Coloring. Radhika Gupta. Problem 1. What is the chromatic number of the arc graph of a polygonal disc of N sides?

U.C. Berkeley CS170 : Algorithms Midterm 1 Lecturers: Alessandro Chiesa and Satish Rao September 18, Midterm 1

Varying Applications (examples)

Scalable Distributed Diagnosis Algorithm for Wireless Sensor Networks

v V Question: How many edges are there in a graph with 10 vertices each of degree 6?

Practical Session No. 12 Graphs, BFS, DFS, Topological sort

γ(ɛ) (a, b) (a, d) (d, a) (a, b) (c, d) (d, d) (e, e) (e, a) (e, e) (a) Draw a picture of G.

Lecture 2 : Counting X-trees

Module 6 P, NP, NP-Complete Problems and Approximation Algorithms

FINAL EXAM SOLUTIONS

CHAPTER 2. Graphs. 1. Introduction to Graphs and Graph Isomorphism

Computing intersections in a set of line segments: the Bentley-Ottmann algorithm

Rigidity, connectivity and graph decompositions

Implementation of Hopcroft's Algorithm

Compact Sets. James K. Peterson. September 15, Department of Biological Sciences and Department of Mathematical Sciences Clemson University

2386 IEEE TRANSACTIONS ON INFORMATION THEORY, VOL. 52, NO. 6, JUNE 2006

3 No-Wait Job Shops with Variable Processing Times

HW Graph Theory SOLUTIONS (hbovik)

1. [1 pt] What is the solution to the recurrence T(n) = 2T(n-1) + 1, T(1) = 1

Theorem 2.9: nearest addition algorithm

6. Lecture notes on matroid intersection

Analysis of Link Reversal Routing Algorithms for Mobile Ad Hoc Networks

Algorithmic Aspects of Communication Networks

FUTURE communication networks are expected to support

An Algorithm for Enumerating All Spanning Trees of a Directed Graph 1. S. Kapoor 2 and H. Ramesh 3

CS 6783 (Applied Algorithms) Lecture 5

Basics of Graph Theory

Consensus. Chapter Two Friends. 2.3 Impossibility of Consensus. 2.2 Consensus 16 CHAPTER 2. CONSENSUS

Matching Theory. Figure 1: Is this graph bipartite?

Paths, Circuits, and Connected Graphs

arxiv: v1 [math.co] 1 Nov 2017

Elements of Graph Theory

A distributed algorithm for minimum weight spanning trees

Section Summary. Introduction to Trees Rooted Trees Trees as Models Properties of Trees

Parallel algorithms for generating combinatorial objects on linear processor arrays with reconfigurable bus systems*

Treaps. 1 Binary Search Trees (BSTs) CSE341T/CSE549T 11/05/2014. Lecture 19

SAT-CNF Is N P-complete

Maximizing edge-ratio is NP-complete

REGULAR GRAPHS OF GIVEN GIRTH. Contents

Greedy Algorithms 1. For large values of d, brute force search is not feasible because there are 2 d

CSE 417: Algorithms and Computational Complexity. 3.1 Basic Definitions and Applications. Goals. Chapter 3. Winter 2012 Graphs and Graph Algorithms

Algorithm Design and Analysis

Multicasting in the Hypercube, Chord and Binomial Graphs

Instructions. Notation. notation: In particular, t(i, 2) = 2 2 2

Transcription:

AN OPTIMAL DISTRIBUTED DEPTH-FIRST-SEARCH ALGORITHM Mohan B. Sharma 38, Sitharama S. Iyengar 38 $ Department of Computer Science Louisiana 6tate University Baton Rouge, LA 70803. Narasimha K. Mandyam t t Indian Telephone Industries Ltd. Bangalore India. ABSTRACT This paper presents a new distributed depth-first-search algorithm with communication and time complexities of O(IVl). The algorithm is shown to use 21VI-2 messages and 21V1-2 units of time and is shown to be optimal in time and message. keywords: distributed system, distributed algorithm, com- munication graph 1.Introduction Many applications in distributed systems require traversal of messages through the underly- ing communication network. The problem of graph traversal has been studied extensively in a sequen- tial context. In this paper, we present algorithm for depth-first-traversal of a graph in a distributed con- text. The problem of distributed depth-first-search is defined as follows. Consider a communication Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or specfic permission. ACM 1989 0-89791-299-3/89/0002/0287 $1.50 network. The aim is to equip the set of processors in the network with a control algorithm which will allow a processor Pi in the network to effect a depth-first-traversal through the graph underlying the network, using messages. The output of the algorithm is a depth-first-search ( DFS ) tree of the communication network kept in a distributed fashion, i.e., at the end of the algorithm, each node will know its neighbors in the DFS tree [4]. Recent papers [1,5,3] by Awerbuch, Lakshmanan and Cidon present improved algorithms for distributed depth-first-search ( DDFS ) for graphs representing communication networks. Earlier work of Cheung[2] presents a DDFS algorithm with message and time complexities of 21El for both, where E is the set of undirected links in the graph. Awerbuch [1] improves the time complexity of Cheung's algorithm and presents an algorithm with time complexity less than 41VI, requiring 41El messages, where V is the set of nodes in the graph. Lakshmanan et.al., in [5] prove lower bounds for message and time complexities and present an algorithm that is time optimal requiring less than 41El - (IVl -1) messages. In [3], both the time and com- munication complexities are improved with the communication cost shown to be less than 31El messages and the time complexity being 21VI. 287

In this paper, we present a new algorithm for DDFS with time and communication complexities of O(IVl) for both. The algorithm is shown to use exactly 21VI-2 messages and terminate after 21VI-2 units of time. This reduction in message complexity is achieved by the effective use of extended mes- sage format in the algorithm and it is later shown that the total number of bits used for communica- tion is less than that used in the earlier algorithms. 2.The model The communication network is represented by the graph G(V,E) where V and E are respectively the sets of vertices and undirected edges. Vertices and edges of the graph denote the nodes and undirected communication links of the communica- tion network. We make the following assumptions for an asynchronous communication network. 1. No two processors in the network share memory. 2. Any message transmitted from a node i to node j is received by node j unaltered, in finite time. 3. Each node has the knowledge of its neighbors to which it is linked in the network and the node from where a message is received. 4. Each node has a distinct name and the names are taken from the integers 1,2,..,IVI. Nodes do not have the knowledge of total number of nodes in the network. We evaluate the performance of the algorithm with the following complexity measures as described in the earlier papers. The time complex- ity is the maximum time elapsed from ing to the termination of the algorithm, assuming that the time for delivering a message over a link is atmost one unit of time and time for receiving a message, local processing and sending it over a link being zero. The communication complexity is the total number of messages sent during the execution of the algorithm. Also, we compare the communication complexity of our algorithm with the previous algorithm [3] in terms of total number of bits used in communication. All through this paper, we use the terms communication complexity and message complexity interchangeably. 3. Proposed Solution In this section, we describe the extended message format and present the algorithm. 3.1 Message Format: There are two messages namely START and DISCOVER. The DISCOVER message has the header and an appendage of IVl bits atmost. The appendage in the message is a bit array such that the i th bit represents the state of the i th processor. State of a processor with respect to the appendage is either VISITED or UNVISITED. The START message contains the start header and is used as signal to initiate the algorithm. 3.2 Description of the proposed algorithm In the earlier algorithms of [1,3,5], the basic idea was to select a node as the son at every 'center of activity' and send the 'VISITED' message to the rest of the unvisited neighboring nodes, in parallel. In [1], each node waits for an ACK message to be received from all the neighbors, after sending VISITED message to them. The ACK message of algorithm in [1] is eliminated in [5] and the time complexity is reduced to 2IEI - 2. The algorithm in [3] eliminates the ACK message and the message complexity is reduced to < 31El messages with time 288

complexity of 2[V[. The high communicatiorl cost in all these algorithms is due to the use of VISITED message from a node to some of its neighbors. Our proposed solution eliminates the need for a separate VISITED message and this information is embedded in the message itself. The algorithm operates as follows. A node is given the START message from the external world, to start with. The START message signals the start of the algorithm and the node that receives the START message becomes the root node of DFS. The root node forms the DISCOVER message with a bit-array of size equal to the maximum of the root i.d.( name ) and the largest integer denoting its neighbor, i.e., if k is the largest i.d. of the nodes adjacent the root and r is the root i.d., then max( k, r ) bit-array is created. Every bit in the bit-array is initialized to UNVISITED state. The root node selects one of its neighboring nodes as its son, marks its ( root ) position in the bit-array of the message as VISITED and sends this message over the link to the selected son. It may be recalled that since each node i is identified as integer i, 1 < i < IVl, position of each node in the bit-array is unique. Clearly, the contents of the bit-array depict the prevalent state (VISITED/UNVISITED) of nodes in the network, at any instant of time. Upon receiving the DISCOVER message for the first time, each node i does the following. i. It marks its position ( i th bit ) in the bit-array of the received message as VISITED. ii. It marks the node from where the DISCOVER message was received, as its father in the DFS. iii. It extends the bit-array to k bits if k > size of the received bit-array, where k is the largest i.d. of its neighbors and initializes the added bits to UNVISITED state. iv. The node chooses an UNVISITED node as its son from its adjacency list, if one exists, and transmits the DISCOVER message with the updated bit-array to the selected son node. To choose an UNVISITED neighbor, next node in the adjacency list of node i is taken and the state of the chosen node is checked in the received bit-array; if found VISITED, the process is repeated with other nodes in its adjacency list. If all the neighboring nodes are already VISITED, i.e., node i is a leaf node in DFS, the received DISCOVER message with updated bit-array is returned to the father node. If the DISCOVER message is received from a son node, then only step iv. above is executed. The algorithm terminates when the root node receives the DISCOVER message with all nodes in its adjacency list exhausted in the search. If the total number of nodes in the network is known a priori, then the root node creates a bitarray of size IVI-bits and no other node in the network need extend the bit-array. 4.Complexity Analysis and Proof of Correctness. In the previous section, we presented the DDFS algorithm employing two messages with the abovesaid message format. In this section we prove that time and messsage complexities of the algorithm are both O(IVI). We also show that the algorithm is optimal in message complexity and further demonstrate that DDFS has message complexity lower bound of O(IVI). We also establish that the communication complexity of our algorithm is less than that reported in [3], in terms of total number of bits 289

3.3 Formal description of the algorithm We present formal description of the proposed algorithm, executed at each node i. The algorithm is described in a Pascal-like language and record structure for the DISCOVER message is used for clarity. Following are the message format and variables used at each node i. Message: Type message = record HEAD : integer; /* Identification of discover message type */ NLIST []: bit-array; /* The bit-array apenctage */ START: Message used to initiate the algorithm at any node chosen to be the root of DFS. DISCOVER: Message sent to/received from a son node. Variables: Adjacent i Father i Son i Maxadj i Source = Set of node adjacent to node i. = Father of node i in DFS. = Set of sons of node i in DFS. = Node in Adjacenti with largest i.d. = initialized to -1. Used to mark the root node. PROCEDURE INIT; Begin On receiving the START message from external world, Source = i; /* mark the root node */ Create bit-array of size max ( Maxadji, i); Initialize the bit-array to UNVISITED state; Form the message record MSG; MSG.HEAD = DISCOVER; 290

MSG.NLIST = the bit-array formed; MSG.NLIST [i] = VISITED;/* set the node state to visited */ SEARCH; /* Start dfs */ On receiving the message record MSG from node j, if MSG.HEAD = DISCOVER then, if j e Son i then /* return msg from son */ SEARCH; /* continue search with other neighboring nodes. */ else Father i = j;/* msg from father node */ MSG.NLIST [i] = VISITED ;/* mark the state */ if( size ofmsg.nlist[] ) < Maxadji then extend MSG.NLIST to the size Maxadji and initialize the added bits to UNVISITED state. SEARCH; /* start search for possible son */ end ; /* End of procedure INIT */ PROCEDURE SEARCH; Begin if for some k, MSG.NLIST[Adjacent i [k] ] = UNVISITED then Son i = Son i kj Adjacent i [k] ; send MSG to node Son i ; end else /* all neighboring nodes are in VISITED state */ 291

/f Source ~ i then Send MSG to Father i/* send return */ else /* algorithm terminates. */ STOP. /* end of procedure SEARCH */ used for communication, despite increasing the message size in our algorithm. Theorem 4.1. DDFS has the message complexity lower bound of O(IVI) for IVI > 1. Proof This bound is easily seen. It is clear that atleast ONE message must be sent from any node i to any node j in the network, i,j e {V}, since no memory is shared in the network. Hence atleast IVI-1 messages must be sent over the links so as to communicate to all the IVl nodes atleast once. Hence DDFS has an O(IVl) lower bound in message complexity. [] Theorem 4.2 The proposed algorithm is optimal in communication complexity and uses exactly 21VI - 2 messages. Proof Every node in the network except the root node receives only one DISCOVER message from its father ( forward path ) and sends one DISCOVER message to its father ( return path ). Also it is clear from the algorithm that DISCOVER message is not sent to an already VISITED node in the network. Thus, each of the IVI - 1 nodes ( excluding the root ) exchanges DISCOVER messages with its father exactly twice. Hence, the total number of messages used in the algorithm is exactly 21VI - 2. Clearly, the message complexity of the algorithm is O(IVl) and is optimal within a constant. [] Theorem 4.3 The algorithm terminates after 21VI-2 units of time, if all messages are delivered in one unit of time and is time optimal. Proof Total time needed for the algorithm to construct DDFS is the time required to transmit the messages over the links. From theorem 4.2, total time needed to transmit a total of 21VI-2 messages is 21VI-2 units of time if all messages are delivered in atmost one unit of time. It is shown in [5] that distributed algorithm for DFS has a worst case time complexity of 21VI - 2 and hence the proposed algorithm is optimal in time. [] We now compare our algorithm with the algo- rithm in [3] for bit-wise message complexity. For convenience, we call our algorithm as A1 and that in [3] as A2. Let n be the total number of nodes in the network and m be the number of bits transmitted for each message of A2. 292

Lemma 4.4 The total number of bits used for communication in the algorithm A1 is less than that for the algorithm A2, for n > 1 and m > 4 bits, for a fully connected network. Proof In algorithm A1, the number of bits transmitted for the DISCOVER message is atmost ( m+n ) bits due to the possible n-bit appendage to the message of A2. Total number of messages that are used in A2 is < 31El where IEI < n(n-1)/2. Hence, for a fully connected network, total number of bits used for communication is < 3n(n-1) * m/2. In A1, the total number of messages used is 2(n-l) and hence the total number of bits used for communication is atmost 2(n-l) (m+n). We derive the condition for m and n such that 2(n- 1) (n+m) <3n(n- 1 )m/2. i.e. 4(n+m)<3nm In table 1 we summarise the performance of algorithms of the algorithms for DDFS. However, it should be noted that the unbounded message sizes are used for comparison in the table. 5.Discussion We have presented a new DDFS algorithm that is optimal in message complexity. The algorithm is shown to use exactly 21VI - 2 messages with the time complexity of 21VI-2 units of time. We have shown that the extended message format reduces overall message complexity in terms of total number of bits used for communication. It may be noted from table 1 that although the message complexity of our algorithm is O(IVl), the number of bits per message in our algorithm is more than that in the other algorithms in the table. It is interesting to see that the proposed algorithm performs the same way for both synchronous and asynchronous networks since the 'center of activity' moves i.e. 4m/(3m-4)<n. sequentially in a deterministic manner. For m > 4, we get n > 1 for the inequality to be satisfied and hence the proof.d Table 1 Author Year Time Complexity Uommumcatlon tsomplexlty T.Cheung 1983 21El 21El B.Awerbuch 1985 < 4IV[ 41El K.B.Lakshmanan, N.Meenakshi 1987 21VI - 2 < 41El -( [VI - 1) and K.Thulasiraman I.Cidon 1988 -< 2IV[ < 31El S.B.Mohan, M.K.Narasimha 1988 21VI- 2 21Vl- 2 and S.S.Iyengar 293

References. [1]. B.Awerbuch, A new distributed depth-firstsearch algorithm, Inform. Process. Lett., 20, (3), 1985, pp. 147-150. [2]. T.Cheung, Graph traversal techniques and the maximum flow problem in distributed computation, IEEE Trans. Software Engineering.,Vol. SE-9,(4), 1983, pp. 504-512. [3]. I.Cidon, Yet another distributed depth-firstsearch algorithm, Inform. Process. Lett, 26,(6), Jan 1988, pp. 301-305. [4]. E.Horowitz and S.Sahni, Fundamentals of Computer Algorithms, Computer Science Press Inc, 1984. [5]. K.B.Lakshmanan, N.Meenakshi and K.Thulasiraman, A time optimal messageefficient distributed algorithm for depth-firstsearch, Inform. Process. Lett.,25, (2), May 1987, pp. 103-109. 294