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

Size: px
Start display at page:

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

Transcription

1 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 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 /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

2 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

3 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

4 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

5 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

6 /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

7 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 El 21El B.Awerbuch 1985 < 4IV[ 41El K.B.Lakshmanan, N.Meenakshi VI - 2 < 41El -( [VI - 1) and K.Thulasiraman I.Cidon < 2IV[ < 31El S.B.Mohan, M.K.Narasimha VI- 2 21Vl- 2 and S.S.Iyengar 293

8 References. [1]. B.Awerbuch, A new distributed depth-firstsearch algorithm, Inform. Process. Lett., 20, (3), 1985, pp [2]. T.Cheung, Graph traversal techniques and the maximum flow problem in distributed computation, IEEE Trans. Software Engineering.,Vol. SE-9,(4), 1983, pp [3]. I.Cidon, Yet another distributed depth-firstsearch algorithm, Inform. Process. Lett, 26,(6), Jan 1988, pp [4]. E.Horowitz and S.Sahni, Fundamentals of Computer Algorithms, Computer Science Press Inc, [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

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

An Efficient Method for Constructing a Distributed Depth-First Search Tree An Efficient Method for Constructing a Distributed Depth-First Search Tree S. A. M. Makki and George Havas School of Information Technology The University of Queensland Queensland 4072 Australia sam@it.uq.oz.au

More information

Trees. Arash Rafiey. 20 October, 2015

Trees. Arash Rafiey. 20 October, 2015 20 October, 2015 Definition Let G = (V, E) be a loop-free undirected graph. G is called a tree if G is connected and contains no cycle. Definition Let G = (V, E) be a loop-free undirected graph. G is called

More information

Designing Efficient Algorithms for Distributed Systems.

Designing Efficient Algorithms for Distributed Systems. Louisiana State University LSU Digital Commons LSU Historical Dissertations and Theses Graduate School 1990 Designing Efficient Algorithms for Distributed Systems. Mohan B. Sharma Louisiana State University

More information

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

MAL 376: Graph Algorithms I Semester Lecture 1: July 24 MAL 376: Graph Algorithms I Semester 2014-2015 Lecture 1: July 24 Course Coordinator: Prof. B. S. Panda Scribes: Raghuvansh, Himanshu, Mohit, Abhishek Disclaimer: These notes have not been subjected to

More information

1 Random Walks on Graphs

1 Random Walks on Graphs Lecture 7 Com S 633: Randomness in Computation Scribe: Ankit Agrawal In the last lecture, we looked at random walks on line and used them to devise randomized algorithms for 2-SAT and 3-SAT For 2-SAT we

More information

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

Theory of Computing. Lecture 4/5 MAS 714 Hartmut Klauck Theory of Computing Lecture 4/5 MAS 714 Hartmut Klauck How fast can we sort? There are deterministic algorithms that sort in worst case time O(n log n) Do better algorithms exist? Example [Andersson et

More information

Concurrent Reading and Writing of Clocks

Concurrent Reading and Writing of Clocks Concurrent Reading and Writing of Clocks LESLIE LAMPORT Digital Equipment Corporation As an exercise in synchronization without mutual exclusion, algorithms are developed to implement both a monotonic

More information

Treewidth and graph minors

Treewidth and graph minors Treewidth and graph minors Lectures 9 and 10, December 29, 2011, January 5, 2012 We shall touch upon the theory of Graph Minors by Robertson and Seymour. This theory gives a very general condition under

More information

An algorithm for Performance Analysis of Single-Source Acyclic graphs

An algorithm for Performance Analysis of Single-Source Acyclic graphs An algorithm for Performance Analysis of Single-Source Acyclic graphs Gabriele Mencagli September 26, 2011 In this document we face with the problem of exploiting the performance analysis of acyclic graphs

More information

A distributed algorithm for constructing an Eulerian tour

A distributed algorithm for constructing an Eulerian tour A distributed algorithm for constructing an Eulerian tour S. A. M. Makki School of Information Technology The University of Queensland Queensland 4072 A us t r ali a sam@cs.uq.edu.au Abstract We present

More information

Byzantine Consensus in Directed Graphs

Byzantine Consensus in Directed Graphs Byzantine Consensus in Directed Graphs Lewis Tseng 1,3, and Nitin Vaidya 2,3 1 Department of Computer Science, 2 Department of Electrical and Computer Engineering, and 3 Coordinated Science Laboratory

More information

2. CONNECTIVITY Connectivity

2. CONNECTIVITY Connectivity 2. CONNECTIVITY 70 2. Connectivity 2.1. Connectivity. Definition 2.1.1. (1) A path in a graph G = (V, E) is a sequence of vertices v 0, v 1, v 2,..., v n such that {v i 1, v i } is an edge of G for i =

More information

Distributed Computing over Communication Networks: Leader Election

Distributed Computing over Communication Networks: Leader Election Distributed Computing over Communication Networks: Leader Election Motivation Reasons for electing a leader? Reasons for not electing a leader? Motivation Reasons for electing a leader? Once elected, coordination

More information

The Postal Network: A Versatile Interconnection Topology

The Postal Network: A Versatile Interconnection Topology The Postal Network: A Versatile Interconnection Topology Jie Wu Yuanyuan Yang Dept. of Computer Sci. and Eng. Dept. of Computer Science Florida Atlantic University University of Vermont Boca Raton, FL

More information

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

THE FIRST APPROXIMATED DISTRIBUTED ALGORITHM FOR THE MINIMUM DEGREE SPANNING TREE PROBLEM ON GENERAL GRAPHS. and International Journal of Foundations of Computer Science c World Scientific Publishing Company THE FIRST APPROXIMATED DISTRIBUTED ALGORITHM FOR THE MINIMUM DEGREE SPANNING TREE PROBLEM ON GENERAL GRAPHS

More information

Notes 4 : Approximating Maximum Parsimony

Notes 4 : Approximating Maximum Parsimony Notes 4 : Approximating Maximum Parsimony MATH 833 - Fall 2012 Lecturer: Sebastien Roch References: [SS03, Chapters 2, 5], [DPV06, Chapters 5, 9] 1 Coping with NP-completeness Local search heuristics.

More information

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

CS 161 Lecture 11 BFS, Dijkstra s algorithm Jessica Su (some parts copied from CLRS) 1 Review 1 Review 1 Something I did not emphasize enough last time is that during the execution of depth-firstsearch, we construct depth-first-search trees. One graph may have multiple depth-firstsearch trees,

More information

Lecture 3: Graphs and flows

Lecture 3: Graphs and flows Chapter 3 Lecture 3: Graphs and flows Graphs: a useful combinatorial structure. Definitions: graph, directed and undirected graph, edge as ordered pair, path, cycle, connected graph, strongly connected

More information

Ramsey s Theorem on Graphs

Ramsey s Theorem on Graphs Ramsey s Theorem on Graphs 1 Introduction Exposition by William Gasarch Imagine that you have 6 people at a party. We assume that, for every pair of them, either THEY KNOW EACH OTHER or NEITHER OF THEM

More information

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

CPS 102: Discrete Mathematics. Quiz 3 Date: Wednesday November 30, Instructor: Bruce Maggs NAME: Prob # Score. Total 60 CPS 102: Discrete Mathematics Instructor: Bruce Maggs Quiz 3 Date: Wednesday November 30, 2011 NAME: Prob # Score Max Score 1 10 2 10 3 10 4 10 5 10 6 10 Total 60 1 Problem 1 [10 points] Find a minimum-cost

More information

Number Theory and Graph Theory

Number Theory and Graph Theory 1 Number Theory and Graph Theory Chapter 6 Basic concepts and definitions of graph theory By A. Satyanarayana Reddy Department of Mathematics Shiv Nadar University Uttar Pradesh, India E-mail: satya8118@gmail.com

More information

Fundamental Algorithms

Fundamental Algorithms Fundamental Algorithms Chapter 8: Graphs Jan Křetínský Winter 2017/18 Chapter 8: Graphs, Winter 2017/18 1 Graphs Definition (Graph) A graph G = (V, E) consists of a set V of vertices (nodes) and a set

More information

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

Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret Greedy Algorithms (continued) The best known application where the greedy algorithm is optimal is surely

More information

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.

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. Lecturer: Scribe: Meena Mahajan Rajesh Chitnis Matchings in Graphs Meeting: 1 6th Jan 010 Most of the material in this lecture is taken from the book Fast Parallel Algorithms for Graph Matching Problems

More information

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

A DAG-BASED ALGORITHM FOR DISTRIBUTED MUTUAL EXCLUSION ATHESIS MASTER OF SCIENCE A DAG-BASED ALGORITHM FOR DISTRIBUTED MUTUAL EXCLUSION by Mitchell L. Neilsen ATHESIS submitted in partial fulfillment of the requirements for the degree MASTER OF SCIENCE Department of Computing and Information

More information

Leveraging Transitive Relations for Crowdsourced Joins*

Leveraging Transitive Relations for Crowdsourced Joins* Leveraging Transitive Relations for Crowdsourced Joins* Jiannan Wang #, Guoliang Li #, Tim Kraska, Michael J. Franklin, Jianhua Feng # # Department of Computer Science, Tsinghua University, Brown University,

More information

The Encoding Complexity of Network Coding

The Encoding Complexity of Network Coding The Encoding Complexity of Network Coding Michael Langberg Alexander Sprintson Jehoshua Bruck California Institute of Technology Email: mikel,spalex,bruck @caltech.edu Abstract In the multicast network

More information

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

On the Balanced Case of the Brualdi-Shen Conjecture on 4-Cycle Decompositions of Eulerian Bipartite Tournaments Electronic Journal of Graph Theory and Applications 3 (2) (2015), 191 196 On the Balanced Case of the Brualdi-Shen Conjecture on 4-Cycle Decompositions of Eulerian Bipartite Tournaments Rafael Del Valle

More information

CS525 Winter 2012 \ Class Assignment #2 Preparation

CS525 Winter 2012 \ Class Assignment #2 Preparation 1 CS525 Winter 2012 \ Class Assignment #2 Preparation Ariel Stolerman 2.26) Let be a CFG in Chomsky Normal Form. Following is a proof that for any ( ) of length exactly steps are required for any derivation

More information

Distributed minimum spanning tree problem

Distributed minimum spanning tree problem Distributed minimum spanning tree problem Juho-Kustaa Kangas 24th November 2012 Abstract Given a connected weighted undirected graph, the minimum spanning tree problem asks for a spanning subtree with

More information

Graph Algorithms Using Depth First Search

Graph Algorithms Using Depth First Search Graph Algorithms Using Depth First Search Analysis of Algorithms Week 8, Lecture 1 Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Graph Algorithms Using Depth

More information

COMP3121/3821/9101/ s1 Assignment 1

COMP3121/3821/9101/ s1 Assignment 1 Sample solutions to assignment 1 1. (a) Describe an O(n log n) algorithm (in the sense of the worst case performance) that, given an array S of n integers and another integer x, determines whether or not

More information

Graphs. Pseudograph: multiple edges and loops allowed

Graphs. Pseudograph: multiple edges and loops allowed Graphs G = (V, E) V - set of vertices, E - set of edges Undirected graphs Simple graph: V - nonempty set of vertices, E - set of unordered pairs of distinct vertices (no multiple edges or loops) Multigraph:

More information

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

A synchronizer generates sequences of clock pulses at each node of the network satisfying the condition given by the following definition. Chapter 8 Synchronizers So far, we have mainly studied synchronous algorithms because generally, asynchronous algorithms are often more di cult to obtain and it is substantially harder to reason about

More information

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

A Dag-Based Algorithm for Distributed Mutual Exclusion. Kansas State University. Manhattan, Kansas maintains [18]. algorithms [11]. A Dag-Based Algorithm for Distributed Mutual Exclusion Mitchell L. Neilsen Masaaki Mizuno Department of Computing and Information Sciences Kansas State University Manhattan, Kansas 66506 Abstract The paper

More information

Notes for Lecture 24

Notes for Lecture 24 U.C. Berkeley CS170: Intro to CS Theory Handout N24 Professor Luca Trevisan December 4, 2001 Notes for Lecture 24 1 Some NP-complete Numerical Problems 1.1 Subset Sum The Subset Sum problem is defined

More information

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

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 Tail Inequalities Wafi AlBalawi and Ashraf Osman Department of Computer Science and Electrical Engineering, West Virginia University, Morgantown, WV fwafi,osman@csee.wvu.edug 1 Routing in a Parallel Computer

More information

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

Algorithm 23 works. Instead of a spanning tree, one can use routing. Chapter 5 Shared Objects 5.1 Introduction Assume that there is a common resource (e.g. a common variable or data structure), which different nodes in a network need to access from time to time. If the

More information

An Efficient Decoding Technique for Huffman Codes Abstract 1. Introduction

An Efficient Decoding Technique for Huffman Codes Abstract 1. Introduction An Efficient Decoding Technique for Huffman Codes Rezaul Alam Chowdhury and M. Kaykobad Department of Computer Science and Engineering Bangladesh University of Engineering and Technology Dhaka-1000, Bangladesh,

More information

Distributed Leader Election Algorithms in Synchronous Networks

Distributed Leader Election Algorithms in Synchronous Networks Distributed Leader Election Algorithms in Synchronous Networks Mitsou Valia National Technical University of Athens School of Applied Mathematics and Physics 1/66 Distributed Computing Distributed computing

More information

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

implementing the breadth-first search algorithm implementing the depth-first search algorithm Graph Traversals 1 Graph Traversals representing graphs adjacency matrices and adjacency lists 2 Implementing the Breadth-First and Depth-First Search Algorithms implementing the breadth-first search algorithm

More information

Lecture 3. Brute Force

Lecture 3. Brute Force Lecture 3 Brute Force 1 Lecture Contents 1. Selection Sort and Bubble Sort 2. Sequential Search and Brute-Force String Matching 3. Closest-Pair and Convex-Hull Problems by Brute Force 4. Exhaustive Search

More information

High Dimensional Indexing by Clustering

High Dimensional Indexing by Clustering Yufei Tao ITEE University of Queensland Recall that, our discussion so far has assumed that the dimensionality d is moderately high, such that it can be regarded as a constant. This means that d should

More information

Algorithms: Lecture 10. Chalmers University of Technology

Algorithms: Lecture 10. Chalmers University of Technology Algorithms: Lecture 10 Chalmers University of Technology Today s Topics Basic Definitions Path, Cycle, Tree, Connectivity, etc. Graph Traversal Depth First Search Breadth First Search Testing Bipartatiness

More information

Module 6 NP-Complete Problems and Heuristics

Module 6 NP-Complete Problems and Heuristics Module 6 NP-Complete Problems and Heuristics Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu P, NP-Problems Class

More information

Backtracking and Branch-and-Bound

Backtracking and Branch-and-Bound Backtracking and Branch-and-Bound Usually for problems with high complexity Exhaustive Search is too time consuming Cut down on some search using special methods Idea: Construct partial solutions and extend

More information

Concurrent Reading and Writing of Clocks

Concurrent Reading and Writing of Clocks [1]1 27 Concurrent Reading and Writing of Clocks Leslie Lamport April 1, 1988, revised November 20, 1990 Systems Research Center DEC s business and technology objectives require a strong research program.

More information

arxiv: v3 [cs.ds] 18 Apr 2011

arxiv: v3 [cs.ds] 18 Apr 2011 A tight bound on the worst-case number of comparisons for Floyd s heap construction algorithm Ioannis K. Paparrizos School of Computer and Communication Sciences Ècole Polytechnique Fèdèrale de Lausanne

More information

Graph Algorithms. Definition

Graph Algorithms. Definition Graph Algorithms Many problems in CS can be modeled as graph problems. Algorithms for solving graph problems are fundamental to the field of algorithm design. Definition A graph G = (V, E) consists of

More information

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

Throughout this course, we use the terms vertex and node interchangeably. Chapter Vertex Coloring. Introduction Vertex coloring is an infamous graph theory problem. It is also a useful toy example to see the style of this course already in the first lecture. Vertex coloring

More information

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.

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. CSE 431 Theory of Computation Scribes: Michelle Park and Julianne Brodhacker Lecture 18 May 29 Review of Log-Space Turing Machines: Log-Space A log-space Turing Machine is comprised of two tapes: the input

More information

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.

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. Tree 1. Trees and their Properties. Spanning trees 3. Minimum Spanning Trees 4. Applications of Minimum Spanning Trees 5. Minimum Spanning Tree Algorithms 1.1 Properties of Trees: Definition: A graph G

More information

st-orientations September 29, 2005

st-orientations September 29, 2005 st-orientations September 29, 2005 Introduction Let G = (V, E) be an undirected biconnected graph of n nodes and m edges. The main problem this chapter deals with is different algorithms for orienting

More information

Searching in Graphs (cut points)

Searching in Graphs (cut points) 0 November, 0 Breath First Search (BFS) in Graphs In BFS algorithm we visit the verices level by level. The BFS algorithm creates a tree with root s. Once a node v is discovered by BFS algorithm we put

More information

Minimum sum multicoloring on the edges of trees

Minimum sum multicoloring on the edges of trees Minimum sum multicoloring on the edges of trees Dániel Marx a,1 a Department of Computer Science and Information Theory, Budapest University of Technology and Economics, H-1521 Budapest, Hungary. Abstract

More information

NP-completeness of generalized multi-skolem sequences

NP-completeness of generalized multi-skolem sequences Discrete Applied Mathematics 155 (2007) 2061 2068 www.elsevier.com/locate/dam NP-completeness of generalized multi-skolem sequences Gustav Nordh 1 Department of Computer and Information Science, Linköpings

More information

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

Coloring. Radhika Gupta. Problem 1. What is the chromatic number of the arc graph of a polygonal disc of N sides? Coloring Radhika Gupta 1 Coloring of A N Let A N be the arc graph of a polygonal disc with N sides, N > 4 Problem 1 What is the chromatic number of the arc graph of a polygonal disc of N sides? Or we would

More information

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

U.C. Berkeley CS170 : Algorithms Midterm 1 Lecturers: Alessandro Chiesa and Satish Rao September 18, Midterm 1 U.C. Berkeley CS170 : Algorithms Lecturers: Alessandro Chiesa and Satish Rao September 18, 2018 1 Connectivity in Graphs No justification is required on this problem. A B C D E F G H I J (a) (2 points)

More information

Varying Applications (examples)

Varying Applications (examples) Graph Theory Varying Applications (examples) Computer networks Distinguish between two chemical compounds with the same molecular formula but different structures Solve shortest path problems between cities

More information

Scalable Distributed Diagnosis Algorithm for Wireless Sensor Networks

Scalable Distributed Diagnosis Algorithm for Wireless Sensor Networks Scalable Distributed Diagnosis Algorithm for Wireless Sensor Networks Arunanshu Mahapatro and Pabitra Mohan Khilar Department of CSE, National Institute of Technology, Rourkela, India arun227@gmail.com,

More information

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

v V Question: How many edges are there in a graph with 10 vertices each of degree 6? ECS20 Handout Graphs and Trees March 4, 2015 (updated 3/9) Notion of a graph 1. A graph G = (V,E) consists of V, a nonempty set of vertices (or nodes) and E, a set of pairs of elements of V called edges.

More information

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

Practical Session No. 12 Graphs, BFS, DFS, Topological sort Practical Session No. 12 Graphs, BFS, DFS, Topological sort Graphs and BFS Graph G = (V, E) Graph Representations (V G ) v1 v n V(G) = V - Set of all vertices in G E(G) = E - Set of all edges (u,v) in

More information

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

γ(ɛ) (a, b) (a, d) (d, a) (a, b) (c, d) (d, d) (e, e) (e, a) (e, e) (a) Draw a picture of G. MAD 3105 Spring 2006 Solutions for Review for Test 2 1. Define a graph G with V (G) = {a, b, c, d, e}, E(G) = {r, s, t, u, v, w, x, y, z} and γ, the function defining the edges, is given by the table ɛ

More information

Lecture 2 : Counting X-trees

Lecture 2 : Counting X-trees Lecture 2 : Counting X-trees MATH285K - Spring 2010 Lecturer: Sebastien Roch References: [SS03, Chapter 1,2] 1 Trees We begin by recalling basic definitions and properties regarding finite trees. DEF 2.1

More information

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

Module 6 P, NP, NP-Complete Problems and Approximation Algorithms Module 6 P, NP, NP-Complete Problems and Approximation Algorithms Dr. Natarajan Meghanathan Associate Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu

More information

FINAL EXAM SOLUTIONS

FINAL EXAM SOLUTIONS COMP/MATH 3804 Design and Analysis of Algorithms I Fall 2015 FINAL EXAM SOLUTIONS Question 1 (12%). Modify Euclid s algorithm as follows. function Newclid(a,b) if a

More information

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

CHAPTER 2. Graphs. 1. Introduction to Graphs and Graph Isomorphism CHAPTER 2 Graphs 1. Introduction to Graphs and Graph Isomorphism 1.1. The Graph Menagerie. Definition 1.1.1. A simple graph G = (V, E) consists of a set V of vertices and a set E of edges, represented

More information

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

Computing intersections in a set of line segments: the Bentley-Ottmann algorithm Computing intersections in a set of line segments: the Bentley-Ottmann algorithm Michiel Smid October 14, 2003 1 Introduction In these notes, we introduce a powerful technique for solving geometric problems.

More information

Rigidity, connectivity and graph decompositions

Rigidity, connectivity and graph decompositions First Prev Next Last Rigidity, connectivity and graph decompositions Brigitte Servatius Herman Servatius Worcester Polytechnic Institute Page 1 of 100 First Prev Next Last Page 2 of 100 We say that a framework

More information

Implementation of Hopcroft's Algorithm

Implementation of Hopcroft's Algorithm Implementation of Hopcroft's Algorithm Hang Zhou 19 December 2009 Abstract Minimization of a deterministic nite automaton(dfa) is a well-studied problem of formal language. An ecient algorithm for this

More information

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

Compact Sets. James K. Peterson. September 15, Department of Biological Sciences and Department of Mathematical Sciences Clemson University Compact Sets James K. Peterson Department of Biological Sciences and Department of Mathematical Sciences Clemson University September 15, 2017 Outline 1 Closed Sets 2 Compactness 3 Homework Closed Sets

More information

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

2386 IEEE TRANSACTIONS ON INFORMATION THEORY, VOL. 52, NO. 6, JUNE 2006 2386 IEEE TRANSACTIONS ON INFORMATION THEORY, VOL. 52, NO. 6, JUNE 2006 The Encoding Complexity of Network Coding Michael Langberg, Member, IEEE, Alexander Sprintson, Member, IEEE, and Jehoshua Bruck,

More information

3 No-Wait Job Shops with Variable Processing Times

3 No-Wait Job Shops with Variable Processing Times 3 No-Wait Job Shops with Variable Processing Times In this chapter we assume that, on top of the classical no-wait job shop setting, we are given a set of processing times for each operation. We may select

More information

HW Graph Theory SOLUTIONS (hbovik)

HW Graph Theory SOLUTIONS (hbovik) Diestel 1.3: Let G be a graph containing a cycle C, and assume that G contains a path P of length at least k between two vertices of C. Show that G contains a cycle of length at least k. If C has length

More information

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

1. [1 pt] What is the solution to the recurrence T(n) = 2T(n-1) + 1, T(1) = 1 Asymptotics, Recurrence and Basic Algorithms 1. [1 pt] What is the solution to the recurrence T(n) = 2T(n-1) + 1, T(1) = 1 1. O(logn) 2. O(n) 3. O(nlogn) 4. O(n 2 ) 5. O(2 n ) 2. [1 pt] What is the solution

More information

Theorem 2.9: nearest addition algorithm

Theorem 2.9: nearest addition algorithm There are severe limits on our ability to compute near-optimal tours It is NP-complete to decide whether a given undirected =(,)has a Hamiltonian cycle An approximation algorithm for the TSP can be used

More information

6. Lecture notes on matroid intersection

6. Lecture notes on matroid intersection Massachusetts Institute of Technology 18.453: Combinatorial Optimization Michel X. Goemans May 2, 2017 6. Lecture notes on matroid intersection One nice feature about matroids is that a simple greedy algorithm

More information

Analysis of Link Reversal Routing Algorithms for Mobile Ad Hoc Networks

Analysis of Link Reversal Routing Algorithms for Mobile Ad Hoc Networks Analysis of Link Reversal Routing Algorithms for Mobile Ad Hoc Networks Seminar of Distributed Computing WS 04/05 ETH Zurich, 1.2.2005 Nicolas Born nborn@student.ethz.ch Paper Analysis of Link Reversal

More information

Algorithmic Aspects of Communication Networks

Algorithmic Aspects of Communication Networks Algorithmic Aspects of Communication Networks Chapter 5 Network Resilience Algorithmic Aspects of ComNets (WS 16/17): 05 Network Resilience 1 Introduction and Motivation Network resilience denotes the

More information

FUTURE communication networks are expected to support

FUTURE communication networks are expected to support 1146 IEEE/ACM TRANSACTIONS ON NETWORKING, VOL 13, NO 5, OCTOBER 2005 A Scalable Approach to the Partition of QoS Requirements in Unicast and Multicast Ariel Orda, Senior Member, IEEE, and Alexander Sprintson,

More information

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

An Algorithm for Enumerating All Spanning Trees of a Directed Graph 1. S. Kapoor 2 and H. Ramesh 3 Algorithmica (2000) 27: 120 130 DOI: 10.1007/s004530010008 Algorithmica 2000 Springer-Verlag New York Inc. An Algorithm for Enumerating All Spanning Trees of a Directed Graph 1 S. Kapoor 2 and H. Ramesh

More information

CS 6783 (Applied Algorithms) Lecture 5

CS 6783 (Applied Algorithms) Lecture 5 CS 6783 (Applied Algorithms) Lecture 5 Antonina Kolokolova January 19, 2012 1 Minimum Spanning Trees An undirected graph G is a pair (V, E); V is a set (of vertices or nodes); E is a set of (undirected)

More information

Basics of Graph Theory

Basics of Graph Theory Basics of Graph Theory 1 Basic notions A simple graph G = (V, E) consists of V, a nonempty set of vertices, and E, a set of unordered pairs of distinct elements of V called edges. Simple graphs have their

More information

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

Consensus. Chapter Two Friends. 2.3 Impossibility of Consensus. 2.2 Consensus 16 CHAPTER 2. CONSENSUS 16 CHAPTER 2. CONSENSUS Agreement All correct nodes decide for the same value. Termination All correct nodes terminate in finite time. Validity The decision value must be the input value of a node. Chapter

More information

Matching Theory. Figure 1: Is this graph bipartite?

Matching Theory. Figure 1: Is this graph bipartite? Matching Theory 1 Introduction A matching M of a graph is a subset of E such that no two edges in M share a vertex; edges which have this property are called independent edges. A matching M is said to

More information

Paths, Circuits, and Connected Graphs

Paths, Circuits, and Connected Graphs Paths, Circuits, and Connected Graphs Paths and Circuits Definition: Let G = (V, E) be an undirected graph, vertices u, v V A path of length n from u to v is a sequence of edges e i = {u i 1, u i} E for

More information

arxiv: v1 [math.co] 1 Nov 2017

arxiv: v1 [math.co] 1 Nov 2017 The multiset dimension of graphs Rinovia Simanjuntak a, Tomáš Vetrík b, Presli Bintang Mulia a arxiv:1711.00225v1 [math.co] 1 Nov 2017 Abstract a Combinatorial Mathematics Research Group Institut Teknologi

More information

Elements of Graph Theory

Elements of Graph Theory Elements of Graph Theory Quick review of Chapters 9.1 9.5, 9.7 (studied in Mt1348/2008) = all basic concepts must be known New topics we will mostly skip shortest paths (Chapter 9.6), as that was covered

More information

A distributed algorithm for minimum weight spanning trees

A distributed algorithm for minimum weight spanning trees A distributed algorithm for minimum weight spanning trees R. G. Gallager, P. A. Humblet and P. M. Spira Prepared by: Guy Flysher and Amir Rubinshtein Preface In this document we will review Gallager,

More information

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

Section Summary. Introduction to Trees Rooted Trees Trees as Models Properties of Trees Chapter 11 Copyright McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education. Chapter Summary Introduction to Trees Applications

More information

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

Parallel algorithms for generating combinatorial objects on linear processor arrays with reconfigurable bus systems* SOdhan& Vol. 22. Part 5, October 1997, pp. 62%636. Printed ill India. Parallel algorithms for generating combinatorial objects on linear processor arrays with reconfigurable bus systems* P THANGAVEL Department

More information

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

Treaps. 1 Binary Search Trees (BSTs) CSE341T/CSE549T 11/05/2014. Lecture 19 CSE34T/CSE549T /05/04 Lecture 9 Treaps Binary Search Trees (BSTs) Search trees are tree-based data structures that can be used to store and search for items that satisfy a total order. There are many types

More information

SAT-CNF Is N P-complete

SAT-CNF Is N P-complete SAT-CNF Is N P-complete Rod Howell Kansas State University November 9, 2000 The purpose of this paper is to give a detailed presentation of an N P- completeness proof using the definition of N P given

More information

Maximizing edge-ratio is NP-complete

Maximizing edge-ratio is NP-complete Maximizing edge-ratio is NP-complete Steven D Noble, Pierre Hansen and Nenad Mladenović February 7, 01 Abstract Given a graph G and a bipartition of its vertices, the edge-ratio is the minimum for both

More information

REGULAR GRAPHS OF GIVEN GIRTH. Contents

REGULAR GRAPHS OF GIVEN GIRTH. Contents REGULAR GRAPHS OF GIVEN GIRTH BROOKE ULLERY Contents 1. Introduction This paper gives an introduction to the area of graph theory dealing with properties of regular graphs of given girth. A large portion

More information

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

Greedy Algorithms 1. For large values of d, brute force search is not feasible because there are 2 d Greedy Algorithms 1 Simple Knapsack Problem Greedy Algorithms form an important class of algorithmic techniques. We illustrate the idea by applying it to a simplified version of the Knapsack Problem. Informally,

More information

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

CSE 417: Algorithms and Computational Complexity. 3.1 Basic Definitions and Applications. Goals. Chapter 3. Winter 2012 Graphs and Graph Algorithms Chapter 3 CSE 417: Algorithms and Computational Complexity Graphs Reading: 3.1-3.6 Winter 2012 Graphs and Graph Algorithms Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 4 Graphs Definitions Traversals Adam Smith 9/8/10 Exercise How can you simulate an array with two unbounded stacks and a small amount of memory? (Hint: think of a

More information

Multicasting in the Hypercube, Chord and Binomial Graphs

Multicasting in the Hypercube, Chord and Binomial Graphs Multicasting in the Hypercube, Chord and Binomial Graphs Christopher C. Cipriano and Teofilo F. Gonzalez Department of Computer Science University of California, Santa Barbara, CA, 93106 E-mail: {ccc,teo}@cs.ucsb.edu

More information

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

Instructions. Notation. notation: In particular, t(i, 2) = 2 2 2 Instructions Deterministic Distributed Algorithms, 10 21 May 2010, Exercises http://www.cs.helsinki.fi/jukka.suomela/dda-2010/ Jukka Suomela, last updated on May 20, 2010 exercises are merely suggestions

More information