271 8 4MB
English Pages 362 [365] Year 2006
Lecture Notes in Computer Science Commenced Publication in 1973 Founding and Former Series Editors: Gerhard Goos, Juris Hartmanis, and Jan van Leeuwen
Editorial Board David Hutchison Lancaster University, UK Takeo Kanade Carnegie Mellon University, Pittsburgh, PA, USA Josef Kittler University of Surrey, Guildford, UK Jon M. Kleinberg Cornell University, Ithaca, NY, USA Friedemann Mattern ETH Zurich, Switzerland John C. Mitchell Stanford University, CA, USA Moni Naor Weizmann Institute of Science, Rehovot, Israel Oscar Nierstrasz University of Bern, Switzerland C. Pandu Rangan Indian Institute of Technology, Madras, India Bernhard Steffen University of Dortmund, Germany Madhu Sudan Massachusetts Institute of Technology, MA, USA Demetri Terzopoulos University of California, Los Angeles, CA, USA Doug Tygar University of California, Berkeley, CA, USA Moshe Y. Vardi Rice University, Houston, TX, USA Gerhard Weikum Max-Planck Institute of Computer Science, Saarbruecken, Germany
4056
Paola Flocchini Leszek Ga˛sieniec (Eds.)
Structural Information and Communication Complexity 13th International Colloquium, SIROCCO 2006 Chester, UK, July 2-5, 2006 Proceedings
13
Volume Editors Paola Flocchini University of Ottawa School of Information Technology and Engineering (SITE) Ottawa, ON, K1N 6N5, Canada E-mail: [email protected] Leszek Ga˛sieniec The University of Liverpool Department of Computer Science Liverpool, L69 7ZF, UK E-mail: [email protected]
Library of Congress Control Number: 2006927796 CR Subject Classification (1998): F.2, C.2, G.2, E.1 LNCS Sublibrary: SL 1 – Theoretical Computer Science and General Issues ISSN ISBN-10 ISBN-13
0302-9743 3-540-35474-3 Springer Berlin Heidelberg New York 978-3-540-35474-1 Springer Berlin Heidelberg New York
This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, re-use of illustrations, recitation, broadcasting, reproduction on microfilms or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer. Violations are liable to prosecution under the German Copyright Law. Springer is a part of Springer Science+Business Media springer.com © Springer-Verlag Berlin Heidelberg 2006 Printed in Germany Typesetting: Camera-ready by author, data conversion by Scientific Publishing Services, Chennai, India Printed on acid-free paper SPIN: 11780823 06/3142 543210
Preface
The Colloquium on Structural Information and Communication Complexity (SIROCCO) is an annual meeting focused on the relationship between algorithmic aspects of computing and communication. Over its 13 years of existence, SIROCCO has become an acknowledged forum bringing together specialists interested in the fundamental principles underlying the interplay between information, communication and computing. SIROCCO covers topics such as distributed computing, high-speed networks, interconnection networks, mobile computing, optical computing, parallel computing, sensor networks, wireless networks, autonomous robots, and related areas. SIROCCO 2006 was the 13th in this series, held in Chester, UK, July 3–5, 2006. Previous SIROCCO colloquia took place in Ottawa (1994), Olympia (1995), Siena (1996), Ascona (1997), Amalfi (1998), Lacanau-Océan (1999), L’Aquila (2000), Val de Nuria (2001), Andros (2002), Umeå (2003), Smolenice Castle (2004), and Mont Saint-Michel (2005). In the tradition of previous occasions, this year’s SIROCCO was a lively event, encouraging the emergence of new research areas (related to distributed computing in a broad sense) and the dissemination of original ideas. This was achieved by dedicating ample time for informal discussions and open problem sessions in addition to regular conference activities. The 68 contributions submitted to SIROCCO 2006 were subject to a thorough refereeing process and 24 high-quality submissions were selected for publication. We would like to thank the authors of all the submitted papers. The excellent quality of the final program is also due to the dedicated and careful work of the Program Committee members. Our gratitude extends to the numerous subreferees for their valuable help. We also thank the invited speakers: Hagit Attiya (Technion), Danny Krizanc (Wesleyan), and Roger Wattenhofer (ETH) for accepting our invitation to share their insights on new developments in their areas of interest, and for providing such entertaining talks. We would like to express our sincere gratitude to the conference Chair David Peleg (Weizmann) for his enthusiasm and invaluable consultations, as well as the local organizing team, in particular Christoph Ambühl, Catherine Atherton, Alexey Fishkin, Dave Shield and Prudence Wong. Finally we would like to thank EPSRC and the University of Liverpool for their support. These proceedings include all the accepted papers revised according to the feedback provided by the Program Committee, as well as the paper versions of the three invited talks. We hope you will enjoy them as much as we did at the conference. July 2006
Paola Flocchini and Leszek Gąsieniec Program Committee Co-chairs
Organization
Program Committee Paolo Boldi, Milan Shlomi Dolev, Ben-Gurion Thomas Erlebach, Leicester Paola Flocchini, Ottawa (Co-chair) Fedor Fomin, Bergen Pierre Fraigniaud, Paris Sud Leszek Gąsieniec, Liverpool (Co-chair) Christos Kaklamanis, Patras Idit Keidar, Technion Ralf Klasing, Bordeaux Evangelos Kranakis, Carleton
Andrzej Lingas, Lund Flaminia Luccio, Trieste Andrzej Pelc, Québec Giuseppe Prencipe, Pisa Kirk Pruhs, Pittsburgh Tomasz Radzik, Kings College Violet R. Syrotiuk, Arizona State Roger Wattenhofer, ETH Masafumi Yamashita, Kyushu Shmuel Zaks, Technion
Organizing Committee Christoph Ambühl, Liverpool Catherine Atherton, Liverpool Alexei Fishkin, Liverpool
Leszek Gąsieniec, Liverpool (Chair) Dave Shield, Liverpool Prudence Wong, Liverpool
Steering Committee Paola Flocchini, Ottawa Leszek Gąsieniec, Liverpool Christos Kaklamanis, Patras Lefteris Kirousis, Patras Rastislav Královič, Bratislava Evangelos Kranakis, Carleton Danny Krizanc, Wesleyan
Bernard Mans, Macquarie Andrzej Pelc, Québec David Peleg, Weizmann (Chair) Michel Raynal, Rennes Nicola Santoro, Ottawa Paul Spirakis, Patras
Referees Luca Allulli Christoph Ambühl Gal Badishi René Beier
Amos Beimel Sivan Bercovici Edward Bortnikov Olga Brukman
VIII
Organization
Nicolas Burri Ioannis Caragiannis Carlos Castillo Stefano Chessa David Coudert Shantanu Das Stefan Dobrev Michael Elkin Leah Epstein Alexey Fishkin Hen Fitoussi Michele Flammini Roland Flury Vincenzo Gervasi Olga Goussevskaia Yinnon Haviv Jesper Jansson Panagiotis Kanellopoulos Ronen Kat Dariusz Kowalski Rastislav Kralovic Danny Krizanc Michael Kuhn Łukasz Kuszner Christos Levcopoulos Thomas Locher Violetta Lonati Zvi Lotker Fabrizio Luccio
Euripides Markou Morten Mjelde Manuela Montangero Luca Moscardelli Thomas Moscibroda Alfredo Navarra Linda Pagli Evi Papaioannou Paolo Penna Mia Persson Alessandro Provetti Geppino Pucci Pascal von Rickenbach Fabiano Sarracco Stefan Schmid Hadas Shachnai Alexander Shraer Francesco Silvestri Savio Tse Nir Tzachar Chi-Hung Tzeng Ugo Vaccaro Sebastiano Vigna Martin Wahlen Mirjam Wattenhofer Yves Weber Prudence Wong Qin Xin
Sponsoring Institutions The Engineering and Physical Sciences Research Council (EPSRC)
Table of Contents Mobile Agent Rendezvous: A Survey Evangelos Kranakis, Danny Krizanc, Sergio Rajsbaum . . . . . . . . . . . . . .
1
Adapting to Point Contention with Long-Lived Safe Agreement Hagit Attiya . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10
Sensor Networks: Distributed Algorithms Reloaded – or Revolutions? Roger Wattenhofer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
Local Algorithms for Autonomous Robot Systems Reuven Cohen, David Peleg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
How to Meet in Anonymous Network Dariusz R. Kowalski, Adam Malinowski . . . . . . . . . . . . . . . . . . . . . . . . . .
44
Setting Port Numbers for Fast Graph Exploration David Ilcinkas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
Distributed Chasing of Network Intruders L´elia Blin, Pierre Fraigniaud, Nicolas Nisse, Sandrine Vial . . . . . . . . .
70
Election in the Qualitative World J´er´emie Chalopin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
85
Fast Deterministic Distributed Algorithms for Sparse Spanners Bilel Derbel, Cyril Gavoille . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 Efficient Distributed Weighted Matchings on Trees Jaap-Henk Hoepman, Shay Kutten, Zvi Lotker . . . . . . . . . . . . . . . . . . . . . 115 Approximation Strategies for Routing Edge Disjoint Paths in Complete Graphs Adrian Kosowski . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 Short Labels by Traversal and Jumping Nicolas Bonichon, Cyril Gavoille, Arnaud Labourel . . . . . . . . . . . . . . . . . 143 An Optimal Rebuilding Strategy for a Decremental Tree Problem Nicolas Thibault, Christian Laforest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Optimal Delay for Media-on-Demand with Pre-loading and Pre-buffering Amotz Bar-Noy, Richard E. Ladner, Tami Tamir . . . . . . . . . . . . . . . . . . 171
X
Table of Contents
Strongly Terminating Early-Stopping k-Set Agreement in Synchronous Systems with General Omission Failures Philippe Ra¨ıpin Parv´edy, Michel Raynal, Corentin Travers . . . . . . . . . . 182 On Fractional Dynamic Faults with Threshold Stefan Dobrev, Rastislav Kr´ aloviˇc, Richard Kr´ aloviˇc, Nicola Santoro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 Discovering Network Topology in the Presence of Byzantine Faults Mikhail Nesterenko, S´ebastien Tixeuil . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Minimum Energy Broadcast and Disk Cover in Grid Wireless Networks Tiziana Calamoneri, Andrea E.F. Clementi, Miriam Di Ianni, Massimo Lauria, Angelo Monti, Riccardo Silvestri . . . . . . . . . . . . . . . . . 227 3-D Minimum Energy Broadcasting Alfredo Navarra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 Average-Time Complexity of Gossiping in Radio Networks Bogdan S. Chlebus, Dariusz R. Kowalski, Mariusz A. Rokicki . . . . . . . . 253 L(h,1,1)-Labeling of Outerplanar Graphs Tiziana Calamoneri, Emanuele G. Fusco, Richard B. Tan, Paola Vocca . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 Combinatorial Algorithms for Compressed Sensing Graham Cormode, S. Muthukrishnan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 On the Existence of Truthful Mechanisms for the Minimum-Cost Approximate Shortest-Paths Tree Problem Davide Bil` o, Luciano Gual` a, Guido Proietti . . . . . . . . . . . . . . . . . . . . . . . 295 Dynamic Asymmetric Communication Travis Gagie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 Approximate Top-k Queries in Sensor Networks Boaz Patt-Shamir, Allon Shafrir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 Self-stabilizing Space Optimal Synchronization Algorithms on Trees Doina Bein, Ajoy K. Datta, Lawrence L. Larmore . . . . . . . . . . . . . . . . . 334 Distance-k Information in Self-stabilizing Algorithms Wayne Goddard, Stephen T. Hedetniemi, David P. Jacobs, Vilmar Trevisan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 Author Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Mobile Agent Rendezvous: A Survey Evangelos Kranakis1, Danny Krizanc2 , and Sergio Rajsbaum3 1
School of Computer Science, Carleton University, Ottawa, ON, Canada Department of Mathematics and Computer Science, Wesleyan University, Middletown, Connecticut 06459, USA Instituto de Matem´ aticas, Universidad Nacional Aut´ onoma de M´exico (UNAM), Ciudad Universitaria, D. F. 04510, Mexico 2
3
Abstract. Recent results on the problem of mobile agent rendezvous on distributed networks are surveyed with an emphasis on outlining the various approaches taken by researchers in the theoretical computer science community.
1
Introduction
Consider the following problem originally proposed by Alpern [1] (as quoted in [3]): Two astronauts land on a spherical body that is much larger than the detection radius (within which they can see each other). The body does not have fixed orientation in space, nor does it have an axis of rotation, so that no common notion of position or direction is available to the astronauts for coordination. Given unit walking speeds for both astronauts, how should they move about so as to minimize the expected meeting time T (before they come within the detection radius)? This is just one version of a problem that has been studied under many guises under most of which it is referred to as rendezvous. In all settings, a set of agents are placed in a domain and are required to all meet at the same place and time within the domain, i.e., rendezvous. The settings differ mainly in the types and properties of the agents and the types and properties of domains. Besides the astronaut example above, rendezvous has been studied in settings as various as ships at sea, mother and child at a mall and autonomous robots on a hilly terrain. Recently the theoretical computer science community has taken up the challenge of the problem of rendezvous for autonomous software agents moving through a distributed network. Requiring such agents to meet in order to synchronize, share information, divide up duties, etc. would seem to be a natural fundamental operation useful as a subroutine in more complicated applications such as web-crawling, peer-to-peer lookup, meeting scheduling, etc. In this paper, we provide a short (perhaps biased) survey of recent work done on this version of the problem. The research done in other settings is extensive and many of P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 1–9, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
2
E. Kranakis, D. Krizanc, and S. Rajsbaum
the solutions can be applied here. But it is often the case that the models used and the concerns studied are sufficiently different as to require new approaches. Having said that, one ignores the earlier work at one’s peril. For an excellent discussion of mainly continuous domains with randomized agents see the book by Alpern and Gal [3]. For work on robot rendezvous consider [26] and [28] as possible starting points.
2
The Model
The definition of rendezvous must begin with establishing the properties of the agents that will rendezvous and the domain in which rendezvous will occur. The model below captures the essence of what has been termed the theory of mobile agent computing. 2.1
Mobile Agents
We are interested in modeling a set of software entities that act more or less autonomously from their originator and have the ability to move from node to node in a distributed network maintaining some sort of state with the nodes of the network providing some amount of (possibly longterm) storage and computational support. Either explicitly or implicitly such a mobile (software) agent has most often been modeled using a finite automaton consisting of a set of states and a transition function. The transition function takes as input the agent’s current state as well as possibly the state of the node it resides in and outputs a new agent state, possible modifications to the current node’s state and a possible move to another node. In some instances we consider probabilistic automata which have available a source of randomness that is used as part of their input. Such agents are referred to as randomized agents. An important property to consider is whether or not the agents are distinguishable, i.e., if they have distinct labels or identities. Agents without identities are referred to as anonymous agents. Anonymous agents are limited to running precisely the same program, i.e., they are identical finite automata. As the identity is assumed to be part of the starting state of the automaton, agents with identities have the potential to run different programs. The knowledge the agent has about the network it is on and about the other agents can make a difference in the solvability and efficiency of rendezvous. For example, knowledge of the size of the network or its topology or the number of and identities of the other agents may be used as part of the program for rendezvous. If available to the agents, this information is assumed to be part of its starting state. (One could imagine situations where the information is made available by the nodes of the network and not necessarily encoded in the agent.) Other properties that may be considered in mobile agent computing include whether or not the agents have the ability to “clone” themselves, whether or not they have the ability to “merge” upon meeting (sometimes referred to as “sticky” agents) or whether or not they can send self-generated messages. At this point, most of the research on rendezvous ignores these properties and they will not be discussed below.
Mobile Agent Rendezvous: A Survey
2.2
3
Distributed Networks
The model of a distributed network is essentially inherited directly from the theory of distributed computing. We model the network by a graph whose vertices comprise the computing nodes and edges correspond to communication links. The nodes of the network may or may not have distinct identities. In an anonymous network the nodes have no identities. In particular this means that an agent can not distinguish two nodes except perhaps by their degree. The outgoing edges of a node are usually thought of as distinguishable but an important distinction is made between a globally consistent edge-labelling versus a locally independent edge-labelling. A simple example is the case of a ring where clockwise and counterclockwise edges are marked consistently around the ring in one case, and the edges are arbitrarily - say by an adversary - marked 1 and 2 in the other case. If the labelling satisfies certain coding properties it is called a sense of direction [13]. Sense of direction has turned out to greatly effect the solvability and efficiency of solution of a number of problems in distributed computing and has been shown to be important in rendezvous as well. Networks are also classified by how they deal with time. In a synchronous network there exists a global clock available to all nodes. This global clock is inherited by the agents. In particular it is usually assumed that in a single step an agent arrives at a node, performs some calculation, and exits the node and that all agents are performing these tasks “in sync”. In an asynchronous network such a global clock is not available. The speed with which an agent computes or moves between nodes, while guaranteed to be finite, is not a priori determined. Finally we have to consider the resources provided by the nodes to the agents. All nodes are assumed to provide enough space to store the agent temporarily and computing power for it to perform its tasks. (The case of malicious nodes refusing agents or even worse destroying agents - so-called blackholes - is also sometimes considered.) Beyond these basic services one considers nodes that might provide some form of long-term storage, i.e., state that is left behind when the agent leaves. In the rendezvous problem the idea of leaving an indistinguishable mark or token at a node (introduced in [5]) has been studied. More accommodating nodes might provide a whiteboard for agents to write messages to be left for themselves or for other agents.
3
The Rendezvous Problem
Given a particular agent model (e.g., deterministic, anonymous agents with knowledge they are on a ring of size n) and network model (e.g., anonymous, synchronous with tokens) a set of k agents distributed arbitrarily over the nodes of the network are said to rendezvous if after running their programs after some finite time they all occupy the same node of the network at the same time. It is generally assumed that two agents occupying the same node can recognize this fact (though in many instances this fact is not required for rendezvous to occur). As stated, rendezvous is assumed to occur at nodes. In some instances one considers the possibility of rendezvous on an edge, i.e., if both agents use the
4
E. Kranakis, D. Krizanc, and S. Rajsbaum
same edge (in opposite directions) at the same time. (For physical robots this makes sense. For software agents this perhaps is not so realistic but sometimes necessary to allow for the possibility of rendezvous at all - especially in instances where the network lacks a sense of direction.) The first question one asks for an instance of rendezvous is whether or not it is solvable. There are many situations where it is not possible to rendezvous at all. This will depend upon both the properties of the agents (deterministic or randomized, anonymous or with identities, knowledge of the size of the network or not, etc.) and the network (synchronous or asynchronous, anonymous or with identities, tokens available or not, etc.). The solvability is also a function of the starting positions chosen for the agents. For example, if the agents start at the same node and can recognize this fact, rendezvous is possible in this instance. Given a situation where some starting positions are not solvable (i.e., rendezvous is not possible) but others are, we distinguish between algorithms that are guaranteed to finish for all starting positions, with successful rendezvous when possible but otherwise recognizing that rendezvous is impossible, versus algorithms that are only guaranteed to halt when rendezvous is possible. Algorithms of the former type are said to solve rendezvous with detection. (The distinction is perhaps analogous to Turing machines deciding versus accepting a language.) For solvable instances of rendezvous one is interested in comparing the efficiency of different solutions. Much of the research focuses on the time required to rendezvous. In the synchronous setting the time is measured via the global clock. (In some situations, it makes a difference if the agents begin their rendezvous procedure at the same time or there is possible delay between start times.) In the asynchronous setting we adapt the standard time measures from the distributed computing model. Also of interest is the size of the program required by the agents to solve the problem. This is referred to as the memory requirement of the agents and is considered to be proportional to the base two logarithm of the number of states required by the finite state machine encoding the agent. As is often the case, researchers are interested in examining the extremes in order to get an understanding of the limits a problem imposes. Over time it has become clear that for rendezvous symmetry (of the agents and the network) plays a central role in determining its solvability and the efficiency of its solutions. As such we divide our discussion below into the asymmetric and symmetric cases. For simplicity we restrict ourselves to the case of just two agents in most of the discussion below.
4
Asymmetric Rendezvous
Asymmetry in a rendezvous problem may arise from either the network or the agents. 4.1
Network Asymmetry
A network is asymmetric if it has one or more uniquely distinguishable vertices. A simple example is the case of a network where all of the nodes have
Mobile Agent Rendezvous: A Survey
5
unique identities chosen from a subset of some totally ordered set such as the integers. In this case, the node labelled with the smallest identity (for example) is unique and may be used as a meeting point for a rendezvous algorithm. Uniqueness need not be conferred using node labels. For example, in a network where there is a unique node of degree one, it may be used as a focal point. If a “map” of the graph with an agent’s starting position marked on it is available to the agents then the problem of rendezvous is easily solved by just traversing the path to an agreed upon unique node. Algorithms that use an agreed upon meeting place are referred to by Alpern and Gal [3] as FOCAL strategies. In the case where the graph is not available in advance but the agents know that a focal point exists (e.g., they know the nodes are uniquely labelled and therefore there exists a unique minimum label node) this strategy reduces to the problem of graph traversal or graph exploration whereby all of the nodes (sometimes edges) of the graph are to be visited by an agent. This has been extensively studied in a number of contexts, e.g., [9, 25]. Much of the work in this area has looked at improving the efficiency (time or memory) for restricted classes of graphs, e.g., trees [11]. A closely related problem is that of robot exploration of an unknown environment with obstacles which can often be modeled using graphs. See for example [6]. 4.2
Agent Asymmetry
By agent asymmetry one generally means the agents have unique identities that allow them to act differently depending upon their values. In the simplest scenario of two agents, the agent with the smaller value could decide to wait at its starting position for the other agent to find it by exploring the graph as above. Alpern and Gal [3] refer to this as the Wait For Mommy (WFM) strategy and they show it to be optimal under certain conditions. WFM depends upon the fact that the agents know in advance the identities associated with the other agents. In some situations this may be an unrealistic assumption. Yu and Yang [29] were the first to consider this problem. Under the assumption that the algorithm designer may assign the identities to the agents (as well as the existence of distinct whiteboards for each agent), they show that rendezvous may be achieved deterministically on a synchronous network in O(nl) steps where n is the size of the network and l is the size of the identities assigned. The perhaps more interesting case where an adversary assigns the labels was first considered in [10]. Extensions to this work including showing rendezvous on an arbitrary graph is possible in time polynomial in n and l and that there exist graphs requiring Ω(n2 ) time for rendezvous are described in [17, 18]. The case of an asynchronous network is considered in [8] where a (nonpolynomial) upper bound is set for rendezvous in arbitrary graphs (assuming the agents have an upper bound on the size of the graph). Improvements (in some cases optimal) for the case of the ring network are discussed in each of the above papers.
6
5
E. Kranakis, D. Krizanc, and S. Rajsbaum
Symmetric Rendezvous
In the case of symmetric rendezvous, both the (generally synchronous) network and the agents are assumed to be anonymous. Further one considers classes of networks that in the worst case contain highly symmetric networks that do not submit to a FOCAL strategy. As might be expected some mechanism is required to break symmetry in order for rendezvous to be possible. The use of randomization and of tokens to break symmetry have both been studied extensively. 5.1
Randomized Rendezvous
Many authors have observed that rendezvous may be solved by anonymous agents on an anonymous network by having the agents perform a random walk. The expected time to rendezvous is then a (polynomial) function of the (size of the) network and is directly related to the cover time of the network. (See [24] for definitions relating to random walks.) For example, it is straightforward to show that two agents performing a symmetric random walk on ring of size n will rendezvous within expected O(n2 ) time. This expected time can be improved by considering the following strategy (for a ring with sense of direction). Repeat the following until rendezvous is achieved: flip a (fair) coin and walk n/2 steps to the right if the result is heads, n/2 steps to the left if the result is tails. If the two agents choose different directions (which they do with probability 1/2) then they will rendezvous (at least on an edge if not at a node). It is easy to see that expected time until rendezvous is O(n). Alpern refers to this strategy as Coin Half Tour and studies it in detail in [2]. Note that the agents are required to count up to n and thus seem to require O(log n) bits of memory to perform this algorithm (whereas the straightforward random walk requires only a constant number of states to implement). It can be shown that O(log log n) bits are sufficient for achieving linear expected rendezvous time[23]. 5.2
Rendezvous Using Tokens
The idea of using tokens or marks to break symmetry for rendezvous was first suggested in [5] and expanded upon for the case of the ring in [27]. The first observation to make is that rendezvous is impossible for deterministic agents with tokens (or whiteboards) on an even size ring when the agents start at distance n/2 as the agents will remain in symmetric positions indefinitely. However, this is the only starting position for the agents for which rendezvous is impossible. This leads one to consider algorithms for rendezvous with detection where rendezvous is achieved when possible and otherwise the agents detect they are in an impossible to rendezvous situation. In this case, a simple algorithm suffices (described here for the oriented case). Each agent marks their starting position with a token. They then travel once around the ring counting the distances between their tokens. If the two distances are the same, they halt declaring rendezvous impossible. If they are different they agree to meet (for example) in the middle of the shorter side.
Mobile Agent Rendezvous: A Survey
7
Again, one observes that the algorithm as stated requires O(log n) bits of memory for each agent in order to keep track of the distances. Interestingly enough this can be reduced to O(log log n) bits and this can be shown to be tight for unidirectional algorithms [20]. If we are allowed two movable tokens (i.e., the indistinguishable marks can be erased and written with up to two marks stored per node) then rendezvous with detection becomes possible with an agent with constant size memory [21]. Multi-agent rendezvous, i.e., more than two agents, on the ring is considered in [14, 16], the second reference establishing optimal memory bounds for the problem. Two agent rendezvous on the torus is studied in [21] where tradeoffs between memory and the number of (movable) tokens used are given. Finally [15] considers a model in which tokens may disappear or fail over time. 5.3
Whiteboards and Blackholes
The use of whiteboards to achieve multiagent rendezvous on an arbitrary anonymous asynchronous network is studied in [4] where the problem is shown to be equivalent to that of leader election. In [12] rendezvous on an asynchronous ring with whiteboards in the presence of blackholes is considered.
6
Related Problems
As was mentioned above the rendezvous problem is intimately related under certain conditions to that of graph exploration [9, 25]. Besides this connection there are a number of “search” problems that are at least tangentially related to rendezvous in as much as techniques and/or models considered by researchers on these problems may be of some use to those working on rendezvous. Some examples are described below. Imagine that the police have cornered a fugitive in a complicated warren of tunnels and rooms. They know that she is situated at one of the nodes and would like to capture her by searching the rooms. Their main concern is to decide what is the least number of police personnel necessary in order to be certain the fugitive does not evade capture. This number, referred to as the search number of a graph, was introduced by Megiddo et al. [22] and has since been studied by many authors. Two friends check into an n room hotel. The hotel clerk is off duty and each doesn’t know the room number of the other. They start calling rooms in order to find each other. What is the least number of calls they must make before at least one finds the other? This question was formalized and generalized as mutual search by Buhrman et al.[7] A friend has given you the name but not the address of a restaurant in downtown Manhattan. You start searching for the restaurant by asking passersby which direction the restaurant is in. Their answers are sometimes erroneous, even contradictory. What is the best strategy to use in order to find the restaurant quickly? This problem was formalized in [19].
8
7
E. Kranakis, D. Krizanc, and S. Rajsbaum
Conclusions
Rendezvous is a natural and fundamental problem for mobile software agents traveling through a distributed network. This makes it a natural choice as a model problem to study in the development of the theory of mobile agent computing much like leader election and consensus form model problems for the traditional study of the theory of distributed algorithms. We have attempted to bring together the current state of our knowledge of the study of rendezvous in the theoretical computer science context. A lot of work remains to be done.
Acknowledgements Research of the first author was supported in part by NSERC (Natural Sciences and Engineering Research Council of Canada) and MITACS (Mathematics of Information Technology and Complex Systems) grants. Research of the third author was supported in part by PAPIIT-UNAM.
References 1. S. Alpern, Hide and Seek Games, Seminar, Institut f¨ ur H¨ ohere Studien, Wien, July 1976. 2. S. Alpern, The Rendezvous Search Problem, SIAM Journal of Control and Optimization, 33, pp. 673-683, 1995. 3. S. Alpern and S. Gal, The Theory of Search Games and Rendezvous, Kluwer Academic Publishers, Norwell, Massachusetts, 2003. 4. L. Barriere, P. Flocchini, P. Fraigniaud, and N. Santoro, Election and Rendezvous of Anonymous Mobile Agents in Anonymous Networks with Sense of Direction, Proceedings of the 9th Sirocco, pp. 17-32, 2003. 5. V. Baston and S. Gal, Rendezvous Search When Marks Are Left at the Starting Points, Naval Research Logistics, 47, No. 6, pp. 722-731, 2001. 6. A. Blum, P. Raghavan and B. Schieber, Navigating in Unfamiliar Geometric Terrain, SIAM Journal on Computing 26 (1997), 110-137. 7. H. Buhrman, M. Franklin, J. Garay, J. Hoepman, J. Tromp and P. Vitanyi, Mutual Search, Journal of the ACM 46 (1999), 517-536. 8. G. De Marco, L Gargano, E. Kranakis, D. Krizanc, A. Pelc and U. Vacaro, Asynchronous deterministic rendezvous in graphs, Proc. 30th MFCS, 2005, 271-282. 9. X. Deng and C. H. Papadimitriou, Exploring an Unknown Graph, Journal of Graph Theory 32 (1999), 265-297. 10. A. Dessmark, P. Fraigniaud, and A. Pelc, Deterministic Rendezvous in Graphs, Proc. 11th ESA, 184-195, 2003. 11. K. Diks, P. Fraigniaud, E. Kranakis, A. Pelc, Tree Exploration with Little Memory, Journal of Algorithms, 51 (2004) 38-63. 12. S. Dobrev, P. Flocchini, G. Prencipe, and N. Santoro, Multiple Agents Rendezvous in a Ring in spite of a Black Hole, Proc. Symposium on Principles of Distributed Systems (OPODIS ’03), LNCS 3144, pp. 34-46, 2004. 13. P. Flocchini, B. Mans and N. Santoro, Sense of direction: definition, properties and classes, Networks 32 (1998), 29-53.
Mobile Agent Rendezvous: A Survey
9
14. P. Flocchini, E. Kranakis, D. Krizanc, N. Santoro, and C. Sawchuk, Multiple Mobile Agent Rendezvous in the Ring, Proc. LATIN 2004, LNCS 2976, pp. 599-608, 2004. 15. P. Flocchini, E. Kranakis, D. Krizanc, F. Luccio, N. Santoro and C. Sawchuk, Mobile Agent Rendezvous When Tokens Fail, Proc. of 11th Sirocco, 2004. 16. L. Gasieniec, E. Kranakis, D. Krizanc, X. Zhang, Optimal Memory Rendezvous of Anonymous Mobile Agents in a Uni-directional Ring, Proc. of 32nd SOFSEM 2006, to appear. 17. D. Kowalski and A. Pelc, Polynomial deterministic rendezvous in arbitrary graphs, Proc. 15th ISAAC, 2004. 18. D. Kowalski and A. Malinowski, How to meet in an anonymous network, Proc. 13th Sirocco, 2006. 19. E. Kranakis, and D. Krizanc, Searching with Uncertainty. Proc. of 6th Sirocco, 1999. 20. E. Kranakis, D. Krizanc, N. Santoro, and C. Sawchuk, Mobile Agent Rendezvous Search Problem in the Ring, Proc. International Conference on Distributed Computing Systems (ICDCS), pp. 592-599, 2003. 21. E. Kranakis, D. Krizanc, E. Markou, Mobile Agent Rendezvous in a Synchronous Torus. Proc. of LATIN, 653-664, 2006. 22. N. Megiddo, S. Hakimi, M. Garey, D. Johnson and C. Papadimitriou. The Complexity of Searching a Graph, Journal of the ACM 35 (1988), 18-44. 23. P. Morin, personal communication. 24. R. Motwani and P. Raghavan, Randomized Algorithms, Cambridge University Press, New York, 1995. 25. P. Panaite and A. Pelc, Exploring Unknown Undirected Graphs, Journal of Algorithms 33 (1999), 281-295. 26. N. Roy and G. Dudek, Collaborative robot exploration and rendezvous: Algorithms, performance bounds and observations, Autonomous Robots 11 (2001), 117-136. 27. C. Sawchuk, Mobile Agent Rendezvous in the Ring, PhD thesis, Carleton University, School of Computer Science, Ottawa, Canada, 2004. 28. I. Suzuki and M. Yamashita, Distributed anonymous mobile robots: Formation of geometric patterns, SIAM Journal of Computing 28 (1999), 1347-1363. 29. X. Yu and M. Yung, Agent Rendezvous: A Dynamic Symmetry-Breaking Problem, Proceedings of ICALP, LNCS 1099, 610-621, 1996.
Adapting to Point Contention with Long-Lived Safe Agreement (Extended Abstract) Hagit Attiya Department of Computer Science Technion [email protected]
Abstract. Algorithms with step complexity that depends only on the point contention—the number of simultaneously active processes—are very attractive for distributed systems with varying degree of concurrency. Designing shared-memory algorithms that adapt to point contention, using only read and write operations, is however, a challenging task. The paper specifies the long-lived safe agreement object, extending an object of Borowsky et al. [1], and describes an implementation whose step complexity is adaptive to point contention. Then, we illustrate how this object is used to solve other problems, like renaming and information collection, in an adaptive manner.
1
Introduction
In order to coordinate the actions of a distributed application, processes must obtain up-to-date information from each other. In a typical wait-free algorithm, which guarantees that a process completes an operation within a finite number of its own steps, information is collected by reading from an array indexed with process’ identifiers. If a distributed algorithm is designed to accommodate a large number of processes, this scheme is an over-kill when only a few processes simultaneously participate in the algorithm: many entries are read from the array although they contain irrelevant information about processes not wishing to coordinate. The best performance is achieved when the step complexity of an operation is a function only of its point contention, namely, the maximal number of processes simultaneously executing the algorithm concurrently with it. In this way, an operation is delayed only when many processes are simultaneously active. Note that an algorithm whose step step complexity is adaptive to point contention is necessarily wait-free. For example, if an algorithm is adaptive to point contention, then the step complexity of operation op in Figure 1 is constant since at most three processes simultaneously participate at each point during its interval. This holds although a large number of processes are active throughout op, and many processes are simultaneously active just before it starts. P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 10–23, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
Adapting to Point Contention with Long-Lived Safe Agreement
11
op Fig. 1. An execution example
This article is devoted to explaining the design of algorithms that adapt to point contention using only read and write operations. Our exposition is based on an adaptive implementation of a long-lived safe agreement object. The safe agreement object, originally defined by Borowsky et al. [1], allows processes to propose information and to agree on an identical value. In the BG simulation, the safe agreement object allows processes to agree on each step of a simulated process. Both the specification and the implementation of the object in [1] are neither wait-free (and hence, it is non-adaptive) nor long-lived. We extend the specification to support adaptive and long-lived properties and present an implementation with O(k) step complexity. Here and below, k denotes the point contention during an operation. This implementation is based on work by Attiya and Zach [2], which in turn follows ideas of Attiya and Fouren [3], as well as Afek et al. [4] and Inoue et al. [5]. The article also describes how safe agreement objects are used to solve the renaming problem and to implement two information collection objects, called gather and collect. Renaming [6, 7] allows a process to obtain a new name—a positive integer, bounded by a function of the current number of active processes—and to release it afterwards. We adjust a renaming algorithm of Attiya and Fouren [3] to use long-lived safe agreement objects; in the algorithm, processes obtain names in a range of size O(k 2 ). Gather and collect objects allow processes to store information and to retrieve previously-stored information; they differ in the exact properties they provide. Gather and collect objects are commonly used as modular building blocks for efficient adaptive algorithms. We describe an implementation of a gather object, with O(k 2 ) step complexity for storing information and O(k) step complexity for retrieving information. A collect object is easily implemented from a gather object, with O(k 2 ) step complexity for storing and retrieving information. The algorithms and their presentation combine ideas from [2, 3, 8, 9].
2
Model of Computation
We use a standard asynchronous shared-memory model of computation, following, e.g., [10]. A system consists of n processes, p1 , . . . , pn , and a set of registers that are accessed by read and write operations. An event is a computation step by a single process; in an event, a process determines the operation to perform according to its local state, and determines its next local state according to the value returned by the operation.
12
H. Attiya
An execution is a (finite or infinite) sequence of events; each event occurs at one process, which applies a read or a write operation to a single register and changes its state according to its algorithm. We assume an asynchronous model of computation, where process steps are arbitrarily interleaved. An invocation of a high-level operation by a process causes the execution of the appropriate algorithm. The execution interval of an operation opi by process pi is the subsequence of the execution between the first event of pi in opi and the last event of pi in opi . We denote opi → opj if the execution interval of opi precedes the execution interval of the operation opj by process pj ; namely, the last event of pi in opi appears before the first event of pj in opj . If neither opi → opj nor opj → opi , we say that opi and opj are overlapping. Let α′ be a finite prefix of an execution α; process pi is active at the end of ′ α if α′ includes an invocation of an operation op by pi without the matching return. The point contention at the end of α′ , denoted pointCont(α′ ), is the number of active processes at the end of α′ . Consider a finite interval β of an execution α; we can write α = α1 βα2 . The point contention during β is the maximum contention in prefixes α1 β ′ of α1 β. We abuse notation and denote it by pointCont(β), as well; that is pointCont(β) = max{pointCont(α1 β ′ ) : α1 β ′ is a prefix of α1 β } . If pointCont(β) = k, then k processes are simultaneously active at some point during β. Another measure of concurrency is the interval contention during an interval β, denoted intCont(β), counting the number of distinct processes that are active at some point during β. Clearly, pointCont(β) ≤ intCont(β).
3
The Adaptive Safe Agreement Object
We start by specifying and implementing the one-shot safe agreement object and later extend it to be long-lived. The original safe agreement object [1] allows processes to propose values and to agree on a single value; in our safe agreement object, processes agree on an identical set of values. Clearly, a single value can be deduced from this set by choosing some predefined value, e.g., the minimum. In the original specification, a process may wait indefinitely until the agreement value is decided, making it impossible to have a wait-free implementation. This means that there is no adaptive implementation, either. To admit adaptive implementations, we decouple the proposal of a value from the reading of the agreed set, and allow the reading to return an empty set, indicating that decision was not reached yet. 3.1
The One-Shot Object
The one-shot object provides two operations, propose and read. A process invokes propose at most once, but can invoke read to query the object several times.
Adapting to Point Contention with Long-Lived Safe Agreement
13
A propose(info) operation tries to store info into the object; if it succeeds, it returns true, otherwise it returns false. A read operation returns a set of values, possibly empty. A one-shot safe agreement object must provide the following properties: Validity: Any value returned was previously proposed. Agreement: All non-empty return sets are identical. A process pi accesses safe agreement object, if it calls a propose operation. A process pi is inside a safe agreement object, if it gets true from a propose operation. A process is a candidate if its proposed value appears in the nonempty return set of values. For example, assume processes p0 , p1 , p2 and p3 access a safe agreement object (we ignore the specific values proposed), and that p3 returned false, while all other processes returned true, and thus, are inside the object. In later read operations, p0 returns ∅, while p1 , p2 and p3 return {p0 , p1 , p2 }. In this case, the candidates are p0 , p1 , and p2 . The liveness property, defined next, implies that at least one of the processes that get inside the safe agreement object is guaranteed to recognize itself as a candidate. These processes are called winners, and are necessarily also candidates. In the above example, the winners are p1 and p2 , since they return a non-empty set containing themselves. Liveness: In any execution, at least one of the processes accessing the object becomes a winner. Concurrency: If a process gets inside a safe agreement object, and does not win, then some other process is inside the object concurrently. The adaptive implementation of a one-shot safe agreement object is based on the sieve object of Attiya and Fouren [3]. We use the following data structures: – A Boolean variable inside, initially false, indicates whether some process is already inside the object. – An array R[1 . . . n] of views; all views are initially empty. R[pi ] contains the view obtained by process pi in this object. We also associate a procedure for one-shot atomic snapshot [11] with the object, called osSnap. A process calls the procedure with info and obtains a view, namely a set of process id’s and their information, which must include the process itself. The views returned by the procedure must be comparable by containment. The pseudo-code appears in Algorithm 1. In a propose operation, a process first checks if it is among the first processes to propose values. It succeeds only if the safe agreement object is empty, and inside is false. In this case, the process indicates that the safe agreement object is no longer empty, and then obtains a snapshot view, which it stores in its entry in R. The process returns with true from propose. If the process does not get
14
H. Attiya
Algorithm 1. Adaptive one-shot safe agreement object: code for process pi data types: view : vector of id, info shared variables: inside : Boolean, initially false R[1 . . . n] : array of views, initially ∅ local variables: V, W : view Boolean procedure propose(info) 1: if (not inside) then 2: inside = true 3: V = osSnap(info) 4: R[idi ] = V 5: return(true) 6: else return(false)
// notify that a process is inside the object // propose info; return view of id, info // save the obtained view // object is open // object is not open
view procedure read() // returns the subset of proposed values 7: V = R[idi ] 8: W = min{R[idj ] | idj , ∗ ∈ V and R[idj ] = ∅} // min by containment 9: if ∀idj , ∗ ∈ W, R[idj ] ⊇ W then 10: return(W ) 11: else return(∅)
inside the object (i.e., inside is true), then some concurrent process is already inside the object, and the process returns with false from propose. In a read operation, process pi tries to distinguish the minimal (by containment) snapshot view. This is done by considering the minimal view written by any process in the view obtained by pi ; if one of these processes has not written its view yet, due to the asynchrony of the system, then the read is inconclusive and returns an empty set. Otherwise, the process returns the minimal view it finds. As we shall see in the first lemma below, this suffices to guarantee that all processes return the same set. The validity property of the safe agreement object trivially holds by the code (see [3]). We argue that all non-empty sets are identical. Lemma 1. Algorithm 1 satisfies the agreement property. Proof. Let V be the minimal view (by containment) obtained in osSnap, by some process pk . We argue that any non-empty view W returned in an invocation of read by some process pi is equal to V . Assume, by way of contradiction, that W = V . Since W is non-empty, it was obtained in some invocation of osSnap; therefore, W and V are comparable. By the minimality of V , V ⊂ W . Since pk ∈ V ⊂ W , pi checks R[idk ]. If R[idk ] is empty then pi clearly fails the test; otherwise, R[idk ] = V and since V ⊂ W , pi also fails the test. In both cases, pi returns ∅, which is contradiction. ⊓ ⊔
Adapting to Point Contention with Long-Lived Safe Agreement
15
Next, we show that at least one of the processes accessing a safe agreement object becomes a winner, when it calls read after returning from propose. Lemma 2. Algorithm 1 satisfies the liveness property. Proof. Let Wc be the set of candidates in the safe agreement object. Wc is not empty since some processes access the object. Let pi be the last process in Wc to write its view in propose; clearly, pi calls read after all processes in Wc write their views in propose. Let Vi be the view obtained by pi from osSnap. Since Wc is not empty, some process pc obtains Wc , that is, the minimal (by containment) view, from osSnap. Note that pc and pi could be the same process. Since Wc and Vi are comparable and since Wc is minimal, pc ∈ Wc ⊆ Vi . By assumption, pc writes its view to R[idc ] before pi calls read. Therefore, pi reads Wc from R[idc ], and sets Vi to Wc , by its minimality. By assumption, pi calls read after every process pj ∈ Vi = Wc wrote its view Vj to R[idj ]. By the minimality of Wc , Vi = Wc ⊆ Vj , and therefore, pi evaluates the if condition to hold and obtains Wc . Thus, pi finds that it is a winner in the safe agreement object. ⊓ ⊔ A process that gets inside the safe agreement object first reads false from inside and then sets inside to true. This fact can be used to prove that processes are simultaneously inside a safe agreement object. Lemma 3. The intervals of all processes that get inside a safe agreement object are overlapping. The next lemma shows that if process pi gets inside safe agreement object and does not win, then some process pj with an overlapping interval is a candidate in the object. Lemma 4. Algorithm 1 satisfies the concurrency property. Sketch of proof. If pi gets true from open then pi writes true to inside. By Lemma 3, the intervals of all processes that write true to inside overlap. By Lemma 2, at least one of them is a winner (and hence, a candidate) the safe agreement object, and the lemma follows. ⊓ ⊔ To evaluate the step complexity of the algorithm, suppose that pi accesses safe agreement object in interval βi , and let k be the point contention during βi . If A is the set of processes that are inside the object throughout the execution (including pi itself), then Lemma 3 implies that processes in A access the object concurrently, and hence, |A| ≤ pointCont(βi ) = k. Thus, at most k processes invoke the one-shot snapshot operation, which dominates the step complexity of propose. Attiya and Fouren [12] present a one-shot snapshot algorithm, whose step complexity is O(KlogK), where K is the total number of processes that ever invoke it (also known as the total contention). As we have just argued, in our
16
H. Attiya
case we have that K = k, the point contention, and thus, the step complexity of the one-shot snapshot algorithm is O(k log k). Inoue et al. [5] observed that the one-shot snapshot can be replaced with a partial atomic snapshot that guarantees that if one or more processes access the object concurrently, at least one process obtains a snapshot (the others may obtain an empty view). They also present a partial atomic snapshot algorithm with O(k) step complexity, implying that the step complexity of propose is O(k). Since the maximal size of a view is k, the step complexity of read is O(k). Therefore, a process performs O(k) operations in each invocation of the oneshot safe agreement procedures. This yields the following theorem: Theorem 1. Algorithm 1 implements an adaptive one-shot safe agreement object with O(k) step complexity, where k is the point contention during the operation’s execution interval. 3.2
The Long-Lived Object
The long-lived safe agreement object has an infinite number of generations. Its interface is similar to that of the one-shot object, except that a generation number is added as a parameter to the operations. The generation number is visible from outside the object, in order to simplify the specification of the long-lived object, and to facilitate applications that use the generation number, e.g., the timestamps algorithm of [3]. Specifically, a long-lived safe agreement object supports three operations: propose(info) tries to store information in the current generation; if it succeeds, it returns true,c , otherwise, it returns false,c . read(c) returns either a nonempty set of values or an empty set. release(c) leaves generation c and activates the next generation c + 1, if possible. A generation starts when the first invocation of a propose operation that returns ∗,c occurs, and ends when the last process that got inside this generation leaves the generation, by invoking release(c). Ic denotes the execution interval of generation c. We assume that there is at most one invocation of propose by each process for each generation, which means that after calling propose that returns a generation number c, the process must call release(c), before calling propose again. The properties of the one-shot object (validity, agreement, liveness and concurrency) must hold for every generation of the long-lived safe agreement object. We also require the following property: Synchronization: The generation number is a non-decreasing counter and it is incremented by one during interval Ic . Moreover, processes get inside generation c only after all candidates leave the smaller generations and the generation number is set to c (see Figure 2). A long-lived safe agreement object is implemented using an unbounded array of one-shot safe agreement objects, each corresponding to a single generation. An
Adapting to Point Contention with Long-Lived Safe Agreement
17
Generation number 5 4 3 2 1 0
I0
I1
I2
I3
I4
Time
Fig. 2. Generation numbers are nondecreasing
integer variable, count, indicates the current generation and points to the current one-shot object. There is also an array done[1 . . . n][0 . . . ∞] of Boolean variables, all initially false. The entry done[pi ][c] indicates whether process pi is done with the c’th one-shot safe agreement object. Boolean variables allDone[0 . . . ∞], all initially false, indicate whether all candidates of a specific generation are done. The pseudo-code appears in Algorithm 2. As in the one-shot object, a process proposes its value by checking if it is among the first processes to access the current generation of the safe agreement object. The process succeeds only if this generation is empty, that is, no other process is already inside it. If the process does not succeed to get inside the current generation, then some concurrent process is already inside the current generation. The key idea in proving the correctness of the algorithm is that different generations of the same safe agreement object are accessed in disjoint intervals (this is the synchronization property of the object). This property allows correct handling of the non-decreasing counter, and implies that the long-lived safe agreement object inherits the properties of the one-shot object. Process pi is inside generation c of a long-lived safe agreement object since it gets true from a propose operation of generation c and until it leaves the generation. In other words, process pi is inside generation c when it is inside the one-shot object S[c] corresponding to generation c. Careful inspection of the code, and agreement on the set of candidates show that a safe agreement object is released when all candidates are done. Lemma 5. If allDone[c] is set to true, then all candidates of S[c] invoked release(c). This lemma is the key for showing, by induction, that a process is inside generation c only after all candidates leave smaller generations. Lemma 6. If process pi is inside generation c of a safe agreement object, then all the candidates already called release of the smaller generations, 1, . . . , c − 1. Sketch of proof. We concentrate on the induction step, assuming that the lemma holds for generation c. Only a winner pj in generation c writes c + 1 to count,
18
H. Attiya
Algorithm 2. Adaptive long-lived safe agreement object: code for process pi shared variables: count : integer, initially 1 S[0 . . . ∞] : infinite array of one-shot safe agreement objects done[1 . . . n][0 . . . ∞] : two-dimensional array of Boolean variables, all initially false allDone[0 . . . ∞] : infinite array of Boolean variables, all initially false local variables: V, W : view Boolean, integer procedure propose(info) 1: if (all-done[count − 1] and // all candidates of the previous generation are done S[count].propose(info)) // and no process is inside the current generation 2: return(true, count) // generation count is open 3: else release(count) // generation c is not open 4: return(false, count) view procedure read(c) 5: return (S[c].read())
// returns the candidates of generation c
void procedure release(c) // release generation c // indicate that pi is done in generation c 6: done[idi ][c] = true 7: W = S[c].read() // re-calculate the set of candidates // pi is a winner in generation c 8: if (pi ∈ W ) then count =c+1 9: if (W = ∅ and ∀pj ∈ W , done[pj ] == true) then // all candidates are done 10: allDone[c] = true
implying that pj is inside generation c. By the induction hypothesis, all candidates already called release of generation 1, . . . , c−1. Since pi is inside generation c + 1 it reads true from S[c].allDone. Lemma 5 implies that all candidates of the one-shot object S[c] already called release on this object. ⊓ ⊔ Recall that Ic is the execution interval of generation c, starting with the first invocation of a propose operation in generation c and ending when the last process that got inside generation c leaves. The next lemma proves that the data structures of different generations of the same long-lived safe agreement object are modified in disjoint intervals. Lemma 7. For every c ≥ 1, Ic starts after all previous intervals I1 , . . . , Ic−1 end. Sketch of proof. We concentrate on the induction step, assuming that the lemma holds for for Ic . By definition, Ic+1 starts with first invocation of a propose operation in generation c + 1. Lemma 6 implies that if this invocation occurs, then all the candidates already called release of the smaller generations. In particular, all candidates already called release of generation c, and by the induction hypothesis all previous intervals I1 , . . . , Ic−1 end. Since all candidates of generation c already called release, Ic also ended, implying that Ic+1 starts after all previous intervals end. ⊓ ⊔
Adapting to Point Contention with Long-Lived Safe Agreement
19
The next lemma shows that the generation number is non-decreasing value, and it is incremented by one during interval Ic . Lemma 8. Algorithm 2 satisfies the synchronization property. Sketch of proof. By the code, only a winner pw of generation c of a long-lived agreement object writes c + 1 to count. Since pw is a winner, it previously writes true to inside of generation c, after Ic begins. Hence, pw writes c + 1 to count after Ic begins, and before it leaves generation c. Lemma 5 implies that a oneshot safe agreement object is released after all candidates leave the object, and hence, pw writes c + 1 to count before Ic ends. Lemma 7 implies that processes get inside generation c only during interval Ic , after count is set to c. ⊓ ⊔ Thus, distinct one-shot objects, associated with different generations, are accessed in disjoint intervals, and the step complexity of accessing the object is dominated by the step complexity of the one-shot object. Theorem 2. Algorithm 2 implements an adaptive long-lived safe agreement object with O(k) step complexity, where k is the point contention during the operation’s execution interval.
4
Application I: Renaming
In the (long-lived) renaming problem [6, 7] processes repeatedly get and release names from a small range. Ideally, the size of the name range should depend only on the current contention. Long-lived safe agreement objects can be used in a simple renaming algorithm: Place n long-lived safe agreement objects, SLL [1], . . . , SLL [n], in a row. To get a name, a process pi accesses the objects sequentially, applying propose to safe agreement object s; if it obtains true,c , then pi invokes read(c) to get the set of candidates W . Process pi returns as its new name the pair composed of s and its rank in W . If pi obtains false,c , then it releases SLL [s] and continues to the next object, SLL [s + 1]. In the latter case, we say that pi skips the s’th safe agreement object. To release a name, process pi calls release on the safe agreement object where it obtained a name. The concurrency properties of the long-lived safe agreement object can easily be used to prove that a process wins within k ′ iterations, where k ′ is the interval contention while pi is getting a name. It is more surprising—and harder to prove!—that in fact, process pi wins within 2k − 1 iterations, where k is the point contention while pi is getting a name. This is done using an interesting potential method, which considers two sets of simultaneously active processes and shows that at least one of them is increased by 1 when pi skips a safe agreement object. The sets are indexed with an integer number s = 1, . . . , n. The first set, denoted As , contains all processes that access the ℓ’th safe agreement object,
20
H. Attiya
1 ≤ ℓ ≤ s. The second set, denote Ws , contains all processes that win the ℓ’th safe agreement object, 1 ≤ ℓ ≤ s. (As and Ws are not disjoint.) The exact definitions of As and Ws depend on specific execution intervals, and are used in proving that if process pi skips the s’th safe agreement object, then |Ws | + |As | ≥ s + 1 (for appropriately chosen intervals). The detailed definitions and statements, as well as the proofs, appear in [3, Section 4]. Since Ws and As contain simultaneously active processes, and since pi is not in Ws , we have that |Ws | + |As | ≤ (k − 1) + k. This implies that pi skips at most 2k − 2 safe agreement objects, and the first component of the new name is ≤ 2k − 1. The second component of the new name is equal to the rank of the process in the obtained view, and thus it is ≤ k. It follows that the size of the name space is in O(k 2 ). Moreover, the step complexity of getting a name is O(k) times the step complexity of proposing and reading in a safe agreement object, since pi accesses at most 2k − 1 sieves. The step complexity of releasing a name is proportional to the step complexity of releasing a safe agreement object. Since both complexities can be bound by O(k) (see the previous section), it follows that the algorithm solves long-lived O(k 2 )-renaming with O(k 2 ) step complexity.
5
Application II: Collecting Information
We discuss two objects, gather and collect, which allow a process to store its value in a shared memory, or to retrieve the values stored in the shared memory. The gather object provides two operations: a put operation stores its parameter in the object, while a gather operation returns the set of values stored in the object before or possibly during the operation. (This is called the validity property.) The collect object provides a collect operation that inherits the validity property of the gather operation, and further guarantees the regularity property. Namely, later collect operations are at least as updated as previous ones. 5.1
Implementing a Gather Object
To implement a gather object, we again put n long-lived safe agreement objects, SLL [1], . . . , SLL [n], in a row. With each safe agreement object we associate a set containing the values of processes that were candidates in this object. In order to store its information, a process iteratively tries to win in the safe agreement objects. In the first part of a put operation, a process goes through the row of safe agreement objects, until it wins one of them. If it wins safe agreement object SLL [s], the process merges the values of all candidates of the current generation to the set associated with SLL [s]. The synchronization and agreement properties of the safe agreement object guarantee that this set contains the values of all candidates in all generations of SLL [s].
Adapting to Point Contention with Long-Lived Safe Agreement
21
In principle, in a gather operation, the process merely has to go through the safe agreement objects and read the associated sets of values. This might cause a problem, however, if a gather operation is performed after store operations with high contention: A put operation encountering high contention may store a new value in an entry with large index, and a subsequent gather operation will have to access many entries, even if its point contention is low. This is solved by a technique called bubble-up, in which processes propagate new results to the beginning of the row. This allows a gather operation to find the new values at the beginning of the row, when contention is low. Bubble-up was presented by Afek et al. [8] and later used in [9, 3, 2]. After storing its value, the put operation bubbles the result to the top of the array. The process goes from entry s up to entry 1, and for each entry s′ = s, . . . , 1, it recursively gathers the values stored beyond entry s′ , and stores the result in its private register associated with entry s′ . (See the description by Stupp [13, Section 7.1].) In a gather operation, a process starts from the beginning of the row and reads until it find a value that was bubbled up by one of the processes. The number of entries accessed is linear in the point contention during the operation: if the contention is low, then the process reads the value near the beginning of the row; if the contention is high, then the process is allowed to go further in the row. The key to showing that the gather object is correctly implemented is to show that the result array contains the most recent values of all candidates of all generations of the corresponding safe agreement object. The synchronization property of the safe agreement object is used to show that this property holds, although several processes (winners of the same safe agreement object) may concurrently write to the result entry. (See [3, Lemma 6.1].) Next we explain how bubbling up restricts the step complexity of the gather operation. Assume that a gather operation by process pi reads skips over entry s. The key to the complexity analysis is to show that a process skips an entry only if some concurrent process is bubbling up through this entry. By careful inspection of the intervals, this is used to show that pi skips at most 3k entries, where k is the point contention. The same potential argument used for renaming can be used to show that in its first part, a put operation accesses at most 2k − 1 safe agreement objects. Together with the linear step complexity (in point contention) of operations on a safe agreement object, this implies that the step complexity of a put operation is O(k 2 ). 5.2
Implementing a Collect Object
When a gather operation returns a value v for process p, it is still possible that a later gather operation returns a value that was written by process p before v. This can happen, for example, when the two gather operations are concurrent with the update operation of process p. The regularity property of the collect object disallows this behavior. In order to guarantee this property, the collect procedure first calls gather and then calls
22
H. Attiya
put to store the result it has obtained. This increases the step complexity of a collect operation to be O(k 2 ).
6
Summary
We tried to provide a closer look at the algorithmic ideas that are employed in order to have step complexity that adapts to point contention. This article is not a comprehensive survey of the recent research on adaptive algorithms. The issues not covered here include the space complexity of adaptive algorithms [14,15], using stronger base objects [16,17], guaranteeing weaker types of adaptivity [12,18,19], and adaptive algorithms for other problems, e.g., mutual exclusion [20, 21, 22].
References 1. Borowsky, E., Gafni, E., Lynch, N., Rajsbaum, S.: The BG distributed simulation algorithm. Distributed Computing 14(3) (2001) 127–146 2. Attiya, H., Zach, I.: Fully adaptive algorithms for atomic and immediate snapshots. www.cs.technion.ac.il/∼hagit/pubs/AZ03.pdf (2003) 3. Attiya, H., Fouren, A.: Algorithms adaptive to point contention. Journal of the ACM 50(4) (2003) 444–468 4. Afek, Y., Attiya, H., Fouren, A., Stupp, G., Touitou, D.: Adaptive long-lived renaming using bounded memory. www.cs.technion.ac.il/∼hagit/pubs/AAFST99disc.ps.gz (1999) 5. Inoue, M., Umetani, S., Masuzawa, T., Fujiwara, H.: Adaptive long-lived O(k2 )renaming with O(k2 ) steps. In: Proceedings of the 15th International Conference on Distributed Computing, Berlin, Springer-Verlag (2001) 123–135 6. Attiya, H., Bar-Noy, A., Dolev, D., Peleg, D., Reischuk, R.: Renaming in an asynchronous environment. Journal of the ACM 37(3) (1990) 524–548 7. Moir, M., Anderson, J.H.: Wait-free algorithms for fast, long-lived renaming. Science of Computer Programming 25(1) (1995) 1–39 8. Afek, Y., Stupp, G., Touitou, D.: Long-lived and adaptive collect with applications. In: Proceedings of the 40th IEEE Symposium on Foundations of Computer Science, Phoenix, IEEE Computer Society Press (1999) 262–272 9. Afek, Y., Stupp, G., Touitou, D.: Long-lived and adaptive atomic snapshot and immediate snapshot. In: Proceedings of the 19th Annual ACM Symposium on Principles of Distributed Computing, New-York, ACM Press (2000) 71–80 10. Herlihy, M.: Wait-free synchronization. ACM Transactions on Programming Languages and Systems 13(1) (1991) 124–149 11. Afek, Y., Attiya, H., Dolev, D., Gafni, E., Merritt, M., Shavit, N.: Atomic snapshots of shared memory. Journal of the ACM 40(4) (1993) 873–890 12. Attiya, H., Fouren, A.: Adaptive and efficient algorithms for lattice agreement and renaming. SIAM Journal on Computing 31(2) (2001) 642–664 13. Stupp, G.: Long Lived and Adaptive Shared Memory Implementations. PhD thesis, Department of Computer Science, Tel-Aviv University (2001) 14. Afek, Y., Boxer, P., Touitou, D.: Bounds on the shared memory requirements for long-lived adaptive objects. In: Proceedings of the 19th Annual ACM Symposium on Principles of Distributed Computing, New-York, ACM Press (2000) 81–89
Adapting to Point Contention with Long-Lived Safe Agreement
23
15. Attiya, H., Fich, F., Kaplan, Y.: Lower bounds for adaptive collect and related problems. In: Proceedings of the 23rd Annual ACM Symposium on Principles of Distributed Computing. (2004) 60–69 16. Afek, Y., Dauber, D., Touitou, D.: Wait-free made fast. In: Proceedings of the 27th ACM Symposium on Theory of Computing, New-York, ACM Press (1995) 538–547 17. Herlihy, M., Luchangco, V., Moir, M.: Space- and time-adaptive non-blocking algorithms. In: Electronic Notes in Theoretical Computer Science. Volume 78., Elsevier (2003) 18. Afek, Y., Stupp, G., Touitou, D.: Long-lived adaptive splitter and applications. Distributed Computing 15(2) (2002) 67–86 19. Attiya, H., Fouren, A., Gafni, E.: An adaptive collect algorithm with applications. Distributed Computing 15(2) (2002) 87–96 20. Anderson, J., Kim, Y.J.: Adaptive mutual exclusion with local spinning. In: Proceedings of the 14th International Conference on Distributed Computing. (2000) 21. Attiya, H., Bortnikov, V.: Adaptive and efficient mutual exclusion. Distributed Computing 15(3) (2002) 177–189 22. Choy, M., Singh, A.K.: Adaptive solutions to the mutual exclusion problem. Distributed Computing 8(1) (1994) 1–17
Sensor Networks: Distributed Algorithms Reloaded – or Revolutions? Roger Wattenhofer Computer Engineering and Networks Laboratory ETH Zurich, 8092 Zurich, Switzerland [email protected]
Abstract. This paper wants to motivate the distributed algorithms community to study sensor networks. We discuss why sensor networks are distributed algorithms, and why they are not.
1 Introduction Wireless sensor networks currently exhibit an incredible research momentum. Computer scientists and engineers from all flavors are embracing the area. Sensor networks are adopted by researchers from hardware technology to operating systems, from antenna design to middleware, from graph theory to computational geometry. Information and communication theorists study fundamental scaling laws such as the capacity of a sensor network. Networking researchers propose new protocols for all layers of the stack. And for the database community, a sensor network essentially is – a database. The distributed algorithms community should join this big interdisciplinary party! Distributed algorithms are central since – in a first approximation – a sensor network can be modeled as a message passing graph. Hence there is hope that distributed algorithms can be either directly used for or at least adapted to sensor networks. In the last twenty years, distributed network algorithms have been a thriving theoretical research subject. So far however with limited influence on practice. Sensor networks may be a foremost application area of this vivid theory. Unlike other natural application areas such as the Internet or peer-to-peer/overlay networks, sensor networks are less prone to side effects such as selfish behavior of individual nodes, as generally the whole network is owned by a single entity.1 So, can we directly apply our distributed algorithms instruments when developing algorithms for sensor networks? In other words, are sensor networks nothing but distributed algorithms reloaded?! In this paper we study to what extent the wireless nature of sensor networks is changing the game. We identify and briefly discuss two modeling aspects for which we believe that sensor networks are fundamentally different from orthodox distributed algorithms. 1
Interestingly, the other camp of the distributed computing community which deals less with loosely-coupled networks and more with tightly-coupled multiprocessors (a.k.a. shared memory systems) is currently experiencing a similar impetus from the application domain with forthcoming multicore architectures.
P. Flocchini and L. Gasieniec ˛ (Eds.): SIROCCO 2006, LNCS 4056, pp. 24–28, 2006. c Springer-Verlag Berlin Heidelberg 2006
Sensor Networks: Distributed Algorithms Reloaded – or Revolutions?
25
First, we need a model which reflects a typical topology of a sensor network. Traditionally, a sensor network is modeled as a graph, representing nodes by vertices and wireless links by edges. Geometry comes into play as the distribution of nodes in space, and the propagation range of wireless links, usually adhere to geometric constraints. Several models inspired by both graph theory and geometry are possible; what model is right depends on the question analyzed. A media access study might need a detailed model capturing several low-level aspects. For instance, it has to be taken into account that a message may not be received correctly due to a near-by concurrent transmission. Hence, it is crucial that the model appropriately incorporates interference aspects. However, for a transport layer study, a much simpler model which assumes random transmission errors might be sufficient. In a recent survey [12], a whole zoo of models borrowing from both graph theory and geometry is presented, comprising classic models such as the unit disk graph or the signal-to-interference-plus-noise ratio, but also novel generalizations such as the bounded independence graph or the unit ball graph. These geometric graph models will probably influence the research on distributed network algorithms. For details, we refer the reader to [12]. Second, the very definition of a distributed algorithm is about to change when entering the sensor network domain. We believe that new algorithm types will emerge, and will influence the distributed algorithms community in the coming years. In the remainder of the paper, we briefly discuss possible directions of research.
2 Algorithms The distributed algorithms community has never been shy of models. We study message passing and shared memory systems, synchronous and asynchronous algorithms, Byzantine and selfish nodes, self-stabilization and failure-detection, to only name a few of the most typical modeling facets. In fact, what is (im)possible and/or (in)efficient in which model of distributed computation often outranks the importance of solving this or that problem in a specific model. Still, when it comes to sensor networks it seems that our abundance of models is not enough. Most algorithms for sensor networks proposed in literature are meant to be executed by the sensor nodes during the system’s operation. For example, when a node receives a message, it performs some (simple and local) computation, and—depending on the computation’s results—sends a new message to its neighbors. A node a priori only knows its own state. In order to learn more about the other nodes in the network, it has to communicate with its neighbors. By collaboration of the nodes, global operations such as (multi-hop) routing can be achieved. Since the activity is distributed among the nodes, these algorithms are called distributed algorithms [10]. Distributed algorithms raise many interesting research questions. For example: What can be computed in a distributed fashion, and what not? How efficient is a distributed algorithm compared to a corresponding global algorithm? Every (global) algorithm can easily be turned into a distributed algorithm: Simply centrally collect the distributed state, compute a global solution, and distribute this solution. However, this simple routine is often unreasonably pricey. Since sending and receiving messages are expensive operations in wireless networks (e.g., medium
26
R. Wattenhofer
access control, energy consumption), a reasonable distributed algorithm should minimize communication. This motivates the introduction of localized algorithms [5, 13].2 A localized algorithm is a special case of a distributed algorithm. Model 1 (Localized Algorithms). In a k-localized algorithm, for some parameter k, each node is allowed to communicate at most k times with its neighbors. A node can decide to retard its right to communicate; for example, a node can wait to send messages until all its neighbors having larger identifiers have reached a certain state of their execution. In spite of the restricted communication model, localized algorithms can be slow. A node u might have to wait for a neighbor v, while node v in turn has to wait for its neighbor w, etc. Thus, as a matter of fact there can be a linear chain of causality, with only one node being active at any time. This yields a worst-case execution time of Θ(n), where n is the number of nodes.3 If we do not want this linear running time, we need to resort to another model [8, 10]. Model 2 (Local Algorithms). In a k-local algorithm, for some parameter k, each node can communicate at most k times with its neighbors. In contrast to k-localized algorithms nodes cannot delay their decisions. In particular, all nodes process k synchronized phases, and a node’s operations in phase i may only depend on the information received during phases 1 to i − 1. The most efficient local algorithms are often randomized [7, 9]; that is, the number of rounds k can vary. Observe that in a k-local algorithm, nodes can only gather information about nodes in their k-neighborhood. In some local algorithms [7] the algorithm designer can choose an arbitrarily small constant k (at the cost of a lesser approximation ratio). This makes local algorithms particularly suited in scenarios where the nodes’ environment changes frequently, as the algorithm can constantly adapt to the new circumstances. However, due to the synchronous phases, local algorithms may make greater demands on the media access sub-layer than localized algorithms. In particular, in unreliable wireless networks it seems to be costly to implement a media access control scheme that allows for synchronous rounds, as messages will be lost due to interference (conflicting concurrent transmissions) or mobility (even if the nodes themselves are not mobile, the environment is typically dynamic, temporarily enabling/disabling links). Dealing with unreliability has always been a core interest of the distributed computing community. A powerful concept for coping with failures is self-stabilization [4]. Fortunately, using a simple trick [3], every local algorithm is immediately selfstabilizing. The trick works as follows (Section 4 of [3]): Every node keeps a log of every state transition it has taken until its current state; generally this boils down to memorizing the local variables of each step of the main loop. If each node constantly sends its current log to all neighbor nodes, each node can check and correct every transition it has made in the past. Assuming that all inputs are correct (variable initialization and random seeds are stored in the imperishable program memory, sensor information 2
3
To the best of our knowledge nobody has ever bothered to formally define what a localized algorithm is. However, all papers we are aware of implicitly use a model similar to Model 1. And many localized algorithm do exhibit this linear worst-case.
Sensor Networks: Distributed Algorithms Reloaded – or Revolutions?
27
can be re-checked) every fault due to memory or message corruption will be detected and corrected. For details we refer to [3]. Turning a k-local algorithm into a self-stabilizing algorithm with [3] blows up messages by a factor k (in the worst case); on the other hand we immediately get an algorithm which works on a sensor network as the hardest wireless problems (messages lost due to interference and mobility) are covered by the self-stabilization model. Also, in case of an error (such as a lost message), only the k-neighborhood of a node is affected.4 In practice, for some local algorithms the detour to self-stabilization may be costly, as the message overhead is prohibitive;5 instead we need models that integrate interference. One solution is the so-called unstructured radio network model [1, 2, 6] where the algorithm designer has to implement her own medium access scheme from scratch. Model 3 (Unstructured Radio Networks). In the unstructured radio network model time is divided into slots. In each time slot, each node can decide whether to transmit, listen (or sleep). If two conflicting nodes transmit simultaneously, a potential receiver cannot decode any message. Nodes are distributed in an arbitrary (worst-case) multihop fashion, and may wake-up asynchronously (also worst-case). The unstructured radio network model may be classified further, for example depending to what extent collisions can be detected by a receiver. The unstructured radio network model seems to fit practice well, especially if teamed up with a sensible topology/interference model such as signal-to-interference-plus-noise ratio or bounded independence graph [12]. Clearly, the slotted-time assumption is a simplification, however as usual the difference between slotted and unslotted can easily be bounded [11]. Unfortunately, unstructured radio network algorithms tend to be quite technical, as even higher-layer algorithms need to specify media access. We believe that there is room for novel models with more coarse-grained assumptions how the media is accessed. One might for example imagine a model abstracting away from media access, where an adversary schedules transmissions. It seems that this model only makes sense if the adversary is restricted appropriately, that is, if there are fairness guarantees. For example, the adversary might have to schedule each node at least once every Θ(n) rounds. Moreover, one could imagine an adversary which delivers a message only to a subset of a node’s neighbors, because the other neighbors experience collisions.
3 Conclusions This paper has presented and compared a subjective selection of algorithmic models. For other modeling aspects, we refer to [12]. We want to emphasize that there is no optimal model, and that an engineer has to choose the model which reflects her needs best. Generally, we believe that for efficiency considerations, a slightly idealistic model can be fine. However, when it comes to issues such as correctness of an algorithm, 4
5
In principle localized algorithms can also benefit from [3], however, errors are not restricted to a k-neighborhood but may propagate the whole network – we experience a troublesome butterfly effect. Currently the payload constant of a packet in TinyOS is 29 bytes.
28
R. Wattenhofer
it seems that a more pessimistic or conservative model should be preferred. In other words, a robust algorithm is also correct in a more general model than for which it has been studied or proven efficient.
Acknowledgments We would like to thank Stefan Schmid and Thomas Moscibroda for valuable discussions.
References 1. N. Abramson. The ALOHA System. In Computer-Communication Networks, Prentice Hall, 1973. 2. N. Alon, A. Bar-Noy, N. Linial, and D. Peleg. A Lower Bound for Radio Broadcast. In Journal of Computer and System Sciences, 1991. 3. B. Awerbuch and G. Varghese. Distributed Program Checking: A Paradigm for Building Self-stabilizing Distributed Protocols. In 32nd Annual IEEE Symposium on Foundations of Computer Science (FOCS), 1991. 4. E. W. Dijkstra. Self-stabilizing Systems in Spite of Distributed Control. In Communications of the ACM, 1974. 5. D. Estrin, R. Govindan, J. S. Heidemann, and S. Kumar. Next Century Challenges: Scalable Coordination in Sensor Networks. In Fifth Annual International Conference on Mobile Computing and Networking (MobiCom), 1999. 6. F. Kuhn, T. Moscibroda, and R. Wattenhofer. Initializing Newly Depoloyed Ad-hoc and Sensor Networks. In 10th Annual Intl. Conf. on Mobile Computing and Networking (MobiCom), 2004. 7. F. Kuhn, T. Moscibroda, and R. Wattenhofer. The Price of Being Near-Sighted. In ACMSIAM Symp. on Discrete Algorithms (SODA), 2006. 8. N. Linial. Distributive Graph Algorithms – Global Solutions from Local Data. In 28th Annual IEEE Symposium on Foundations of Computer Science (FOCS), 1987. 9. M. Luby. A Simple Parallel Algorithm for the Maximal Independent Set Problem. In SIAM Journal on Computing, 1986. 10. D. Peleg. Distributed Computing: A Locality-sensitive Approach. Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, 2000. 11. L. G. Roberts. Aloha packet system with and without slots and capture. In Computer Communication Review, 1975. 12. S. Schmid and R. Wattenhofer. Algorithmic Models for Sensor Networks. In 14th International Workshop on Parallel and Distributed Real-Time Systems (WPDRTS), Island of Rhodes, Greece, April 2006. 13. Y. Wang, X.-Y. Li, P.-J. Wan, and O. Frieder. Sparse Power Efficient Topology for Wireless Networks. Journal of Parallel and Distributed Computing, 2002.
Local Algorithms for Autonomous Robot Systems Reuven Cohen1 and David Peleg2,⋆ 1
Dept. of Electrical and Computer Eng., Boston University, Boston, MA, USA [email protected] 2 Dept. of Computer Science, Weizmann Institute, Rehovot, Israel [email protected]
Abstract. This paper studies local algorithms for autonomous robot systems, namely, algorithms that use only information of the positions of a bounded number of their nearest neighbors. The paper focuses on the spreading problem. It defines measures for the quality of spreading, presents a local algorithm for the one-dimensional spreading problem, prove its convergence to the equally spaced configuration and discusses its convergence rate in the synchronous and semi-synchronous settings. It then presents a local algorithm achieving the exact equally spaced configuration in finite time in the synchronous setting, and proves it is time optimal for local algorithms. Finally, the paper also proposes an algorithm for the two-dimensional case and presents simulation results of its effectiveness.
1
Introduction
1.1
Background and Motivation
Swarms of low cost robots provide an attractive alternative when facing various large-scale tasks in hazardous or hostile environments. Such systems can be made cheaper, more flexible and potentially resilient to malfunction. Indeed, interest in autonomous mobile robot systems arose in a large variety of contexts (see [3, 4, 11, 13, 14, 15, 16, 21] and the survey [5]). Along with developments related to the physical engineering aspects of such robot systems, there have been recent research attempts geared at developing suitable algorithmics, particularly for handling the distributed coordination of multiple robots [2, 6, 17, 19, 20]. A number of computational models were proposed in the literature for multiple robot systems. In this paper we consider the model of [2, 19]. (An alternative, weaker, model is found in [6, 9, 18].) In this model, the robots are assumed to be identical and indistinguishable, lack means of communication, and operate in discrete cycles. Each robot may wake up at each of these cycles, and make a move according to the locations of the other robots in the environment. The moves are assumed to be instantaneous. ⋆
Supported in part by a grant from the Israel Science Foundation.
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 29–43, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
30
R. Cohen and D. Peleg
The model also makes the assumption that the robots are oblivious, i.e., have no memory and can only act according to a calculation based only on the their last observation of the world. Oblivious algorithms have the advantage of being self-stabilizing (i.e., insensitive to transient errors and to the addition or removal of robots) and are also usually simple to design and implement. Algorithms were developed in the literature for a variety of control problems for robot swarms [2, 6, 9, 11, 17, 18, 19, 20]. Most of those algorithms, however, require the robots to perform “global” calculations in each cycle, relying on the entire current configuration. For example, algorithms for the gathering problem, which requires the robots to gather at one point, typically instruct each robot to calculate the goal point to which it should move based on the exact locations of all the other robots in the current configuration. This calculation can be fairly simple and require only linear time (e.g., computing the average location of the robots), but in some cases involves a more complex computation, such as finding the smallest enclosing circle or the convex hull of the robots. Moreover, for very large swarms, and when each robot operates in fast short cycles, even a linear time computation per cycle may be too costly. A similar difficulty may arise when the task at hand involves coordinated movement in a certain direction while avoiding collisions, or evenly spreading the robot swarm in a given area. The current paper addresses the issue of local and simple algorithms for control and coordination in robot swarms. It may be instructive to turn to the metaphor of insect swarms, and consider the way such problems are managed. It would appear that in a large swarm of bees, for instance, an individual bee would not calculate its next position based on the exact positions of all other bees. Rather, it is likely to decide its course of movement based on the positions and trajectories of a few nearby bees forming its immediate neighborhood. This local information is often sufficient to allow the individual insect to plan its movement so as to follow its swarm, avoid collisions and so on. Such policy would lead to a much “lighter” calculation, which can be carried out more frequently and effectively. This analogy thus motivates the idea of exploring the behavior and performance of local, or “light-weight” algorithms for controlling a swarm of robots. Such algorithms have several obvious advantages over their more traditional “global” counterparts, in simplicity, computational complexity, energy consumption and stability. They also have the advantage of being applicable in a “limited visibility” model, where each robot sees only its close vicinity. An enabling prerequisite is that each robot be equipped with a mechanism enabling it to efficiently obtain as input information about its locality, i.e., its immediate neighbors. (Clearly, if the robot’s input device is designed so that its input consists a global picture of the configuration, and the robot’s neighborhood can only be deciphered by going through this entire picture and performing complex calculations, then the robot might as well perform a global algorithm on its input). In particular, a robot equipped with a sonar may be able to first detect nearby objects. If the input to the robot is in the form of a visual image, then it may be necessary to have a scanning algorithm on the image, sweeping
Local Algorithms for Autonomous Robot Systems
31
the image from the point of the robot outwards, thus hitting the nearby robots first. The scan can be terminated after identifying the immediate neighbors. Hereafter we will ignore this issue, and assume that a suitable input mechanism exists, efficiently providing the robot in each cycle with a concise and accurate description of its immediate neighborhood. In this paper we explore the “light-weight” approach to robot swarm control through the concrete example of the robot spreading problem. In this problem, N robots are initially distributed in the plane, and the goal is to spread them “evenly” within the perimeters of a given region. To consider methods for spreading one should first define a criterion for the quality of spreading of a given robot distribution. For the one-dimensional case this is easy, as the best configuration is clearly the equal spacing arrangement on the line, and all other configurations can be compared to this one. Quantitative measures for the spreading quality are presented in Section 2. In higher dimensions even the definition of the spreading quality becomes more difficult, as different criteria may be devised. One may consider, to list but a few examples, the minimum distance over all robot pairs, the average distance between each robot and its nearest neighbor, or the time needed to reach the point most distant from any robot. The choice of a definition may also depend on the motivation for the application of the spreading algorithm. The definition we use here is the average over all robots of the minimum distance to the nearest “object”, dav =
1 min {di,j } , N i j =i
where the objects considered in taking the minimum are all other robots and all points of the perimeter of the region. We discuss two timing models for the robot operations. In the F SYN C (synchronous) model, it is assumed that the robots operate in cycles, where all robots operate in each cycle, i.e. take a snapshot of their surroundings, run their algorithm on the snapshot, and move accordingly. In the SSYN C (semi-synchronous) model, the robots are again assumed to operate in cycles. However, not all robots are active in every cycle. The activation schedule is assumed to be determined by an adversary, but it is guaranteed that every robot is activated an infinite number of times. When the robots share a common orientation and the model is synchronous the task of spreading via a global algorithm is quite easy. A simple solution can be obtained by agreeing on an ordering (such as top-to-bottom and then leftto-right) and deciding on each robot’s final location accordingly. This solution can be applied even in asynchronous settings if the movements of each robot are restricted so as to preserve the ordering. When only local information is used, it is difficult to prevent the swarm from converging to a non-optimal configuration, which is locally optimal for almost all robots. This phenomenon is well known in physical systems, e.g., such “defects” are known to determine many of the crystal’s properties, as well as in artificial intelligence search, where finding the optimal state is difficult when many local minima exist.
32
R. Cohen and D. Peleg
Another advantage of global algorithms over local ones is the convergence rate or finishing time of the algorithm. It is easily seen that an algorithm based on ordering in a synchronous setting, will achieve the final position in a single step. A local algorithm will require at least O(N ) steps for the information to reach each of the robots, as proven below in Section 3. In this paper we present an oblivious local algorithm for spreading in one dimension. We prove its validity for the synchronous and semi-synchronous models and discuss its convergence rate. We also present a non-oblivious local algorithm for spreading in finite (and optimal) time, and discuss some of its shortcomings. We then describe a generalization of the first algorithm to two dimensions and present simulation results showing its behavior. We also discuss several other alternatives and their relative strengths and weaknesses. A related problem was studied by Dijkstra in [8]. There, n units labeled {0, 1, . . . , n − 1} are initially placed around a ring, and apply a rule whereby unit i moves to the middle point between units i − 1 and i + 1 (modulo n). It is shown therein that under this rule, the system might in certain cases oscillate and fail to converge, even in a synchronous setting. A discussion of a possible solution to this problem appears in [7]. 1.2
The Model
The basic model studied in [2, 20] can be summarized as follows. The N robots execute a given algorithm in order to achieve a prespecified task. Time is divided to discrete events, where in each of these events each robot may or may not be active, under the condition that each robot is activated an infinite number of times. Whenever a robot is activated it takes a snapshot of its surroundings, which is used as the input for the algorithm executed by the robot. The output of the algorithm is a destination point, to which the robot moves instantaneously. Following the common model in this area, the robots are assumed to be rather limited. To begin with, they have no means of directly communicating with each other. Moreover, they are assumed to be oblivious (or memoryless), namely, they cannot remember their previous states, their previous actions or the previous positions of the other robots. Hence the algorithm used in the robots’ computations cannot rely on information from previous cycles, and its only input is the current configuration. As explained earlier, while this is admittedly an over-restrictive and unrealistic assumption, developing algorithms for the oblivious model has the advantages of self-stabilization (i.e., the ability to recover from any finite number of transient errors) and suitability to dynamical settings, where robots are added and removed during operation. 1.3
Preliminaries
We review some properties of discrete Fourier transforms to be used in our analysis later on. The discrete sine transform: The discrete sine transform is appropriate for antisymmetric functions or alternatively, functions fixed to zero at both edges, which can be made antisymmetric by an appropriate continuation.
Local Algorithms for Autonomous Robot Systems
33
Consider the N − 2 vectors v¯k of dimension N − 2 defined componentwise by 2 sin ki, i = 1, 2, . . . , N − 2 , (vk )i = N −1 for k values from the range K = {k = Nmπ −1 | m = 1, . . . , N − 2}. We make use of the following known lemmas (proofs can be found in standard books on Fourier series or digital signal processing; see, e.g., [1]). Lemma 1. For k, q ∈ K, we have v¯k · v¯q = δk,q , where δ stands for Kroneker’s delta, i.e., δk,q = 1 if k = q and 0 otherwise. Corollary 1. The N − 2 vectors v¯k form an orthonormal basis to RN −2 . For a sequence of reals ηi , i = 0, · · · , N − 1, satisfying η0 = ηN −1 = 0, and for k ∈ K, one can define the discrete Fourier transform of η¯ as N −1 2 ηi sin ki. (1) μk = N − 1 i=0 The inverse transform is given by the following lemma. Lemma 2. ηj =
2 N −1
(N −2)π N −1
μk sin kj.
k= Nπ−1
The discrete cosine transform: The discrete cosine transform is widely used in digital signal processing. The version presented below is appropriate for symmetric functions, having a symmetry axis at x = −1/2. kˆiπ , for i, k ∈ {0, 1, . . . , 2m − 1}, Define the functions f (i, k) = A(i, k) cos m where hereafter ˆi = i + 12 , and √1 , k = 0, m A(i, k) = 1 √ , otherwise. 2m We bring the following without proof. 2m−1 Lemma 3. (1) i=0 f (i, k)f (i, q) = δk,q ,
(2)
2m−1 k=0
f (i, k)f (j, k) = δi,j .
Suppose now that ηi , i = 0, . . . , 2m − 1 is a sequence ofnumbers with ηi = η2m−1−i , and define the transformed sequence μk = i ηi f (i, k) for k = 0, . . . , 2m − 1. Lemma 3 implies the following. Corollary 2. ηi = k μk f (i, k). Let φ(j, k, q) =
2m−1
f (i, k)f (i + j, q).
i=0
Lemma 4. φ(i, k, q) = δk,q cos jqπ m .
34
2 2.1
R. Cohen and D. Peleg
A Local Spreading Algorithm in One Dimension The Algorithm
A swarm of N robots are positioned on a line. The aim is to spread the robots along this line with equal spacing between each pair of adjacent robots, where the size of the occupied segment is determined by the positions of the leftmost and rightmost robots. One may assume, instead, that the leftmost and rightmost positions represent some perimeter marks rather than robots. Each robot uses its own coordinate system. However, since the algorithm, presented below, is linear, any coordinate system will give the same resulting destination. Therefore, we use an external, global coordinate system, on which the robots have no knowledge. We refer to the robots according to their order on the line, and denote the position of each robot i, 0 ≤ i ≤ N − 1, at time t, in this global coordinate system by Ri [t]. The local algorithm for spreading in constant distances operates as follows. Algorithm Spread (Code for robot i) If no other robot is seen on the left or on the right then do nothing. i−1 . Otherwise, move to the point Ri+1 +R 2 2.2
The F SYN C Model
We now turn to prove the convergence of Algorithm Spread. We choose the global coordinate system such that R0 [t] = 0 and RN −1 [t] = 1 for all t (since the external robots do not move). As the goal is to spread the robots uniformly, upon termination the ith robot should be placed in position i/(N − 1). Define ηi [t] as the shift of the ith robot’s location at time t from its final designated position, namely, i ηi [t] = Ri [t] − . N −1 As our progress measure we define the quantity ψ[t] =
N −1
ηi2 [t] ,
i=0
where by definition, η0 [t] = ηN −1 [t] = 0 for all t. By executing the algorithm, the position of a robot changes to Ri [t + 1] =
Ri−1 [t] + Ri+1 [t] , 2
hence for 1 ≤ i ≤ N − 2, the shifts change with time as ηi [t + 1] =
ηi+1 [t] + ηi−1 [t] . 2
We now turn to prove our main lemma.
(2)
Local Algorithms for Autonomous Robot Systems
35
Lemma 5. For N robots executing Algorithm Spread in the F SYN C model ψ[t] is a decreasing function of t unless the robots are already equally spread (in which case it remains constantly zero). Proof. Eq. (2) gives the change in η in every time step. The value of ψ thus changes to N −2 1 (ηi+1 [t] + ηi−1 [t])2 . ψ[t + 1] = 4 i=1 The decrease in ψ is therefore N −2 1 1 2 2 (ηi+1 [t] − ηi−1 [t])2 , ψ[t] − ψ[t + 1] = (η1 [t] + ηN −2 [t] ) + 4 4 i=1
which is a positive quantity, proving the lemma. Theorem 1. For N robots executing Algorithm Spread in the F SYN C model: 1. Every O(N ) cycles, ψ[t] is at least halved. 2. The robots converge to a point. Proof. The equations for the shift changes of the robots are given in Eq. (2) for all 0 < i < N − 1. Denote by μk the Fourier (Sine) series as defined in Eq. (1). By Eq. (1) and Lemmas 2 and 1, ψ[t] =
ηi2 [t] =
i
2 μk [t]μq [t] sin ki sin qi N −1 i,k,q
2 N −1 δk,q = = μ2k [t]. μk [t]μq [t] N −1 2 k,q
(3)
k
Similarly, applying the transform (1) to the linear equation array (2) and noting that η0 [t] = ηN −1 [t] = 0 for all times, t, yields
N −2 1 sin ki(ηi−1 [t] + ηi+1 [t]) 2(N − 1) i=1 N −3 N −1 1 1 = sin k(j + 1)ηj [t] + sin k(j − 1)ηj [t] 2(N − 1) j=0 2(N − 1) j=2 N −1 N −1 1 1 = sin k(j + 1)ηj [t] + sin k(j − 1)ηj [t], 2(N − 1) j=0 2(N − 1) j=0
μk [t + 1] =
where the two terms added to each sum at the last line are zero as sin k · (N − 1) = sin k · 0 = 0, and η0 [t] = ηN −1 [t] = 0. Using the fact that sin k(i ± 1) = sin ki cos k ± sin k cos ki, we get
36
R. Cohen and D. Peleg
μk [t + 1] =
=
N −1 1 (sin k(j + 1) + sin k(j − 1))ηj [t] 2(N − 1) j=0 N −1 1 2 sin kj cos kηj [t] 2(N − 1) j=0
= cos k · μk [t]. Hence, by Eq. (3), ψ[t + 1] =
μ2k [t + 1] =
k
(cos kμk [t])2 =
k
cos2 k · μ2k [t].
(4)
k
−2) π c The values of k are k = Nπ−1 , . . . , π(N N −1 . The largest factor is cos N −1 ≈ 1 − N for constant c > 0, hence by (4) and using (3) again, we get that
ψ[t + 1] ≤
1−
k
Thus, ψ is at least halved every 2.3
c 2 c 2 2 ψ[t]. μk [t] ≤ 1 − N N ln 2 2c N
steps, proving the claim.
The SSYN C Model
We now turn to the SSYN C model. In the SSYN C model we can no longer assume that all robots move at each time step. Therefore, when looking at the robots moving at some time step we can no longer assume that the robots at the boundary of the moving group are located at their final designated position. Thus, the subsequent analysis employs the cosine series rather than the sine series, since the cosines allow for a constant displacement term (because cos 0 = 0 = sin 0). Our rational for proving convergence is as follows. We first introduce a nondecreasing quantity and prove its monotonicity. To prove that it decreases by a constant factor, we need to show that the presented quantity is related to the non-constant terms of the cosine series. This is done in Lemmas 7–9. Finally, in Theorem 2, we show that the non-constant terms are decreased by a constant factor on every round, proving convergence. For i = 1, . . . , N − 1, define the robot gaps as the quantities γi [t] = ηi [t] − ηi−1 [t]. For each robot moving in the tth step, the equation for its position is given in (2). For any time step t, the moving robots can be grouped into chains, each of which is bounded by two stationary robots. Since the chains have no effect on each other, each can be handled separately. Consider one such chain consisting of m − 1 moving robots, which we number 1, . . . , m − 1 regardless of their real numbering. The boundary stationary robots
Local Algorithms for Autonomous Robot Systems
37
will be numbered 0 and m. The appropriate equations for the gaps between them are ⎧ γ1 [t]+γ2 [t] ⎪ , j = 1, ⎪ 2 ⎪ ⎪ ⎪ ⎨ j−1 [t] γj [t + 1] = γj+1 [t]+γ , j = 2, . . . , m − 1, 2 ⎪ ⎪ ⎪ ⎪ ⎪ ⎩ γm [t]+γm−1 [t] , j = m. 2
To simplify this, we define virtual robots for every integer j outside the range [0, N − 1], and extend the definition of γ to every j outside [0, N − 1] by requiring that γj = γj+2m , and γj = γ−j+1 for every j. Using this definition, γ0 = γ1 and γm+1 = γ−m+1 = γm . Therefore the equations take a simpler form γj [t + 1] =
γj+1 [t] + γj−1 [t] , 2
for every j .
(5)
Define the Fourier transform of γj to be ǫk for k = 0, . . . , 2m − 1 satisfying 2m−1
γj [t] =
ǫk [t]f (j, k) ;
ǫk [t] =
n=0
2m−1
γj [t]f (j, k)
n=0
We now define the quantity ϕ[t] =
N −1
γj2 [t] .
j=1
Lemma 6. In the SSYN C model ϕ[t] is a non-increasing function of t. Proof. Apply the transform to Eq. (5) to obtain ǫk [t + 1] =
m−1
γj [t + 1]f (j, k)
j=0
=
2m−1 j=0
=
2m−1
f (j, k) 2 cos
p=0
2m−1
f (j + 1, p)ǫp [t] +
p=0
2m−1
f (j − 1, p)ǫp [t]
p=0
pπ kπ δp,k ǫp [t] = cos ǫk [t] , m m
(6)
where the last line uses Lemma 4. Now, from the orthogonality of the functions f (j, k) (Lemma 3) it follows that m−1
γj2 [t] =
j=0
2m−1 2m−1 1 2 1 2 γj [t] = ǫk [t]. 2 j=0 2 k=0
By Eq. (6), 2m−1 k=0
ǫ2k [t + 1] =
2m−1 k=0
ǫ2k [t] cos2
2m−1 kπ ≤ ǫ2k [t]. m k=0
38
R. Cohen and D. Peleg
Since the sum of terms for the moving robots decreased, and the other terms were not affected, ϕ could not increase. For a chain of robots 0, . . . , m, define γmax [t] = maxj∈{1,...,m−1} γj [t] and γmin [t] = minj∈{1,...,m−1} γj [t] Lemma 7. For a chain of robots moving at time t, [γmin [t + 1], γmax [t + 1]] ⊆ [γmin [t], γmax [t]]. Proof. By Eq. (5) each new value is the average of two old ones. For the entire group of robots define Γi to be the ith smallest value of the γj ’s. Γmax [t] = ΓN −1 [t] = maxj∈{1,...,N −1} γj [t] and Γmin [t] = Γ1 [t] = minj∈{1,...,N −1} γj [t]. Lemma 8. There exists 0 < i < m such that (Γi [t] − Γi−1 [t])2 ≥ ϕ[t] N3 . −1 Proof. By the definition, N j=0 γj [t] = 0, and therefore, Γmax [t] ≥ 0 ≥ Γmin [t]. Thus, for every i γi [t] ≤ Γmax [t] + Γmin [t] and ϕ[t] ≤ (N − 1)(Γmax [t] + Γmin [t]). N −1 Now, ΓN −1 [t] − Γ1 [t] = j=2 Γj [t] − Γj−1 [t], so there must exist some i such that Γmax [t] + Γmin [t] Γmax [t] − Γmin [t] ≥ . Γi [t] − Γi−1 [t] ≥ N −2 N −2 Therefore, (Γi [t] − Γi−1 [t])2 ≥
ϕ[t] N3 .
Lemma 9. For a chain of gaps, 0, . . . , m − 1 with γmax [t] − γmin [t] ≥ c, ǫ20 [t] + 2m−1 2 c2 k=0 ǫk [t]. 2 ≤ 1 Proof. By definition ǫ20 [t] = 2m ( Γi [t])2 ≤ i γi2 [t]. Denote γs [t] = γmax [t] = a + b and γp [t] = γmin [t] = a − b, with b ≥ c/2. The sequence with γs [t] and γp [t] replaced by a will have the same ǫ0 [t] since the average remains the same. However γi2 [t] = γi2 [t] + (a − b)2 + (a + b)2 = γi2 [t] + 2a2 + 2b2 ≥ ǫ20 [t] + 2b2 . i
i=s,p
i=s,p
Since b ≥ c/2 the lemma follows. Theorem 2. In the SSYN C model N robots executing Algorithm Spread will converge to a configuration with equal distances. Proof. For a time t take Δ[t] = maxj (Γj [t] − Γj−1 [t]) and g = arg maxj (Γj [t] − Γj−1 [t]). By Lemma 8, Δ2 [t] > ϕ[t]/N 3 . Define the sets of gaps A = {i|γi [t] ≥ Γg [t]} and B = {i | γi [t] ≤ Γg−1 [t]}. Suppose that t′ ≥ t is the first time a robot i, such that one of its neighboring gaps is of set A and the other of set B makes a move. For as long as no robot sitting between a gap in A and a gap in B is activated no gap can leave either set, by Lemma 7 and therefore Γg [t∗ ] − Γg−1 [t∗ ] ≥ Γg [t] − Γg−1 [t] for t ≤ t∗ ≤ t′ .
Local Algorithms for Autonomous Robot Systems
39
Denote by C = {. . . , i, i + 1 . . .} the chain of gaps surrounding robot i that √ ϕ[t′ ] change at time t′ . By Lemma 8 |Γi [t′ ] − Γi−1 [t′ ]| ≥ N 3/2 and therefore √
ϕ[t′ ]
′
] 2 max(|Γi [t′ ]|, |Γi−1 [t′ ]|) ≥ 2N 3/2 , leading to max(Γi2 [t′ ], Γi−1 [t′ ]) ≥ ϕ[t 4N 3 . Now, ′ ϕ[t ] 2 ′ 2 ′ 2 ′ 2 i∈C γi [t ] ≥ max(Γi [t ], Γi−1 [t ]) ≥ 4N 3 . Consider the change to i∈C γi af′ ter step t . Again, we number the gaps in C by j = 0, . . . , m − 1 and complete with virtual robots. We have 2m−1
γj2 [t′ + 1] =
j=0
For all k > 0,
2m−1
ǫ2k [t′ + 1] =
k=0
2m−1 k=0
cos2
kπ 2 ′ ǫ [t ]. m k
π ≤ cos2 m = O 1 − m12 ≤ O 1 − N12 . ϕ[t′ ] 2 ′ k=0 ǫk [t ] ≥ N 3 and by the above, whenever
cos2 kπ m
an appropriate By Lemma 9 robot makes a move the terms ǫk , k = 0 are decreased by O(1/N 2 ), therefore, ϕ is decreased by O(1/N 5 ) at timestep t′ . By Lemma 6 ϕ[t′ ] ≤ ϕ[t]. The theorem follows.
3
An Exact Global Algorithm in One-Dimension
Assuming each robot knows the number of robots at each of its sides (i.e., robot 1 ≤ i ≤ N knows it is the ith robot in the line), it is possible to achieve the goal state after a finite number of steps using the following algorithm. Algorithm Fast_Spread (Code for robot i) 1. t ← 1. i−1 , and set t ← t + 1. 2. While t < N − 2, move to the point Ri+1 +R 2 3. If t = N − 2 then solve the linear equation array Eq. (7) and move to the point (x1 [0] + xN [0]) Ni−1 −1 . We assume each robots designates its coordinate center at the point where it starts the algorithm. We first define the equation array: t t xi±1+2j−t [0] xi±1 [t] = (7) xi [0] = 0 ; j 2t j=0 We now show that Algorithm Fast_Spread guarantees reaching the wanted position after exactly N − 2 moves. Lemma 10. The equation array (7) for a fixed 1 < i < N , in conjunction with the data of the robot’s neighbors xi±1 [t] at times t = 0, 1, . . . , N − 3 provides a unique solution for x1 [0], . . . , xN [0]. Proof. Look at the set of equations for xi [0], xi−1 [t] for t = 0, 1, . . . , i − 2 and xi+1 [t] for t = 0, 1, . . . , N − i − 1. This set includes exactly N equations in N unknowns. The equations are independent since for each time t0 there is a nonzero coefficient that was zero for all times t < t0 . Therefore, a unique solution exists.
40
R. Cohen and D. Peleg
Theorem 3. In the F SYN C model N robots executing algorithm Fast_Spread will reach their exact final position after N − 2 steps. Proof. By Lemma 10 each robot can deduce the position of all other robots after N − 3 steps. Afterwards it can solve an array of linear equations (7) and deduce its final position, which it will assume in the last step. Theorem 4. In the SY N model the algorithm Fast_Spread achieves the fastest possible convergence to the final position. Proof. Since each robot can only see its nearest neighbors, and no communication is allowed, no information of the positions of the external robots can move more than one robot per move. At the beginning, each robot has information on its own position and its nearest neighbors. After the j step it has information on its j + 1st nearest neighbors. Therefore, at least N − 3 steps are needed for the 2nd and N − 2st robots to get information on the position of the most distant robots, and another move to achieve their final position. Notice, however, that the coefficient of ηj [0] in the linear equations obtained by robot k is proportional to 2−|j−k| . Therefore, the information accuracy decays exponentially quickly with the distance, and thus is hardly usable in any reasonable model of finite accuracy robots.
4
Local Spreading in Two Dimensional Space
In two dimensions the task of spreading via a local algorithm becomes more complicated. The set of nearest neighbors is of undetermined size, as even with no articulation points, a robot may have all other robots at an equal distance. Furthermore, the boundaries of the region in which the robots may spread cannot be efficiently marked by robots in a local manner. To simplify the situation we assume that the robots are confined to the region [0, 1]× [0, 1], and that the walls of this region are visible by the robots and serve as detractors. Furthermore, we assume the robots share the same orientation, where the axes parallel the walls. The algorithm is based on each robot, i, dividing space into four quadrants, Q0 to Q3 , according to the orientation (see Fig. 1). In our simulation the quadrant boundaries were taken to lay in an angle of 45◦ to the axes to simplify the treatment of walls. This, assumption, however, should not be relevant to the results. Objects situated on the dividing lines may be considered, for instance, to belong to the lower numbered quadrant. To illustrate the behavior of local algorithms for achieving spreading in two dimensions, we introduce an algorithm, named Spread_2d, in the spirit of the 1-dimensional Algorithm Spread presented above, and present empirical results indicating that this algorithm converges to a good approximation of the equal spacing spreading. Let us remark that an inetresting alternative approach to the problem follows from reversing the gathering technique presented in [10], for a slightly different continuous model.
Local Algorithms for Autonomous Robot Systems
41
Q1 Q3
m1 m3 m2
Q0 m0
Q2
Fig. 1. The four quadrants of a robot’s view. Here mq = m2
Algorithm Spread_2d (Code for robot i) For j = 0, . . . , 3 do: (a) mj ←coordinate of nearest robot or perimeter point in quadrant Qj . (b) dj ← dist(i, mj ). q ← arg minj {dj }; dmin = minj {dj }; dopp = d3−q ; d −dopp Move away from current location by min 2dmin mq . Notice that in Algorithm Spread_2d an object may be either a robot or (the nearest point of) the perimeter. To study the behavior of Algorithm Spread_2d simulations were conducted under various circumstances. We define the parameter dav =
1 min {di,j } , N i j =i
where the minimum is taken over all other robots and all points on the perimeter of the region. The behavior of this parameter, used as an indication of the spreading efficiency, was studied as a function of time. In an equally spaced √ 1 square grid formation of the robots, the value of the parameter is dopt . av = N +1 This value can be used as an indication of the optimal spreading. Fig. 2 presents the behavior of dav under Algorithm Spread_2d as a function of time. The optimal value for this number of robots is dopt av = 0.1 and, as can be seen, the system saturates at a value close to the optimum. Fig. 3 presents the locations of the robots at the initial and final states of the algorithm application. One may consider other generalizations of the one-dimensional algorithm to two dimensions. One such possible algorithm is based on moving to the average position of the four nearest robots (one in each quadrant). Our experiments show that this algorithm saturates quickly to a configuration which may sometimes be very far from the optimal. Another possible algorithm may rely on each robot calculating its Voronoi cell and moving to its center (according to some measure). This algorithm has the problem of failing the locality criterion, since in the worst case some of the robots may need to consider Ω(N ) other robots in order to calculate their Voronoi cell. The analysis of this algorithm is also difficult, since the robots movement may change the entire structure of the Voronoi diagram such that the Voronoi neighbors of a robot may change from cycle to cycle. An approximation for this method may be obtained by using θ-graphs [12],
42
R. Cohen and D. Peleg dav 0.1
0.08
0.06
0.04
0.02
0 0
100
300 steps
200
Fig. 2. Results of the simulation of algorithm Spread_2d with N = 81 robots. The dashed line is for the FSYN C timing model. The solid line is for the SSYN C timing model with each robot having probability 1/2 for moving at each step. 1
1 0.9
0.8
0.8 0.7 0.6
0.6
0.5 0.4
0.4
0.3 0.2
0.2
0.1 0
0
0.1
0.2
0.3
(a)
0.4
0.5
0.6
0.7
0.8
0.9
0
1
0
0.2
0.4
0.6
0.8
1
(b)
Fig. 3. (a) The initial location of the robots, selected randomly in the region [0, 0.5] × [0.2, 0.5]. (b) The final locations of the robots, taken after 1000 steps.
which guarantees that each robot has exactly 2π/θ neighbors, thus guaranteeing locality. The algorithm Spread_2d may be considered as such an approximation with θ = π/2. It should also be noted that Algorithm Spread_2d presented above, as well as any other algorithm, will fail to break symmetry when starting from some highly symmetrical configurations such as a line or a circle, which are very far from the optimal configuration. This problem can be overcome by adding randomness to the algorithm.
References 1. Ali N. Akansu and Richard A. Haddad. Multiresolution Signal Decomposition. Academic Press, San Diego, CA, USA, 1992. 2. H. Ando, I. Suzuki, and M. Yamashita. Formation and agreement problems for synchronous mobile robots with limited visibility. In Proc. IEEE Symp. of Intelligent Control, pages 453–460, August 1995.
Local Algorithms for Autonomous Robot Systems
43
3. T. Balch and R. Arkin. Behavior-based formation control for multi-robot teams. IEEE Trans. on Robotics and Automation, 14, December 1998. 4. G. Beni and S. Hackwood. Coherent swarm motion under distributed control. In Proc. DARS’92, pages 39–52, 1992. 5. Y.U. Cao, A.S. Fukunaga, and A.B. Kahng. Cooperative mobile robotics: Antecedents and directions. Autonomous Robots, 4(1):7–23, March 1997. 6. M. Cieliebak, P. Flocchini, G. Prencipe, and N. Santoro. Solving the robots gathering problem. In Proc. 30th Int. Colloq. on Automata, Languages and Programming, pages 1181–1196, 2003. 7. X. Defago and A. Konagaya. Circle formation for oblivious anonymous mobile robots with no common sense of orientation. In Proc. 2nd ACM Workshop on Principles of Mobile Computing, pages 97–104. ACM Press, 2002. 8. Edsger W. Dijkstra. Selected Writings on Computing: A Personal Perspective. Springer, New York, 1982. pages 34-35. 9. P. Flocchini, G. Prencipe, N. Santoro, and P. Widmayer. Hard tasks for weak robots: The role of common knowledge in pattern formation by autonomous mobile robots. In Proc. 10th Int. Symp. on Algorithms and Computation, 93–102, 1999. 10. N. Gordon, I.A. Wagner, and A.M. Bruckstein. Gathering multiple robotic a(ge)nts with limited sensing capabilities. In Proc. 4th Int. Workshop on Ant Colony Optimization and Swarm Intelligence, pages 142–153, September 2004. 11. D. Jung, G. Cheng, and A. Zelinsky. Experiments in realising cooperation between autonomous mobile robots. In Proc. Int. Symp. on Experimental Robotics, 1997. 12. J.M. Keil and C.A Gutwin. Classes of graphs which approximate the complete euclidean graph. Discrete computational Geometry, 7:13–28, 1992. 13. M.J. Mataric. Interaction and Intelligent Behavior. PhD thesis, MIT, 1994. 14. L.E. Parker. Designing control laws for cooperative agent teams. In Proc. IEEE Conf. on Robotics and Automation, pages 582–587, 1993. 15. L.E. Parker. On the design of behavior-based multi-robot teams. J. of Advanced Robotics, 10, 1996. 16. L.E. Parker, C. Touzet, and F. Fernandez. Techniques for learning in multi-robot teams. In T. Balch and L.E. Parker, editors, Robot Teams: From Diversity to Polymorphism. A. K. Peters, 2001. 17. G. Prencipe. CORDA: Distributed coordination of a set of atonomous mobile robots. In Proc. 4th European Research Seminar on Advances in Distributed Systems, pages 185–190, May 2001. 18. G. Prencipe. Distributed Coordination of a Set of Atonomous Mobile Robots. PhD thesis, Universita Degli Studi Di Pisa, 2002. 19. K. Sugihara and I. Suzuki. Distributed algorithms for formation of geometric patterns with many mobile robots. J. of Robotic Systems, 13(3):127–139, 1996. 20. I. Suzuki and M. Yamashita. Distributed anonymous mobile robots: Formation of geometric patterns. SIAM J. on Computing, 28:1347–1363, 1999. 21. I.A. Wagner and A.M. Bruckstein. From ants to a(ge)nts. Annals of Mathematics and Artificial Intelligence, 31, special issue on ant-robotics:1–5, 1996.
How to Meet in Anonymous Network Dariusz R. Kowalski1 and Adam Malinowski2,⋆ 1
2
Department of Computer Science The University of Liverpool Liverpool L69 7ZF, UK Instytut Informatyki, Uniwersytet Warszawski Banacha 2, 02-097 Warszawa, Poland
Abstract. A set of k mobile agents with distinct identifiers and located in nodes of an unknown anonymous connected network, have to meet at some node. We show that this gathering problem is no harder than its special case for k = 2, called the rendezvous problem, and design deterministic protocols solving the rendezvous problem with arbitrary startups in rings and in general networks. The measure of performance is the number of steps since the startup of the last agent until the rendezvous is achieved. For rings we design an oblivious protocol with cost O (n log ℓ), where n is the size of the network and ℓ is the minimum label of participating agents. This result is asymptotically optimal due to the lower bound showed in [18]. For general networks we show a protocol with cost polynomial in n and log ℓ, independent of the maximum difference τ of startup times, which answers in affirmative the open question from [22]. Keywords: mobile agents, gathering, rendezvous, anonymous networks, distributed algorithms.
1 Introduction We consider a gathering problem defined as follows: a set of k mobile agents originally located at arbitrary nodes of a network—modeled as an undirected connected graph— have to meet at some node. An important special case is the version for two agents, known as the rendezvous problem. If nodes of the graph are equipped with unique labels or the agents are allowed to save messages in nodes, then the problem gets significantly simpler and can be reduced to graph exploration. However, in many applications such facilities may not be available e.g. for technical or security reasons, which implies the need to design gathering protocols working in anonymous networks modeled by graphs with unlabeled nodes. We must assume however that ports at a node are locally distinguishable: otherwise two agents might be unable to meet even in a complete graph with four nodes K4 . Hence we make a natural assumption that all ports at a node are locally labeled 1, . . . , d, where d is the degree of the node (local labelings at different nodes do not have to be consistent in any way). Unless otherwise stated, we do not assume agents to know the topology of the graph or its size. We also assume that the agents have distinct identifiers—otherwise it is easy to see that deterministic gathering even in anonymous graph K2 (a clique of two nodes) is impossible. ⋆
Work supported by the KBN Grant 4T11C04425.
P. Flocchini and L. Gasieniec ˛ (Eds.): SIROCCO 2006, LNCS 4056, pp. 44–58, 2006. c Springer-Verlag Berlin Heidelberg 2006
How to Meet in Anonymous Network
45
1.1 Related Work Gathering is a very natural problem and it was considered in various settings, see e.g., [12, 13, 19, 21, 24, 28]. Even for the ring topology, the gathering problem is important due to its application to self-stabilization problem where, starting from an arbitrary state of the system, the goal is to recover into the legal single-agent state (see e.g., [21, 25]). Previous solutions considered either models with some additional information provided to agents, like sense of directions or a map of the network, or used randomization to break the symmetry of the anonymous network. A model similar to the one studied in this paper was considered in [29], but it still assumed some knowledge about the graph and the localization of agents. Randomized approach to gathering exploits random walks in graphs, which have been widely studied and applied in various contexts, such as graph traversing [2], on-line algorithms [15], etc. The special case of the gathering problem — the rendezvous problem — has been also extensively studied (see [5] for references). It was introduced in [27] and continued in two directions: geometric space [8, 9, 10, 11, 20] and graphs [3, 6]. Most of the papers, e.g., [3, 4, 7, 10, 21] adopted the probabilistic scenario where either inputs are random or protocols use randomization (or both). Deterministic rendezvous with anonymous agents working in unlabeled graphs but equipped with tokens used to mark nodes was considered e.g. in [23]). The so called hunter-rabbit game, in which one agent has to catch the other, was also considered, see [1] for recent results and references. De Marco et al. [17] considered the rendezvous problem in asynchronous networks. Unlike in our model, they allowed a meeting of two agents passing the same edge but in the opposite directions. Dessmark et al. [18] were the first to study the rendezvous problem in the model adopted in this paper. They designed protocols for trees, rings and general networks, both in simultaneous and arbitrary startup model, and established lower bounds on time complexity. We briefly describe their contribution focusing on the results corresponding strictly to the results presented in this paper. For simultaneous startup they proved that the optimal cost of rendezvous in any ring is Θ(D log ℓ), where D is the initial distance between agents. For arbitrary startup, they showed that Ω(n + D log ℓ) is a lower bound on the cost required for rendezvous on an n-node ring (since an adversary can make D = Θ(n), the worst-case lower bound—viewed as a function of n and ℓ—is Ω(n log ℓ)). They designed a rendezvous protocol for rings with cost O(ℓτ + ln2 ), where τ is the difference between startup times, if the agents do not know ring size n. They also proved that for arbitrary networks the problem is feasible. Kowalski and Pelc [22] presented a deterministic rendezvous protocol with cost polynomial in n, τ and log ℓ for arbitrary connected graphs, as well as a lower bound Ω(n2 ) on the cost of rendezvous in some family of graphs. 1.2 Our Results For the ring network topology we design an oblivious gathering protocol with cost
O (n log ℓ), which is asymptotically worst-case optimal due to the lower bound Ω(n log ℓ) showed in [18]. Note that this lower bound also holds for protocols which are adaptive and work in simultaneous startup model. In this sense we show that the problem for
46
D.R. Kowalski and A. Malinowski
rings with and without arbitrary startup has the same difficulty, as well as for adaptive and non-adaptive protocols. For general networks we show a gathering protocol with cost polynomial in n, log ℓ and not depending on τ, which answers in affirmative the question stated in [22]. Our protocol (as well as the one from [22]) is partly non-constructive: it uses some combinatorial objects which are only proved to exist by the probabilistic method. Nevertheless the protocol is in fact deterministic, since the agents can find the required combinatorial objects locally by brute force. This may be quite expensive but our model described below counts only moves of the agents and does not care about local computation time. 1.3 The Model The model we adopt is essentially the same as the one used in [18, 22], so we just give its brief description. The network is modeled as a simple undirected connected graph with unlabeled nodes. The ports at each node (i.e. the edges incident with the node) are labeled 1, . . . , d, where d is the degree of the node, but this labeling is only local and it does not have to be consistent with labelings of this node’s neighbors. The size of the network, denoted by n, is a-priori unknown to the agents. There are k agents in the network, where k is a-priori not known to the agents (although for the rendezvous problem we assume that the information that k = 2 is provided a-priori). Agents have distinct identifiers (labels), which are different integers written as binary strings. Every agent knows only its own label, which is the sole input to a gathering protocol it executes. Agents move in synchronous steps. In a single step, an agent may either remain idle or move to an adjacent node. Agents can exchange their informations iff they are in the same node at the same time step. The initial location of agents is arbitrary (i.e. decided by an adversary). During the execution of the protocol, if an agent currently located at some node decides to traverse some yet unexplored incident edge, the actual edge is chosen by an adversary. The agent, however, learns the local port number by which it enters a node and the degree of the node. Agents actually meet only if they get to the same node in the same step, not if they cross each other along an edge. We consider a general scenario with arbitrary startup, in which starting times of agents are arbitrarily decided by an adversary. Agents are not aware of the difference between starting times; each of them is created at its startup and begins executing its protocol and counting steps since then. The cost of a gathering protocol is the worst-case number of steps since the startup of the latest agent until gathering is achieved, taken over all mentioned above adversary choices of initial locations, unexplored edges and startup times. Time of local computations performed by agents does not contribute to cost. 1.4 Notation and Preliminaries Labels of agents are denoted by L1 , L2 , . . . , Lk , in the order of the startup times: agent with label Li appears not later than agent with label Li+1 . An agent knows only the value of its label Li , not its relative position i. The smallest of the considered labels L1 , . . . , Lk is denoted by ℓ and the difference between startup times of agents L1 and Lk is denoted
How to Meet in Anonymous Network
47
by τ. The number of nodes in the graph is denoted by n, and it is not known to the agents. For label L and integer r, let f (L, r) denote the string obtained by replacing each 0 r r in the binary representation of L with 04 14 and each 1 in a binary representation of r r L with 14 04 . Note that f (L, r) is partitioned into homogenous (only 0s or only 1s) blocks of size 4r , numbered from 1 to 2|L|. We say that one block is opposite to another if one of them is a block of ones while the other one is a block of zeros. For technical reasons we assume that |L| ≥ 16 (this can be achieved e.g. by adding 215 to all labels). We use f (L, r) to control the actions of agent L in stage r of our gathering/rendezvous protocols. Let Cr (L) denote the concatenation of strings for label L and stages 0, 1, . . . r, i.e. Cr (L) = f (L, 0) ⊔ f (L, 1) ⊔ · · · ⊔ f (L, r) . Each step of our protocols will correspond to a single bit in the infinite control string C∞ (L), thus we will identify time segments during the execution of the protocol with substrings of C∞ (L) and say, e.g., that some segment S is covered by block P (which means that the string corresponding to S is contained in P). The following lemma shows useful combinatorial properties of control strings (proof in the full version of the paper). Lemma 1. For any substring S of Cr (L), with |S| = 4r+1 , S contains at least 4r 0s and at least 4r 1s.
2 Gathering vs. Rendezvous Problem In this section we show that each rendezvous protocol can be easily modified to obtain gathering protocol with asymptotically the same time complexity. Given the rendezvous protocol R, each agent applies this protocol with the following modification: after some agents meet in a node, they all continue rendezvous protocol R for the smallest label from them, as it would be no rendezvous (we say that the agent with the smallest label sticks all the other agents met in this node). We call this protocol sticky-R protocol. Lemma 2. Each sticky-R protocol is a gathering protocol with the same asymptotic complexity as the original rendezvous protocol R for the same smallest label agent. Proof. Fix anonymous network G and starting nodes and times. Consider two executions: first is the worst-case execution of the sticky-R protocol for the smallest label ℓ, the second is the worst-case execution of the original rendezvous protocol R for the smallest label ℓ. It is clear that if the agent with label ℓ does not “stick” some other agent L in the gathering protocol then it also does not meet L in the rendezvous execution. ⊓ ⊔
48
D.R. Kowalski and A. Malinowski
3 Rendezvous in Rings In this section we assume that agents know that the underlying graph is a ring, although they do not know its size. An agent arbitrarily chooses one direction in the ring as ’left’ and the other as ’right’ (note that these assignments may be different for different agents). The starting direction for each agent is arbitrary. We present an asymptotically optimal rendezvous protocol which, by Lemma 2, also solves the gathering problem. (A similar idea was applied independently in an asynchronous setting in [17].) Protocol R ING -WALK (L) step_count ← 0 ∆←1 for stage ← 0, 1, . . . do T ← f (L, stage) for i ← 1, . . . , |T | do if T [i] = 1 then move to the next node in the current direction else remain idle for one step step_count ← step_count+1 if step_count= ∆ then change direction ∆ ← 2∆ Step counter determines when the direction of walk is changed and after how many steps ∆ it will happen; the interval between ith and (i+ 1)th change of direction is called period i + 1. Note that period i, for i ≥ 1, takes ∆ = 2i steps. The current value of ∆ at the beginning of a step is the period size of an agent in this step. It is straightforward to prove by induction on i that the period size in step k is exactly i for 2i ≤ k < 2i+1 . Now we prove that the R ING -WALK protocol guarantees fast rendezvous. Theorem 1. Two agents performing R ING -WALK protocol in a ring of size n meet after
O (n log ℓ) steps. Proof. Let i0 = ⌈log4 n⌉ and b = 4i0 (i0 is the number of the first stage with block size b ≥ n). First we note the general property which we will use in this proof: during any time segment which consists of at most eight blocks in the same stage i > 1 of agent L2 , each agent can change direction at most once. The proof of this fact is as follows. Fix stage i of agent L2 and segment S consisting of at most eight blocks of this stage. Since |L2 | ≥ 16, agent L2 executes at least 2|L2 |
4i − 1 ≥ 2 · 4i+1 3
steps by the end of stage i−1, which means that at the beginning of stage i its period size is at least 8 · 4i /2. If agent L2 changes its direction in S, its period size grows to at least 8 · 4i ≥ |S|, so it will not change again in S. The property for agent L1 is straightforward, since its period size is always not smaller than the current period size of agent L2 .
How to Meet in Anonymous Network
49
Now we proceed with the proof of the theorem, which is divided into three cases. Case 1: |L1 | > |L2 |. Let S be the time segment which consists of the first four blocks in stage i0 + 2 of agent L2 . Note that S has length 64b. We divide S into four succesive subsegments S1 , S2 , S3 , S4 , each consisting of 16b steps. Subcase 1a: at the beginning of segment S agent L1 is in stage bigger than i0 + 2 or in one of its last two blocks of stage i0 + 2. If agent L1 is in stage bigger than i0 + 2 at the beginning of segment S then it can change its block at most once in S, and so at least one block of agent L2 in S is covered by an opposite block of agent L1 . This is also true when agent L1 is in one of its last two blocks of stage i0 + 2 at the beginning of S, because then the first block in stage i0 + 3 of agent L1 covers S3 and S4 , so it is opposite to one of them (the third and the fourth blocks of a stage are always opposite to each other, so any block is opposite to one of them). Summing up, we proved that S contains a subsegment of size 16b in which one agent is idle and the other is moving. Since the period size of both agents is at least 8b, the moving agent can change direction at most once in this subsegment, so it makes at least 8b > n consecutive moves in one direction. Hence the rendezvous is achieved in S. Subcase 1b: at the beginning of segment S agent L1 is in stage i0 + 2, but neither in the last two blocks nor in the first two blocks. Let S′ consists of the last four blocks of stage i0 + 1 of agent L2 . Note that S′ has size 16b and ends just before S. Using similar argument as in Subcase 1a but applied to segment S′ , we conclude that the rendezvous occurs in S′ . More precisely, since |L1 | > |L2 | and at the end of S′ agent L1 is at least in the third block of stage i0 + 2, we see that S′ is covered by at most two blocks of size 16b from stage i0 + 2 of agent L1 . It follows that one of four blocks of agent L2 in S′ is covered by one opposite block of agent L1 . In time segment corresponding to this block of size 4b the moving agent can change its direction at most once, hence it makes at least 2b > n consecutive moves in one direction and the rendezvous is completed. Subcase 1c: at the beginning of segment S agent L1 is either in its stage i0 + 1 or in the first two blocks of its stage i0 + 2. Consider time segment S′ consisting of the first 640b steps in stage i0 + 5 of agent L2 . Since |L1 | > |L2 | and at the beginning of S agent L1 is at most in the second block of its stage i0 + 2, during segment S′ agent L1 is at least in its stage i0 + 1 (this is obvious since S precedes S′ ) and at most in its stage i0 + 4. Indeed, stages i0 + 2, i0 + 3, i0 + 4 of agent L1 take 2|L1 | · (16b + 64b + 256b) ≥ 2(|L2 | + 1) · 336b = 2|L2 | · 336b + 32b + 640b
steps, so even if we remove from stage i0 + 2 its first two blocks of total length 32b, the remaining part of stage i0 + 2 together with stages i0 + 3, i0 + 4 covers S′ . Segment S′ , which in fact is a part of the first block of stage i0 + 5 of agent L2 , contains blocks of size at least 4b and at most 256b of agent L1 , so there is a subsegment of S′ containing at least min{4b, 640b − 2 · 256b} = 4b
consecutive zeroes and another subsegment of S′ containing at least 4b consecutive ones of agent L1 . It follows that during one of these subsegments the agents are opposite, i.e.
50
D.R. Kowalski and A. Malinowski
one of them is idle and the other is moving. Since the considered subsegment has length 4b and is only a part of one block of agent L2 , the moving agent can change its direction at most once in this subsegment. Consequently during at least half of this subsegment the agent moves in one direction, while the other one is idle, hence the rendezvous is achieved. Subcase 1d: at the beginning of segment S agent L1 is in stage at most i0 . Note that stage i0 + 1 of agent L1 lasts 2|L1 | · 4b ≥ 2(|L2 | + 1) · 4b = 2|L2 | · 4b + 8b ≥ 136b > |S| steps, since |L1 | > |L2 | ≥ 16. It follows that during segment S agent L1 is in stage at most i0 + 1, while agent L2 is in one of the first four blocks of its stage i0 + 2. Consider the first block of zeros of agent L2 within segment S. Its length is 16b and it is covered by blocks from stages up to i0 + 1 of agent L1 , hence by Lemma 1 agent L1 moves in at least 4b steps within this block. S contains only four blocks of one stage of agent L2 , so each agent may change direction at most once within S (hence also within any subsegment of S). It follows that agent L1 makes at least 2b moving steps (perhaps separated with idle steps) without change of direction while agent L2 is idle. Hence agent L1 finds agent L2 during the considered block in segment S. To summarize Case 1, we proved in all subcases that the rendezvous happens by at i +6 most the end of stage i0 + 5 of agent L2 , which is by step 4 0 3 −1 · 2|L2 | = O (n log ℓ) after the startup of agent L2 . Case 2: |L1 | < |L2 |. Subcase 2a: τ ≥ 16b|L1 |. Consider time segment S of length 16b which begins 4b steps after the startup of agent L2 . At the beginning of S agent L1 is in stage at least i0 + 2, hence S is covered by at most two blocks of agent L1 . During this time segment the period size ∆1 of agent L1 is at least 16b and agent L2 changes direction twice: first after 4b steps and then after another 8b steps. It follows that S contains a subsegment S′ of length at least 4b covered by a single block of agent L1 and such that the directions of both agents agree in S′ . Agent L2 is in stage at most i0 during S′ , hence, by Lemma 1, the rendezvous is achieved in this segment. Subcase 2b: τ < 16b|L1 |. Consider the first block S of zeroes in stage i0 + 4 of agent L1 . Note that at the beginning of segment S agent L2 has period size at least 44 b − 1 44 b − 1 2|L1 | − τ ≥ 2|L1 | − 16b|L1| = 3 3 2 1 1 − − > 44 b/2 = |S|/2 , 44 b|L1 | · 3 3 · 44 b 42 4
since segment S starts at least 4 b−1 3 2|L1 |−τ steps after the startup of agent L2 . It follows that agent L2 can change direction in S at most once—otherwise the length of S would be at least twice the period size at the beginning of S, a contradiction. Consequently, agent L1 also may change its direction within segment S at most once (its period size is
How to Meet in Anonymous Network
51
the same or bigger). Note also that the current stage of agent L2 is never bigger than the one of agent L1 , hence at the end of segment S agent L2 is in stage i0 + 4 or less. First assume that at the end of segment S agent L2 is in stage at most i0 + 3. Agent L2 may change direction at most once in S, so, by Lemma 1, it makes at least 16b > n moving steps (perhaps separated with idle steps) without change of direction, while agent L1 is idle, so the rendezvous happens in segment S. Otherwise at the end of segment S agent L2 is in stage i0 + 4. We have ( f (L2 , i0 + 3) + τ) − f (L1, i0 + 3) > 2 · 4i0+3 , and two situations may happen: – if S is the first block in stage i0 + 4 of agent L1 then during the first 2 · 4i0+3 steps of S agent L2 is in its stage i0 + 3. It follows that during these steps agent L2 makes at least 43 b/2 > n moves without change of direction. – if S is the second block in stage i0 + 4 of agent L1 then consider the previous block S′ , which is the block of ones. During the first 2 · 4i0 +3 steps of S′ agent L2 is in stage i0 + 3. It follows that during at least 4i0 +3 /2 consecutive steps agent L2 is idle while the earlier one is moving and changes direction at most once. Consequently it makes at least 4i0 +3 /4 = 16b > n moves in one direction, so the rendezvous is achieved in S′ . Summarizing Case 2, in all subcases the rendezvous is achieved by the end of segi +5 ment S, which in both cases is at most 20b + 2|L1 | 4 0 3 −1 = O (n log ℓ) steps after the startup of agent L2 . Case 3: |L1 | = |L2 |. Subcase 3a: τ ≥ 8b. Consider time segment S consisting of the last eight blocks of stage i0 of agent L2 . During S agent L1 is already in stage at least i0 + 1, and the period size ∆ (for both agents) is at least 8b, hence by Lemma 1 during this segment there are b ≥ n consecutive steps in which one agent moves in one direction while the other remains idle, so the rendezvous is achieved. Subcase 3b: τ < 8b. Let j be the position of the first difference in code strings f (L1 , 0) and f (L2 , 0) of the agents and consider the j-th block of stage i0 + 2 of both agents. The block size is 16b and the delay is less than 4b, so the size of the maximal segment S covered by both these blocks is more than 12n. The period size ∆ (for both agents) is at least 16b, hence, by Lemma 1, during segment S there are b ≥ n consecutive steps in which one agent moves in one direction while the other remains idle, so the rendezvous is achieved. In view of the above theorem, the lower bound Ω(n log ℓ) for rendezvous obtained in [18], and Lemma 2, we have the following. Corollary 1. R ING -WALK is an asymptotically optimal agent protocol for gathering in unknown rings.
52
D.R. Kowalski and A. Malinowski
4 Gathering in Arbitrary Networks As in the previous section, we design a protocol for rendezvous problem, which automatically works also for the general gathering problem. 4.1 Cover Walks and Network Exploration In this subsection we present a generalization of the construction of deterministic cover walks [26], previously used e.g., in [22] in the context of the rendezvous problem. A walk of length x in a graph is a sequence (v1 , ..., vx ) of nodes such that node vi+1 is adjacent to vi , for all i < x. A cover walk is a walk in which every node of the graph appears at least once. Given an unknown network, we consider a markovian procedure which produces a walk in the network, i.e. a procedure in which the next move depends only on the number of previous moves and the degree of the currently visited node (ports are numbered but destination nodes have no labels). The aim of this subsection is to design a deterministic markovian procedure called UCW (short for Universal Cover Walk), consisting of λ(N) steps, where N is a given positive integer parameter and λ(N) is polynomial in N, which satisfies the following condition for some function γN (n) which is polynomial in n: Property UniCoverWalk. for any initial node of an anonymous graph with n ≤ N nodes, and for any step number a ≤ λ(N) − γN (n) + 1, the sequence of steps a, a + 1, . . . , a + γN (n) − 1 of the procedure yields a cover walk in this graph. Procedure UCW will be an important ingredient of our rendezvous protocol. Note that this procedure itself guarantees exploring in γN (n) steps, which means that a single agent visits all n nodes of anonymous network in every interval of γN (n) steps while executing this procedure. The existence of cover walks guaranteeing exploration of any n-node graph, for a known parameter n, is a well known fact (cf. [26]). Note that the problem of explicit construction of cover walks is hard (cf. hardness of construction of a universal traversal sequence even for 3-regular graphs [14]). Our universal cover walk differs in two points from the previously considered cover walks: – it works fast for all networks of any size n ≤ N, – it works even if we start in any point of the sequence and continue exploration from this point according to the following part of the sequence. Now we proceed with the construction of procedure UCW. We do it in two steps: first we construct procedure A LMOST UCW, which satisfies Property UniCoverWalk only for restricted range of parameters n ≤ N, and then we use it as a building block in construction of procedure UCW. Almost Universal Cover Walks. Let λ∗ (N) be a non-decreasing positive integer function, polynomial in N. For any positive integer N and any function hN : {1, ..., λ∗ (N)} × {1, ..., N − 1} −→ {1, ..., N − 1}, such that hN (i, d) ≤ d, we define the following generic procedure A LMOST UCW describing a walk of length λ∗ (N) in an anonymous n-node network G, for n ≤ N, starting at arbitrary node v (location v is unknown to the agent executing the procedure, but a particular walk defined by this procedure depends on v).
How to Meet in Anonymous Network
53
Procedure A LMOST UCW(N, hN ) In step i such that 0 < i ≤ λ∗ (N), the agent, currently located at a node of degree d, moves to an adjacent node by port hN (i, d). In order to instantiate the procedure A LMOST UCW we have to define functions hN for integer N > 1. First we consider a random walk of an agent in graph G, i.e. a walk in which the agent, currently located at a node of degree d, selects one port uniformly at random (independently with probability 1/d) and exits the node through this port. Let us define λ∗ (N) = ⌈2αN 5 log N⌉, where α = 4/27 is the constant coefficient in the upper bound on the expected length of the random cover walk [16]. Let γ∗N (n) = λ∗ (n), for all n ≤ N. The following lemma was proved in [22]: Lemma 3. A random walk of length γ∗N (n) starting at node v in a connected graph G 2 with at most n nodes is a cover walk with probability at least 1 − 2−2n log n . Now we prove that for some deterministic functions hN procedure A LMOST UCW behaves like a random walk. Lemma 4. For any positive integer N, there exists a function hN : {1, ..., λ∗ (N)} × {1, ..., N − 1} −→ {1, ..., N − 1}, such √ that hN (i, d) ≤ d and for any starting node of any connected n-node graph G, where 8 log N < n ≤ N for N > 4 or 1 ≤ n ≤ N for 1 ≤ N ≤ 4, the sequence of any γ∗N (n) consecutive steps a, a + 1, . . ., a + γ∗N (n) − 1 during the execution of procedure A LMOST UCW(N, hN ) produces a cover walk in this graph. Proof. First assume that N > 4. We can select parameter n ≤ N in at most N different 2 ways, graph G (with labeled ports) in at most nn ways, starting node v in at most n ways, and the first step a of the sequence in at most λ∗ (N) ways. Hence we can make a selection of a quadruple n, G, v, a in at most 2
nn · N 2 · λ∗ (N) ≤ 2n
2 log n+8 log N
different ways. Consider function hN selected randomly as follows: values hN (i, d), over all possible i, d, are selected independently; hN (i, d) = j with probability 1/d for every 1 ≤ j ≤ d. It is easy to see that procedure A LMOST UCW(N, hN ) instantiated by this function hN , started in node v and considered for consecutive steps in interval [a, a + γ∗N (n)), generates a random walk on any graph G of at most n nodes. Consider this random walk. By Lemma 3, the probability of the event ‘there exists a connected n-node graph G and a starting node v in G, such that the random walk of length γ∗N (n) in graph G starting in v is not a cover walk’ is at most 2−2n
2 log n
· 2n
2 log n+8 logN
8 log N. Using the probabilistic argument we prove the existence of the desired function, which completes the proof for case N > 4.
54
D.R. Kowalski and A. Malinowski
For N ≤ 4 the proof is similar, but we obtain the existence of a function hN yielding a cover walk for all n ≤ N. Indeed, for n ≤ 2 or N ≤ 2 it is straighforward. For 3 ≤ n ≤ N ≤ 4 the number of possible configurations is at most 2
nn · N 2 · λ∗ (N) ≤ 2n
2 log n
·
49 , 27
and again the probability of the event ‘there exists a connected n-node graph G and a starting node v in G, such that the random walk of length γ∗N (n) in graph G starting in v is not a cover walk’ is at most 2−2n
2 log n
· 2n
2 log n
·
49 49 49 ≤ 2−9 log3 · 3 ≤ 12 < 1 , 27 3 3
and the probabilistic argument shows the existence of hN .
⊓ ⊔
Although an explicit construction of functions hN is hard, the agents can find them locally by exhaustive search (which does not contribute to the cost of rendezvous protocol). Hence from now on we will assume that functions hN satisfying Lemma 4 are fixed for all N ≥ 1 and we will omit the second parameter in calls to procedure A L MOST UCW. Universal Cover Walks. To overcome the constraints on n in Lemma 4 we modify procedure A LMOST UCW(N) to obtain more flexible procedure UCW(N), which essentially after each step of the walk calls itself recursively for smaller argument, that is for which the previous procedure A LMOST UCW did not guarantee the cover walk. Procedure UCW(N) Case 2 ≤ N ≤ 4 : Run procedure A LMOST UCW(N) Case N > 4 : For each i, where 0 < i ≤ λ∗ (N) the agent, currently located at a node of degree d, does the following actions: √ – it recursively runs procedure UCW(x), where x = ⌊ 8 log N⌋, and goes backward; – it moves to an adjacent node by port hN (i, d); √ – it recursively runs procedure UCW(x), where x = ⌊ 8 log N⌋, and goes backward. Let λ(N) denote the number of steps in the procedure UCW(N). Lemma 5. λ(N) = O (N 5 log4 N). Proof. We have the recurrence relation following directly from the pseudo-code of procedure UCW(N) λ(N) = λ∗ (N) · (1 + 4λ(x))
for N > 4 , √ where x = ⌊ 8 log N⌋, and λ(N) = O (1) for N ≤ 4. Expanding this recurrence gives λ(N) = O (N 5 log4 N). ⊓ ⊔
How to Meet in Anonymous Network
55
Now we prove that procedure UCW satisfies Property UniCoverWalk for function γN (n) = min{8(λ(n))2 , λ(N ′ )} , ′ ) is called during the execution of procedure where N ′ is such that procedure UCW(N ′ ′ UCW(N) and 8 log N < n ≤ N . Note that γN (n) is polynomial in n, since it is not bigger than 8(λ(n))2 , which is polynomial in n by Lemma 5.
Lemma 6. For any positive integer N, there exists a function hN : {1, ..., λ(N)} × {1, ..., N − 1} −→ {1, ..., N − 1}, such that hN (i, d) ≤ d and the procedure UCW(N) produces a cover walk of length at most γN (n) in any connected n-node graph G, for 1 ≤ n ≤ N, and starting in any node v and in any step a ≤ λ(N) − γN (n) + 1. Proof. For N ≤ 4 it follows directly from Lemma 4, so we assume that N > 4. Consider parameters n, N and a corresponding value N ′ as in the definition of function γN (n). Fix time segment S of length γN (n) in procedure UCW(N). Note that during the execution of procedure UCW(N) at most one step from the call of some procedure A LMOST UCW(N ′′ ) with N ′′ > N ′ , is performed between two consecutive calls of procedure UCW(N ′ ). This property follows immediately from the observation that any two steps from a single call of procedure A LMOST UCW(N ′′ ), as well as any two steps from calls of procedure A LMOST UCW(N ′′ ) and procedure A LMOST UCW(N ′′′ ), for N ′′′ , N ′′ > N ′ are separated by at least one execution of procedure UCW(N ′ ). We consider two cases. Case 1: γN (n) = λ(N ′ ). In this case S contains either at least the first half or at least the second half of steps of procedure UCW(N ′ ) (otherwise the length of S would be at most λ(N ′ )/2 − 1 taken twice plus at most one step according to some call to procedure A LMOST UCW(N ′′ ), which would be less than λ(N ′ ) = |S|). In either case the whole procedure A LMOST UCW(N ′ ) is executed within teh considered segment of the call to procedure UCW(N ′ ) (either in the first part or in return part), which by Lemma 4 and inequality n ≤ N ′ yields the existence of cover walk in S for any n-node network. Case 2: γN (n) < λ(N ′ ). In this case γN (n) = 8(λ(n))2 . Similarly as in the previous case, it follows that S contains at least 4(λ(n))2 consecutive steps from a call to procedure UCW(N ′ ) which take place either in the first or in the second half of this procedure (otherwise the length of S is at most 4(λ(n))2 − 1 taken twice plus additional at most one step according to some procedure A LMOST UCW(N ′′ ), for N ′′ > N ′ , which would result in a contradiction |S| ≤ 2 · (4(λ(n))2 − 1) + 1 = 8(λ(n))2 − 1). In either case at least 4(λ(n))2 consecutive steps of procedure UCW(N ′ ) are made. It follows that the number of consecutive steps of a call to procedure A LMOST UCW(N ′ ) which are performed in either such segment is at least 4(λ(n))2 ≥ λ(n) ≥ λ∗ (n) = γ∗N (n) . 4λ(⌊ 8 log N ′ ⌋) Since 8 log N ′ < n ≤ N ′ , Lemma 4 yields the existence of cover walk in S for any n-node network. ⊓ ⊔
56
D.R. Kowalski and A. Malinowski
4.2 Rendezvous Procedure UCW is a building block of our rendezvous protocol. We start with describing the procedure RV(L, j), for label L and upper bound j on the number of stages, which is the main ingredient of the protocol. Procedure RV(L, j) for stage ← 1, 2, . . . j do T ← f (L, stage) N ← max{n : λ(n) ≤ |L| · 4stage } count ← 1 for i ← 1, . . . , |T | do if T [i] = 1 then perform step number count in procedure UCW(N) else stay idle for one step count ← count + 1 mod λ(N) For label L, let L| j be the first j positions in the binary representation of L, where 16 ≤ j ≤ |L|. Protocol R ENDEZVOUS (L) for epoch j ← 16, 17, . . . |L| − 1 do RV(L| j , ⌈log4 j⌉) RV(L, ∞) Note that the agent moves only when a step number count from procedure UCW is done, otherwise it idles. The execution of procedure RV(L| j , ⌈log4 j⌉), for 1 ≤ j < |L|, is called the j-th epoch, while the execution of procedure RV(L, ∞) is called the |L|-th epoch. Stage r of epoch j is partitioned into blocks, each consisting of consecutive 4r moving steps or consecutive 4r idle steps. Since the smallest epoch number is 16, the length of a label in every call to procedure RV is at least 16. Theorem 2. Protocol R ENDEZVOUS achieves rendezvous in time O (log3 ℓ + (λ(n))3). Proof. The idea is similar to the proof of theorem 1. We show that after O (log3 ℓ + (λ(n))3 ) steps since the startup of agent L2 there is a segment of length O (log3 ℓ + (λ(n))3 ) in which one agent is idle while the other one makes at least γN (n) moving steps (perhaps separated with idle steps) during a single call to procedure UCW(N) for some N ≥ n, which by Lemma 6 guarantees the rendezvous in this segment. Due to the lack of space the detailed proof will appear in the full version of the paper. ⊓ ⊔ Applying upper bound O (n5 log4 n) on λ(n) from Lemma 5, as well as Lemma 2, we get the following results. Corollary 2. Protocol R ENDEZVOUS achieves rendezvous/gathering in time O (log3 ℓ + n15 log12 n).
How to Meet in Anonymous Network
57
4.3 Conclusions We considered the problem of deterministic rendezvous and gathering with arbitrary startup in anonymous networks. For rings we presected an optimal protocol, reaching the lower bound Θ(n log ℓ) from [18]. For arbitrary connected graphs we showed a deterministic rendezvous protocol polynomial in n and log ℓ, and independent of τ, which gives a positive answer to the question stated in [18, 22] about the existence of such a protocol. The following problems seem to be an interesting challenge for future research: Reducing complexity. Can delay-independent rendezvous/gathering in general networks be made practical by eliminating non-constructive ingredients from the protocol and/or lowering degrees of polynomials in complexity formula? Simultaneous rendezvous/gathering and exploring. We say that a walk in a graph is T -exploring if during its any interval of length T it visits all nodes of the graph. Does there exist an optimal delay-independent rendezvous protocol in rings which is O(n)-exploring? Does there exist a delay-independent rendezvous/gathering protocol in general networks polynomial in n and ℓ (or better log ℓ) which is also T -exploring, where T is a function polynomial in n and ℓ (or better log ℓ)? Dynamic and fault-tolerant settings. Although we did not address this subject here, it is clear that our protocol for rings is robust with respect to some dynamic changes of the network (inserting/deleting nodes) and non-permanent faults. What is the degree of this robustness? How about the case of general networks?
References 1. M. Adler, H. Racke, C. Sohler, N. Sivadasan, and B. Voecking, Randomized pursuitevasion in graphs, Proc. 29th Int. Colloquium on Automata, Languages and Programming (ICALP’2002), 901-912. 2. R. Aleliunas, R.M. Karp, R.J. Lipton, L. Lovász, and C. Rackoff, Random walks, universal traversal sequences, and the complexity of maze problems, Proc. 20th Annual Symposium on Foundations of Computer Science (FOCS’1979), 218-223. 3. S. Alpern, The rendezvous search problem, SIAM J. on Control and Optimization 33 (1995), 673-683. 4. S. Alpern, Rendezvous search on labelled networks, Naval Research Logistics 49 (2002), 256-274. 5. S. Alpern, and S. Gal, The theory of search games and rendezvous. Int. Series in Operations research and Management Science, Kluwer Academic Publisher, 2002. 6. J. Alpern, V. Baston, and S. Essegaier, Rendezvous search on a graph, Journal of Applied Probability 36 (1999), 223-231. 7. E. Anderson, and R. Weber, The rendezvous problem on discrete locations, Journal of Applied Probability 28 (1990), 839-851. 8. E. Anderson, and S. Fekete, Asymmetric rendezvous on the plane, Proc. 14th Annual ACM Symp. on Computational Geometry, 1998. 9. E. Anderson, and S. Fekete, Two-dimensional rendezvous search, Oper. Research 49 (2001), 107-118.
58
D.R. Kowalski and A. Malinowski
10. V. Baston, and S. Gal, Rendezvous on the line when the players’ initial distance is given by an unknown probability distribution, SIAM J. on Control and Optimization 36 (1998), 1880-1889. 11. V. Baston, and S. Gal, Rendezvous search when marks are left at the starting points, Naval Reaserch Logistics 48 (2001), 722-731. 12. N. H. Bshouty, L. Higham, and J. Warpechowska-Gruca, Meeting times of random walks on graphs, Information Processing Letters 69(5) (1999), 259-265. 13. M. Cielibak, P. Flocchini, G. Prencipe, and N. Santoro, Solving the robots gathering problem, Proc. 30th International Colloquium on Automata, Languages and Programming (ICALP’2003), LNCS 2719, 1181-1196. 14. S.A. Cook and P. McKenzie, Problems complete for deterministic logarithmic space, Journal of Algorithms 8 (5) (1987), 385-394. 15. D. Coppersmith„ P. Doyle, P. Raghavan, and M. Snir, Random walks on weighted graphs, and applications to on-line algorithms, Proc. 22nd Annual ACM Symp. on Theory of Computing (STOC’1990), 369-378. 16. D. Coppersmith, P. Tetali, and P. Winkler, Collisions among random walks on a graph, SIAM J. on Discrete Math. 6 (1993), 363-374. 17. G. De Marco, L. Gargano, E. Kranakis, D. Krizanc, A. Pelc, and U. Vaccaro, Asynchronous deterministic rendezvous in graphs, Proc. 30th Int. Symp. on Math. Found. of Comp. Science (MFCS’2005), LNCS 3618, 271-282. 18. A. Dessmark, P. Fraigniaud, and A. Pelc, Deterministic rendezvous in graphs, Proc. 11th European Symposium on Algorithms (ESA’2003), LNCS 2832, 184-195. 19. P. Flocchini, G. Prencipe, N. Santoro, and P. Widmayer, Gathering of asynchronous oblivious robots with limited visibility, Proc. 18th Ann. Symp. on Theoretical Aspects of Comp. Science (STACS’2001), LNCS 2010, 247-258. 20. S. Gal, Rendezvous search on the line, Operations Research 47 (1999), 974-976. 21. A. Israeli, and M. Jalfon, Token management schemes and random walks yield self stabilizing mutual exclusion, Proc. 9th ACM Symp. on Principles of Distributed Computing (PODC’1990), 119-131. 22. D. Kowalski, and A. Pelc, Polynomial deterministic rendezvous in arbitrary graphs, Proc. 15th Annual Symp. on Algorithms and Computation (ISAAC’2004), LNCS 3341, 644-656. 23. E. Kranakis, D. Krizanc, N. Santoro, and C. Sawchuk, Mobile agent rendezvous in a ring, Proc. 23rd Int. Conference on Distributed Computing Systems (ICDCS’2003), 592-599. 24. W. Lim, and S. Alpern, Minimax rendezvous on the line, SIAM J. on Control and Optimization 34 (1996), 1650-1665. 25. A.J. Mayer, R. Ostrovsky, and M. Yung, Self-stabilizing algorithms for synchronous unidirectional rings, Proc. 7th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’1996), 564-573. 26. Motwani, Raghawan, Randomized Algorithms, Cambridge University Press, 1995. 27. T. Schelling, The strategy of conflict, Oxford University Press, Oxford, 1960. 28. L. Thomas, Finding your kids when they are lost, Journal on Operational Res. Soc. 43 (1992), 637-639. 29. X. Yu, and M. Yung, Agent rendezvous: a dynamic symmetry-breaking problem, Proc. International Colloquium on Automata, Languages, and Programming (ICALP’1996), LNCS 1099, 610-621.
Setting Port Numbers for Fast Graph Exploration David Ilcinkas⋆ LRI, Universit´e Paris-Sud, France [email protected]
Abstract. We consider the problem of periodic graph exploration by a finite automaton in which an automaton with a constant number of states has to explore all unknown anonymous graphs of arbitrary size and arbitrary maximum degree. In anonymous graphs, nodes are not labeled but edges are labeled in a local manner (called local orientation) so that the automaton is able to distinguish them. Precisely, the edges incident to a node v are given port numbers from 1 to dv , where dv is the degree of v. Periodic graph exploration means visiting every node infinitely often. We are interested in the length of the period, i.e., the maximum number of edge traversals between two consecutive visits of any node by the automaton in the same state and entering the node by the same port. This problem is unsolvable if local orientations are set arbitrarily. Given this impossibility result, we address the following problem: what is the mimimum function π(n) such that there exist an algorithm for setting the local orientation, and a finite automaton using it, such that the automaton explores all graphs of size n within the period π(n)? The best result so far is the upper bound π(n) ≤ 10n, by Dobrev et al. [SIROCCO 2005], using an automaton with no memory (i.e. only one state). In this paper we prove a better upper bound π(n) ≤ 4n. Our automaton uses three states but performs periodic exploration independently of its starting position and initial state.
1
Introduction
The task of visiting all nodes is fundamental when searching for data in a network. The specific case of periodic exploration is particularly useful for network maintenance, where every node has to be regularly checked. In this paper we consider the task of periodic exploration, in which a mobile entity, or robot, has to periodically visit every node of an unknown graph. We assume that the graph is anonymous, i.e., the nodes are unlabeled. Note that node labels would not help much the robot anyway because, as we will see later, it is modeled as a finite automaton, and thus is unable to store even a ⋆
Supported by the project “PairAPair” of the ACI Masses de Donn´ees, the project “Fragile” of the ACI S´ecurit´e et Informatique, and the project “Grand Large” of INRIA.
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 59–69, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
60
D. Ilcinkas
single node label. To enable the robot to distinguish the different edges incident to a node, edges at a node v are assigned port numbers in {1, . . . , dv } in a oneto-one manner, where dv is the degree of node v. Such port-numbering is called a local orientation. The robot is modeled by a deterministic finite automaton. More precisely, we consider Mealy automata. A Mealy automaton has a transition function f and a finite number of states. If the automaton enters a node of degree d through port i, in state s, then it switches to state s′ and exits the node through port i′ , with f (s, i, d) = (s′ , i′ ). Since the transition function takes as input a port number, we say that the automaton is on an edge e towards the extremity v of e or, in short, is on (e, v). Such a pair is called a position. We consider the problem of periodic graph exploration where the finite automaton has to explore any unknown anonymous connected graph of arbitrary size and arbitrary maximum degree. Periodically exploring a graph means visiting every node infinitely often. We are interested in the length of the period, i.e., the maximum number of edge traversals between two consecutive visits of any node by the automaton in the same configuration (i.e., same position and same state). Budach [4] proved that no finite automaton can explore all graphs if the local orientation is given by an adversary. Given this impossibility result, we adress the following problem: Problem. What is the mimimum function π(n) such that there exist an algorithm for setting the local orientation, and a finite automaton using it, such that the automaton explores all graphs of size n within the period at most π(n)? A trivial upper bound on the period is 2m, where m is the number of edges of the explored graph. One can indeed set the local orientation such that a right-hand-on-the-wall walk defined by f (s, i, d) = (s, (i mod d) + 1) induces an eulerian cycle of the graph, where all edges are traversed twice, once in each direction. Dobrev et al. [10] presented a port-numbering algorithm, and an automaton using it, achieving a period of at most 10n for graphs of size n. Hence π(n) ≤ 10n. The main advantage of their approach is that their automaton is ultimately simple: it is oblivious (i.e. it uses only one state). Using an oblivious automaton naturally solves the problem of setting the initial state. However, the good performance of the automaton in [10] relies on the fact that the agent must start the exploration by the edge with port number 1. In this paper we prove that π(n) ≤ 4n − 2. Our automaton is not oblivious but has only three states. Moreover, it performs periodic exploration independently from its starting position and initial state. Our port-numbering algorithm is based on a spanning tree of the graph and can be easily implemented in a distributed environment, and extended to dynamic networks. 1.1
Related Work
Exploration of unknown environments have been extensively studied in the literature (cf. [19, 21]). The environment can be modeled using geometry as a plan with obstacles or as a graph. In the latter case, moves are restricted to the
Setting Port Numbers for Fast Graph Exploration
61
edges of the graph. The graph setting can be further specified in two different ways. In [3, 8, 13, 17] the robot explores strongly connected directed graphs and it can move only in the head-to-tail direction of an edge, not vice-versa. In [4, 9, 11, 12, 15, 20, 23] the explored graph is undirected and the robot can traverse edges in both directions. Again two different assumptions are used in the literature: it is either assumed that nodes of the graph have unique labels which the robot can recognize (as in, e.g., [8, 12, 20]), or it is assumed that nodes are anonymous (as in, e.g., [3, 4, 11, 23]). We are concerned with the latter context. It is often assumed that the robot has an unlimited amount of memory to perform his task. In this paper, we are interested in robots using very little memory. More precisely we want the robots to have only a constant number of memory bits. A very natural model in this case is the finite automaton. Budach [4] proved that no finite automaton can explore all graphs. Rollik [23] proved that even a finite team of finite automata cannot explore all planar cubic graphs. This result is improved in [6], in which the authors introduced an even more powerful machine, called the JAG, for Jumping Automaton for Graphs. A JAG is a finite team of finite automata that can permanently cooperate and that can use “teleportation” to move from their current location to the location of any other automaton. Cook and Rackoff [6] proved that no JAG can explore all graphs. It was proved later in [18] that an automaton requires at least n states to explore all graphs of size n. Reingold [22] proved a very challenging result stating that SL = L by providing a log-space algorithm solving the USTCON problem. A consequence of his work is the existence of a robot with O(log n) bits performing exploration in n-node graphs, matching the lower bound of Ω(log n) bits in [18]. Several papers investigated graph exploration in which nodes of the graph are provided with a whiteboard (as in, e.g., [1, 7, 17]). A whiteboard is a memory where the automaton can read, write and erase information. Initially, all whiteboards are empty. In this setting, exploration requires at least m edge traversals, where m is the number of edges in the graph, because any unexplored edge may lead to an unexplored node. It is proved in [5] that there is an algorithm coloring the nodes using only three colors, and a finite automaton using this coloring which can explore all graphs. The traversal is of length approximately 20m. Other assumptions are used in the literature to improve the performances of algorithms (see, e.g., [14, 16]). In this paper we restrict attention to fully anonymous graphs: nodes are not labeled and not colored, no whiteboard is provided, and the automaton is not allowed to use any marker on nodes or edges. Having in mind the impossibility result of Budach [4], the only freedom is the setting of the local orientation. This method is used by Dobrev et al. [10]. As stated before, the authors presented a port-numbering algorithm, and an oblivious automaton using it, achieving a period of at most 10n for graphs of size n. 1.2
Our Results
Our main result is the design of a very simple algorithm for setting the local orientation of any graph and the design of a 3-state automaton performing
62
D. Ilcinkas
periodic exploration using the local orientation computed by the algorithm. The periodic traversal of the agent is of length at most 4n − 2, where n is the number of vertices of G. Hence π(n) ≤ 4n − 2. Moreover, the good performances of the exploration do not depend on the initial state and starting position of the automaton. Our port-numbering algorithm is based on computing a spanning tree of the graph and constructing the local orientation from this spanning tree. We prove that our labeling scheme can be easily transformed in a distributed algorithm or used in a dynamic environment, answering open problems stated in [10].
2
The Port-Numbering and the Corresponding Automaton
We first describe our algorithm computing the local orientation of the edges. This algorithm is mainly based on coding a spanning tree of the graph by choosing the small port numbers for the edges of the spanning tree. Next, we will present a 3-state Mealy automaton that explores the constructed spanning tree (plus some additionnal edges) in a DFS manner. We will conclude this section by proving the correctness of our algorithm and of the corresponding automaton. 2.1
Local Orientation Algorithm
Let G = (V, E) be a graph. Let us consider an arbitrary spanning tree T of G. Let F ⊆ E be the set of edges of T . For any node v ∈ V , let Fv be the set of edges in F that are incident to v. Definition 1. A local orientation of the edges of the graph G is compatible with a spanning tree T = (V, F ) if and only if: – for any edge e ∈ E, at least one of its two port numbers is 1 if and only if e ∈ F; – for any node v ∈ V , the edges in Fv have their port numbers from 1 to |Fv |. We say that a local orientation of G is tree-oriented if there exists a spanning tree T of G such that the local orientation is compatible with T . Our algorithm, called Small-Ports, constructs local orientations that are treeoriented. To fix attention, the algorithm uses the following local orientation. Algorithm Small-Ports 1. Pick a rooted spanning tree T of G. Let r be its root. 2. For any node v = r, assign port number 1 to the edge of T leading toward the root. At r, assign 1 to an arbitrary edge in Fr . 3. For any node v of G, assign arbitrarily port numbers from 2 to |Fv | to the remaining edges of Fv , if any.
Setting Port Numbers for Fast Graph Exploration
63
4. Finally, assign arbitrarily port numbers from |Fv | + 1 to dv (the degree of v) to the edges that have not yet assigned port numbers, if any. Clearly this local orientation is compatible with T . Remark 1. Small-Ports is very simple since it only requires the computation of a spanning tree to set the local orientation. Moreover, many applications use a spanning tree as underlying structure and in this case, Small-Ports gets the spanning tree for free. The performance and simplicity of Small-Ports has to be compared with the ones of the algorithm presented in [10]. Small-Ports performs in time O(m) whereas the algorithm in [10] performs in time O(n3 ). Remark 2. Consider a graph G and a tree-oriented local orientation of G. There is a unique spanning tree T such that this local orientation is compatible with T . Namely, T is the tree composed of the n − 1 edges of G that have at least one of their port numbers equal to 1. Moreover there exist exactly two possible roots for T such that the local orientation can be obtained by running Algorithm Small-Ports with this rooted spanning tree. These two roots are the two extremities of the unique edge with both port numbers equal to 1. 2.2
Description of the Exploring Automaton
Our exploring automaton, called A, has three states: N (for Normal), T (for Test), and B (for Backtrack). The transition function f of the automaton is defined as follows. Here d denotes the degree of the current node, and i the incoming port number. (Recall that the second parameter outputed by the transition function is the output port number.) (N, 1) if i = d f (N, i, d) = (T, i + 1) if i = d ⎧ if i = 1 and d = 1 ⎨ (N, 1) f (T, i, d) = (T, i + 1) if i = 1 and d = 1 ⎩ (B, i) if i = 1 f (B, i, d) = (N, 1)
Intuitively, the automaton traverses an edge in state N when it knows that the edge is in the spanning tree, in state T when it does not know yet, and in state B when it knows that the edge does not belong to the spanning tree. 2.3
Correctness
Theorem 1. Let G be a graph of size n, with a tree-oriented local orientation. Start the automaton A in an arbitrary state at any arbitrary position in the graph. After at most two steps, the automaton enters a closed walk P and explores it forever. Moreover, P is of length at most 4n − 2 and contains all the nodes of G. Proof. Let G be an arbitrary graph and let n be its number of nodes. Assume that the local orientation is compatible with some spanning tree T . We first study the periodic behavior of the automaton, and then the initial transient regime.
64
D. Ilcinkas
Let v be an arbitrary node of G, and let e be its incident edge with port number 1. The removal of e in T results in two connected components (subtree). Let T ′ be the component containing v. Finally, let n′ be the number of nodes of T ′ . Claim. If the automaton A enters v through port 1 in a state different from B, then it eventually leaves v through port 1 in state N . Moreover, between these two events, it explores all nodes of T ′ in at most 4n′ − 2 edge traversals, and does not leave any node not in T ′ through port 1 during those traversals. We prove this by induction on the height h of T ′ rooted in v, i.e., the eccentricity of v in T ′ . The case h = 0 corresponds to v leaf of T . If v is also a leaf in G, then the automaton immediately leaves v through port 1 in state N and the claim is proved. Therefore we assume that deg(v) > 1. By hypothesis of the claim, the automaton enters v in state T or N . In both cases, it switches to state T , and traverses the edge e′ of port number 2. v is a leaf of T and since e is in T , e′ is not. Thus the port number of e′ at the other extremity is not equal to 1. Hence the automaton comes back to v in state B, and finally leaves v through port 1 after 4 · 1 − 2 = 2 edge traversals, which proves the basis of the induction. Let us now consider the case h > 0. Let d be the degree of v. We have d = 1 because v is incident to e and depth(T ′ ) > 0. For i ≥ 2, let vi be the node at the other extremity of the edge ei with port number i at v. If ei is in T , then let Ti be the connected component of T ′ \ {ei } containing vi . Finally, let p be the largest port number of an edge in T incident to v. We have p ≥ 2 because v is not a leaf in T . By hypothesis of the claim, the automaton enters v in state T or N . In both cases, it switches to state T , and traverses the edge e2 of port number 2. Assume that the automaton leaves v through port i in state T , with 2 ≤ i ≤ p. It reaches node vi . By induction hypothesis on h, the automaton eventually comes back from vi to v through port i, in state N , after at most 4ni − 2 edge traversals. (Note that during these traversals, the automaton may have visited nodes outside Ti but it never left these nodes through port 1.) If i = d, then the automaton leaves v through port i + 1 in state T . Hence, the automaton successively explores the subtrees Ti . If p = d, then the automaton eventually leaves v through port 1 in state N after finishing the exploration of Tp . If p < d, then the automaton takes the edge ep+1 in state T . Since ep+1 is not in the tree T , the port number of ep+1 at the other extremity is not equal to 1. Thus the automaton comes back to v in state B and finally leaves v through port 1 in state N . In both cases, it premains to bound′ the number of edge traversals. The automaton traversed i=2 (4ni −2) = 4(n −1)−2(p−1) edges during the exploration of the subtrees Ti . It also traversed twice each edge ei , 2 ≤ i ≤ p. Finally there are possibly two additional edge traversals, in the case p = d. To summarize, the number of edge traversals is at most 4(n′ − 1) − 2(p − 1) + 2(p − 1) + 2 = 4n′ − 2. This concludes the proof of the claim. We now use the previous claim to exhibit the closed path traversed periodically by the automaton. There is a unique edge e = {v, v ′ } with both its port numbers
Setting Port Numbers for Fast Graph Exploration
65
equal to 1. Assume that the automaton is at position (e, v) in state N . Applying the claim, the automaton explores the subtree of T \ {e} rooted in v, comes back to v and goes at position (e, v ′ ) in state N . Applying again the claim, the automaton explores the subtree of T \ {e} rooted in v ′ , comes back to v ′ and goes at position (e, v) in state N . Therefore the automaton traverses a closed walk P of length at most 4n − 2 visiting all nodes of T , and thus of G. It remains to prove that the automaton enters P after at most two edge traversals. The automaton starts in an arbitrary state at an arbitrary position. By definition of the transition function of the automaton, there are three cases: – Case 1: the automaton leaves the node through port 1 in state N . This implies that the automaton immediately enters the closed walk P . – Case 2: the automaton leaves the node in state B. The next edge traversal is then along the edge with port number 1, in state N . This implies that the automaton enters P during the second traversal. – Case 3: the automaton leaves the node v by edge e of port number i, with i ≥ 2, in state T . Assume that either e is in T or e is the edge with the smallest port number that is not in T . In this case the edge traversal is in the closed walk. If it is not the case, then the port number j at the other extremity u of e is not equal to 1 because e is not in T . Hence the automaton switches to state B at u, and comes back to v by e. Then, it leaves v through port 1 in state N . This latter edge traversal is in P . Finally, in all cases, the automaton enters the closed walk after at most two edge traversals. ⊓ ⊔
3
Additional Properties
In the previous section, we presented a simple algorithm, using a spanning tree of the graph, to set the local orientation of the edges, and a 3-state automaton that performs periodic exploration in time at most 4n using this orientation, where n is the number of nodes of the explored graph. We prove that thanks to the robustness and simplicity of our approach, it is possible to use our algorithm in a distributed environment, and in dynamic networks. 3.1
The Distributed Variant
The distributed construction of a tree spanning an anonymous graph may be impossible if the graph has symmetry. However this task is possible if a single node initiates it. In our setting, we use the automaton to break the symmetry between nodes. The starting position of the automaton is used as the distinguished node, that becomes the root of the spanning tree. This node will wake up all the other nodes of the network by flooding. A node distinct from the root chooses his parent as the node from which it received the wakeup message (ties are broken arbitrarily). Finally, the technique described in Section 2.1 is used to set up the local orientation, based on the constructed spanning tree.
66
D. Ilcinkas
More precisely, the distributed variant of our algorithm, called DistributedSmall-Ports, proceeds as follows. At the beginning, only the node hosting the automaton is awake. This node is the root r of the future spanning tree. It starts the process by sending a “Hello” message to all its neighbors. A node v, except the root, is said to be awake when it has received at least one message. An awake node v chooses as parent the sender of the first message it has received. Ties are broken arbitrarily. Finally v sends a “Parent” message to the neighbor choosen as its parent and a “Hello” message to all its other neighbors. When a node u has received a message from all its neighbors, it chooses the local orientation as follows. Let p be the number of “Parent” messages node u has received. – If u is the root, then it assigns arbitrarily port numbers from 1 to p to the p edges leading to the senders of “Parent” messages. It assigns the remaining port numbers, if any, to the remaining edges arbitrarily. – If u is not the root, then it assigns port number 1 to the neighbor that was choosen as its parent. Then it assigns arbitrarily port numbers from 2 to p + 1 to the p edges leading to the senders of a “Parent” message, if any. Finally it assigns the remaining port numbers, if any, to the remaining edges arbitrarily. Theorem 2. Algorithm Distributed-Small-Ports constructs a spanning tree of the graph and sets a local orientation compatible with it, using 2m messages. 3.2
Exploration of Dynamic Networks
As proved in Theorem 1, the automaton periodically explores any graph in at most 4n steps, whatever the starting position and the initial state are, provided that the local orientation is compatible with some spanning tree of the graph. Therefore the automaton can be used in dynamic networks under the unique constraint that the local orientation of the network remains tree-oriented after every change. We consider changes of the graph that keep it connected. A change of a graph can be decomposed in a sequence of the following basic changes. – – – –
Addition of a new edge between two existing nodes; Addition of a new node, connected by a new edge to an existing node; Removal of an edge, without disconnecting the graph; Removal of a degree-1 node and of its unique incident edge.
Theorem 3. In the case of a removal of an edge belonging to the spanning tree of a n-node graph G, Θ(n) modifications in the local orientation are necessary and sufficient to maintain it tree-oriented. Our algorithm updating the local orientation performs in time O(m) in this case, where m is the number of edges. In all other cases, the update of the local orientation can be done in constant time, and thus with a constant number of modifications.
Setting Port Numbers for Fast Graph Exploration
67
Proof. Local orientations are updated as follows: – Addition of an edge. This edge is not placed in the spanning tree. Let u and v be the two extremities of the new edge e and let du and dv be their new respective degree. We set du , respectively dv , as the port number of edge e at u, respectively v. – Addition of a leaf. The new edge e connecting the new node u to node v of the existing graph is necessarily in the spanning tree. Let d be the degree of v and let p be the largest port number at v corresponding to an edge in the spanning tree, before modification. If p = d, then the port number of edge e at v is d + 1. Otherwise (p = d), the edge with port number p + 1 has now the port number d + 1 and edge e has the port number p + 1 at v. Edge e is assigned port number 1 at u. – Removal of an edge. If the removed edge e does not belong to the spanning tree T , then let u and v be its two extremities. We describe the modifications of the local orientation in node u. The modifications in v are done similarly. Let i be the port number of e at u. Let d be the degree of u before the removal of e. Finally, let e′ be the edge incident to u with port number d. If e = e′ (i.e., i = d), then no port number is modified at u. If e = e′ , then we set i as the new port number of e′ at u. If edge e belongs to the spanning tree T , then T without edge e is not connected. Since we assume that the graph remains connected, there exists an edge e′ in the new graph connecting the two parts of T . This edge e′ is added to the tree. Some port numbers have to be changed so that the local orientation become compatible with the resulting spanning tree. We claim that only a constant number of port numbers have to be modified at each node. At the extremities of e and e′ , the set of tree-edges incident to it changes. However, at most two edges are concerned. Apart from this, the only modifications to do concern the choice of the incident edge with port number 1. A switch between two port numbers is sufficient. Therefore, at most a constant number of port numbers are modified at each node. – Removal of a leaf. Let v be the node connected to the removed leaf u. Let i be the port number at v of the edge leading to u. Let p be the largest port number at v of an edge in T . Let d be the degree of v before the removal of e. Finally, let e′ , resp. e′′ , be the edge incident to v with port number p, resp. d. Since edge e is in the tree T , we have i ≤ p ≤ d. We modify the port number of e′ , resp. e′′ , if and only if i = p, resp. p = d. If i = p, then we set i as the new port number of e′ . If p = d, then we set p as the new port number of e′′ . In all cases, the other port numbers in the graph remain inchanged. It may not be possible to avoid a linear number of modifications in the case of the removal of a tree-edge. For example, consider a cycle C of odd length 2n + 1. To simplify the description, let us give names from 1 to 2n + 1 to the nodes. For any node i ≤ n, resp. i > n, 1 is the port number of the edge leading to node i + 1, resp. i − 1. Thus the local orientation is compatible with the path starting at node 1 and ending at node 2n + 1. Now assume that the edge {n, n + 1} is
68
D. Ilcinkas
removed. The port numbers at node n and n + 1 are set to 1 since they are now leaves. All edges are necessarily in the spanning tree but the edge {2n + 1, 0} has both its port numbers equal to 2. The local orientation is not tree-oriented. In fact, in a tree-oriented orientation, exactly one edge e must have both its port numbers equal to 1. Moreover, for any node v, excluding the extremities of e, the edge with port number 1 must point toward e, i.e., the edge must be in the path from v to the closer extremity of e. Hence, the local orientation has to be modified in at least n nodes to obtain a tree-oriented local orientation. ⊓ ⊔
4
Further Investigations
In this paper, we proved the upper bound 4n − 2 on the minimal period π(n) for periodic graph exploration by a finite automaton. Our algorithm uses an arbitrary spanning tree to set the local orientations. The automaton explores this spanning tree plus at least one additional edge per node. It seems difficult to avoid these additional edge traversals. Hence 4n − O(1) may be optimal for tree-based approach. We conjecture that this bound cannot be improved even with other techniques. Conjecture. π(n) = 4n − O(1). Since graphs are anonymous, using an extensive amount of memory does not help much. Therefore finding the minimal period for machine with unbounded memory may be very challenging. Open problem. What is the mimimum period ψ(n) such that there exists an algorithm setting the local orientations and a robot with unlimited memory such that the automaton explores any graph of size n within the period ψ(n)? Finally, it remains open if the period 10n proved in [10] can be improved if the robot is restricted to be oblivious.
References 1. Y. Afek and E. Gafni. Distributed Algorithms for Unidirectional Networks. SIAM J. Computing 23(6):1152-1178, 1994. 2. S. Albers and M. R. Henzinger. Exploring unknown environments. SIAM J. Computing 29:1164-1188, 2000. 3. M. Bender, A. Fernandez, D. Ron, A. Sahai and S. Vadhan. The power of a pebble: Exploring and mapping directed graphs. Information and Computation 176(1):121, 2002. 4. L. Budach. Automata and labyrinths. Math. Nachrichten, pages 195-282, 1978. 5. R. Cohen, P. Fraigniaud, D. Ilcinkas, A. Korman and D. Peleg. Label-Guided Graph Exploration by a Finite Automaton. In 32nd Int. Colloq. on Automata, Languages & Prog. (ICALP), LNCS 3580, pages 335-346, 2005. 6. S. Cook and C. Rackoff. Space lower bounds for maze threadability on restricted machines. SIAM J. on Computing 9(3):636–652, 1980.
Setting Port Numbers for Fast Graph Exploration
69
7. S. Das, P. Flocchini, A. Nayak, and N. Santoro. Distributed Exploration of an Unknown Graph. In 12th Colloquium on Structural Information and Communication Complexity (SIROCCO), LNCS 3499, pages 99-114, 2005. 8. X. Deng and C. H. Papadimitriou. Exploring an unknown graph. J. Graph Theory 32(3):265-297, 1999. 9. K. Diks, P. Fraigniaud, E. Kranakis, and A. Pelc. Tree Exploration with Little Memory. J. Algorithms 51(1):38-63, 2004. 10. S. Dobrev, J. Jansson, K. Sadakane, and W.-K. Sung. Finding Short Right-Handon-the-Wall Walks in Graphs. In 12th Colloquium on Structural Information and Communication Complexity (SIROCCO), LNCS 3499, pages 127-139, 2005. 11. G. Dudek, M. Jenkin, E. Milios, and D. Wilkes. Robotic Exploration as Graph Construction. IEEE Transaction on Robotics and Automation 7(6):859-865, 1991. 12. C. Duncan, S. Kobourov, and V. Kumar. Optimal constrained graph exploration. In 12th Ann. ACM-SIAM Symp. on Discrete Algorithms (SODA), pages 807-814, 2001. 13. R. Fleischer and G. Trippen. Exploring an unknown graph efficiently. In 13th Annual International Symposium on Algorithms (ESA), LNCS 3669, pages 11-22, 2005. 14. P. Flocchini, B. Mans, and N. Santoro. Sense of direction in distributed computing. Theoretical Computer Science 291(1):29-53, 2003. 15. P. Fraigniaud, L. Gasieniec, D. Kowalski, and A. Pelc. Collective Tree Exploration. In 6th Latin American Theoretical Informatics (LATIN), LNCS 2976, pages 141151, 2004. 16. P. Fraigniaud, C. Gavoille, and B. Mans. Interval routing schemes allow broadcasting with linear message-complexity. Distributed Computing 14(4):217-229, 2001. 17. P. Fraigniaud, and D. Ilcinkas. Digraphs Exploration with Little Memory. In 21st Symposium on Theoretical Aspects of Computer Science (STACS), LNCS 1996, pages 246-257, 2004. 18. P. Fraigniaud, D. Ilcinkas, G. Peer, A. Pelc, and D. Peleg. Graph Exploration by a Finite Automaton. In 29th International Symposium on Mathematical Foundations of Computer Science (MFCS), LNCS 3153, pages 451-462, 2004. 19. A. Hemmerling. Labyrinth Problems: Labyrinth-Searching Abilities of Automata. Volume 114 of Teubner-Texte zur Mathematik. B. G. Teubner Verlagsgesellschaft, Leipzig, 1989. 20. P. Panaite and A. Pelc. Exploring unknown undirected graphs. J. Algorithms 33(2):281-295, 1999. 21. N. Rao, S. Kareti, W. Shi, and S. Iyengar. Robot navigation in unknown terrains: Introductory survey of non-heuristic algorithms. Tech. Report ORNL/TM-12410, Oak Ridge National Lab., 1993. 22. O. Reingold. Undirected ST-Connectivity in Log-Space. In 37th ACM Symp. on Theory of Computing (STOC), pages 376-385, 2005. 23. H. Rollik. Automaten in planaren Graphen. Acta Informatica 13:287-298, 1980 (also in LNCS 67, pages 266-275, 1979).
Distributed Chasing of Network Intruders L´elia Blin1 , Pierre Fraigniaud2 , Nicolas Nisse2 , and Sandrine Vial1 2
1 IBISC, University of Evry, 91000 Evry, France LRI, CNRS and Universit´e Paris-Sud, 91405 Orsay, France
Abstract. This paper addresses the graph searching problem in a distributed setting. We describe a distributed protocol that enables searchers with logarithmic size memory to clear any network, in a fully decentralized manner. The search strategy for the network in which the searchers are launched is computed online by the searchers themselves without knowing the topology of the network in advance. It performs in an asynchronous environment, i.e., it implements the necessary synchronization mechanism in a decentralized manner. In every network, our protocol performs a connected strategy using at most k + 1 searchers, where k is the minimum number of searchers required to clear the network in a monotone connected way, computed in the centralized and synchronous setting.
1
Introduction
Graph searching [18] is one of the most popular tool for analyzing the chase for a powerful and hostile agent, by a set of software agents in a network. Roughly speaking, graph searching involves an intruder and a set of searchers, all moving from node to node along the links of a network. The intruder is powerful in the sense that it is supposed to move arbitrarily fast, and to be permanently aware of the positions of the searchers. However, the intruder cannot cross a node or an edge occupied by a searcher without being caught. Conversely, the searchers are unaware of the position of the intruder. They are aiming at surrounding the intruder in the network. The intruder is caught by the searchers when a searcher enters the node it occupies. For instance, one searcher can catch an intruder in a path (by moving from one extremity of the path to the other extremity), while two searchers are required to catch an intruder in a cycle (starting from the same node, the two searchers move in opposite directions). In addition to network security, graph searching has several other practical motivations, such as rescuing speleologists in caves [6] or decontaminating a set of polluted pipes [19]. It has also several applications to the Graph Minor theory as it provides a dynamic approach to the analysis of static graph parameters such as treewidth and pathwidth [4]. 1.1
The Problem
The main question addressed by graph searching is: given a graph G, what is the search number of G? That is, what is the minimum number of searchers, s(G), P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 70–84, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
Distributed Chasing of Network Intruders
71
required to clear the graph G, i.e., to capture the intruder? This question is motivated by, e.g., the need for consuming the minimum amount of computing resources of the network at any time, while clearing it. The decision problem corresponding to computing the search number s(G) of a graph G is NP-hard [18], and NP-completeness follows from [5, 16]. Computing the search number is however polynomial for trees [17, 18], and the corresponding search strategy can be computed in linear time [20]. In fact, the search number of a graph is known to be roughly equal to the pathwidth, pw, of the graph, and therefore the search number of an n-node graph √ can be approximated in polynomial time, up to multiplicative factor O(log n log tw) where tw denotes the treewidth of the graph (see [7], and use the fact that pw/tw ≤ O(log n)). The graph searching problem has given rise to a vast literature, and several variants of the problem have been considered (see, e.g., [14, 15]). Nevertheless, from a distributed systems point of view, the existing solutions for the graph searching problem (cf., e.g., [17, 18, 20]) suffer from a serious drawback: they are mostly centralized. In particular, (1) the search strategy for every network is computed based on the knowledge of the entire topology of the network, and (2) the moves of the searchers are controlled by a centralized mechanism that decides at every step which searcher has to move, and what movement it has to perform. These two facts limit the applicability of the solutions. Indeed, as far as networking or speleology is concerned, the topology of the network is often unknown, or its map unprecise. The topology can even evolve with time (either slowly as for, e.g., Internet, or rapidly as for, e.g., P2P networks). Moreover, the mobile entities involved in the search strategy can hardly be controlled by a central mechanism dictating their actions. All these constraints make centralized algorithms inappropriate for many instances of the graph searching problem. This paper addresses the graph searching problem in a distributed setting, that is the searchers must compute their own search strategy for the network in which they are currently running. This distributed computation must not require knowing the topology of the network in advance, and the searchers must act in absence of any global synchronization mechanism, hence they must be able to perform in a fully asynchronous environment. Distributed strategies have been proposed for specific topologies only, such as trees [2], hypercubes [9], and rings and tori [8]. In this paper, we address the problem in arbitrary topologies. 1.2
The Model
The searchers are modeled by autonomous mobile computing entities with distinct IDs. More precisely, they are labeled from 1 to the current number k of searchers in the network (if a new searcher has to join the team, it will take number k + 1). Otherwise searchers are all identical, and run the same program. The network and the searchers are asynchronous in the sense that every action of a searcher takes a finite but unpredictable amount of time. Moreover, motivated by the fact that the intruder models a potentially hostile agent that can, e.g., corrupt the node memories, the search strategy must perform independently from any local information stored at nodes a priori, and even independently from the
72
L. Blin et al.
node IDs. We thus consider anonymous networks, i.e., networks in which nodes do not have labels, or these labels are not accessible to the searchers. The deg(u) edges incident to any node u are labeled from 1 to deg(u), so that the searchers can distinguish the different edges incident to a node. These labels are called port numbers. Every node of the network has a whiteboard in which searchers can read, erase, and write symbols. (A whiteboard is modeling a specific zone of the local node memory that is reserved for the purpose of exchanging information between software agents). At every node, the local whiteboard is assumed to be accessible by the searchers in fair mutual exclusion. Since the content of the whiteboard at every node accessible by the intruder is corruptible, it is the role of the searchers to protect information stored at nodes’ whiteboards. The decisions taken by a searcher at a node (moving via port number p, writing the word w on the whiteboard, etc.) is local and depends only on (1) the current state of the searcher, and (2) the content of the node’s whiteboard (plus possibly (3) the incoming port number, if the searcher just entered the node). The powerful intruder is assumed to be aware of the edge-labeled network topology, and thus it does not need the whiteboards to navigate. In fact, as mentioned before, when the intruder enters a node that is not occupied by a searcher, then it can modify or even remove the content of the local whiteboard. All searchers start from the same node u0 , called the entrance of the network, or the homebase of the searchers. This node u0 is also a source of searchers, in the sense that if the current team of searchers realize that they are not numerous enough for clearing the network, then they can ask for a new searcher, that will appear at the source. Initially, one searcher spontaneously appears at the source. The size of the team will increase until it becomes large enough to clear the network. Basically, the searchers are aiming at expanding a cleared zone around their homebase u0 , that is at expanding a connected sub-network of the network G, containing u0 , until the whole network is clear. In particular, as the entrance u0 of the network is a critical node, it has to be permanently protected from the intruder in the sense that the intruder must never be able to access it. Among all search strategies, monotone ones play an important role. A monotone strategy insures that, once an edge has been cleared, it will always remain clear. Monotone strategies guaranty a polynomial number of moves: exactly one move for clearing every edge, plus few moves required by the searchers to set up their positions before clearing the next edge. In the connected setting, the corresponding graph searching parameter is called monotone connected search number starting at u0 (cf., [2, 3, 13]), and is denoted by mcs(G, u0 ). 1.3
Our Results
We describe a distributed protocol, called dist_search, that enables the searchers to clear any asynchronous network in a fully decentralized manner, i.e., the search strategy is computed online by the searchers themselves, after being launched in the network without any information about its topology. To the best of our knowledge, this is the first distributed protocol that addresses the graph searching problem in its whole generality, i.e., for arbitrary network topologies.
Distributed Chasing of Network Intruders
73
The distributed search strategy self-computed by the searchers in an asynchronous environment uses a number of searchers very close to the optimal. Indeed, we prove that the number of searchers involved in the strategy computed by our protocol in a network G is equal to 1 plus the minimum number of searchers required to clear G by a monotone connected search strategy starting at u0 , i.e., is equal to mcs(G, u0 ) + 1. It is known [13] that mcs(G, u0 ) ≤ s(G)⌈log n⌉. Hence our protocol is optimal up to a logarithmic factor. Our protocol is space-efficient from many respects. In particular, it requires only O(log k) bits of memory for each of the k searchers involved in the search. This amount of memory is independent from the size n of the network. Moreover, the amount of information stored at every whiteboard never exceeds O(m log n) bits, where m is the number of edges of the network. To obtain our results, we had to address several problems. First, since the network is a priori unknown to the searchers, they have to explore it. However, this exploration cannot be achieved easily because of the potential corruption of the whiteboards by the intruder. Our protocol insures that exploration and searching are performed somehow simultaneously, and that the whiteboards of cleared nodes remain permanently protected unless there is no need to protect the stored information anymore. Second, as the searchers asynchronously spread out in the network, they become rapidly unaware of their relative positions. Our protocol synchronizes the searchers in a non trivial manner so that an action by a searcher is not ruined by the action of another searcher. Finally, to obtain space-efficient solutions, our protocol takes advantage from the accesses to the whiteboards, to store and read information useful to the searchers: it maintains a stack at every whiteboard, and every searcher at a node has access only to the top of a stack stored locally on the current node’s whiteboard, and to few other variables also stored on the whiteboard.
2
Main Result and Sketch of the Protocol
The following theorem summarizes the main characteristics of dist_search. Theorem 1. For any connected, asynchronous, and anonymous network G, and any u0 ∈ V (G), dist_search enables capturing an intruder in G using searchers starting from the homebase u0 , and initially unaware of G. The main characteristics of dist_search are the following: (1) dist_search uses at most k = mcs(G, u0 ) + 1 searchers if mcs(G, u0 ) > 1, and k = 1 searcher if mcs(G, u0 ) = 1; (2) Every searcher involved in the search strategy computed by dist_search uses O(log k) bits of memory; (3) During the execution of dist_search, at most O(m log n) bits of information are stored at every whiteboard. Note that the theorem above implies that for networks searchable by a monotone connected search strategy using a constant number of searchers, the protocol dist_search can be implemented using finite state automata.
74
L. Blin et al.
Let us briefly sketch Protocol dist_search and its proof. Given a connected network G, and X ⊆ E(G), we denote by δ(X) the nodes in V (G) that are incident to an edge in X and an edge in E(G) \ X. Given k ≥ 1, we call kconfiguration any set X ⊆ E(G) such that |δ(X)| ≤ k. The k-configuration digraph Ck of G is defined as follows. V (Ck ) is the set of all possible k-configurations. There is an arc from X to X ′ in Ck if the configuration X ′ can be reached from X by one step of a monotone connected search strategy using at most k searchers (a step of a monotone connected search strategy starting at node u0 is the action consisting in moving a searcher along an edge, all searchers being initially at u0 ). The objective of Protocol dist_search is essentially to try, for successive k = 1, 2, . . ., whether the configuration graph Ck can be traversed from ∅ to E(G) under the constraint that the searchers starts at u0 . If yes, then dist_search completes after having captured the intruder using ≤ k searchers. Otherwise, dist_search tries with k + 1 searchers. Note that this approach is similar to the (centralized) parametrized algorithms of the literature (cf., e.g., [1, 10, 11]). However, the difficulty of our approach is to discover whether the configuration digraph Ck can be traversed from ∅ to E(G) in a decentralized manner. For a fixed k, the objective of dist_search is to organize the movements of the searchers so that they perform a DFS of Ck (again, ignoring the topology of G, and in an asynchronous environment). This objective is achieved according to an order specified by a virtual stack in which are stored information related to the moves of the searchers. Roughly, Protocol dist_search constructs all possible states for the virtual stack, according to a lexicographic order on the states of the stack. The difficulty of the protocol is to distribute the virtual stack on the whiteboards so that when a searcher visits a node, it finds on the whiteboard enough information for computing the next step of the search strategy that it should perform. Since the intruder can corrupt the whiteboards, withdrawals from previously visited nodes must be scheduled so that to make sure that no information will be lost. Note here that, albeit the search strategy eventually computed by the searchers is monotone (in the sense that the contents of all the whiteboards describe a monotone search strategy when the protocol completes), failing search strategies investigated before (according to the lexicographic order on the states of the virtual stack) lead to withdrawals, and therefore to recontamination. If all strategies with k searchers have failed, then the searchers terminate at the homebase, call a new searcher, and restart searching the network with k+1 searchers. The additional searcher used by dist_search, compared to mcs(G, u0 ), is required for avoiding deadlocks. It is also used to schedule the moves of the other searchers and to transmit few information between the searchers. It could be replaced by simple communication facilities. For instance, if the searchers would have the ability to send to and read from a mailbox available at the homebase, this additional searcher could be avoided. In particular, in the Internet, each searcher would just have to keep in its memory the IP address of the homebase. The proof of correctness of Protocol dist_search is twofold. First, we prove the correctness of an algorithm, denoted by A, that uses a centralized stack for
Distributed Chasing of Network Intruders
75
traversing the configuration digraph Ck . The second part of the proof consists in proving a one-to-one correspondence between every execution of dist_search using a virtual (i.e., decentralized) stack, and every execution of A using a centralized stack.
3
Search Strategy Using a Centralized Stack
In this section, we describe the algorithm A enabling a team of searchers launched in an unknown network to capture an intruder hidden in this network. Algorithm A is not fully distributed because it uses a centralized stack whose top is accessible from every node by every searchers. 3.1
Description of Algorithm A
Algorithm A uses the notion of extended moves, that are triples (ai , aj , p) where ai and aj denote searchers, and p is a port number. Definition 1. An extended move (ai , aj , p) corresponds to the following: (1) searcher ai joins searcher aj , and (2) the searcher with the smallest ID among ai and aj leaves the node now occupied by the two searchers via port p. (Note that i = j is allowed, in which case ai leaves the node it occupies by port p). The central stack stores extended moves and thus describes a sequence of operations performed by the searchers. More precisely, reading the stack bottom-up defines a sequence of operations that describes a partial execution of a search strategy. Definition 2. For a fix parameter k ≥ 1, a state of the virtual stack is valid if there exists a monotone connected search strategy using at most k searchers whose partial execution is described by this state. By some abuse of terminology, we sometime say that a stack Q is valid, meaning that the current state S of the stack Q is valid. Given a valid state S of a stack Q, we denote by XS the configuration induced by S, that is XS is the set of clear edges after the execution of the extended moves in S. The principle of Algorithm A is to try, for each k = 1, 2, . . ., every possible monotone connected search strategy using k searchers, until one reaches a situation in which either the whole network is clear, or all search strategies have been exhausted. In the latter case, Algorithm A proceeds with k + 1 searchers by calling for a new searcher at the homebase u0 . From now on, we assume that k is fixed. The k searchers are denoted by a1 , . . . , ak , where the ID of ai is simply its index i. Algorithm A is described in Figure 1. It returns a boolean possible. If possible is true then clearing the network with k searchers is possible, in which case the stack Q returned by Algorithm A is valid, and contains a monotone connected search strategy clearing G with k searchers. In Algorithm A, the stack Q is initially empty, and only a1 is placed at u0 . the other searchers a2 , . . . , ak are available. In addition to the centralized stack Q,
76
L. Blin et al.
Algorithm A uses a global variable state that takes two possible values clear or backtrack whose meaning will appear clear later on. Finally, Algorithm A uses a boolean variable decided that is false until either a monotone connected search strategy using k searchers clearing the network is discovered, or all possible monotone connected search strategies using k searchers have been considered. Hence the main while-loop of Algorithm A is based on the value of decided (cf. Figure 1). This main while-loop mainly contains two blocks of instructions. These blocks are executed depending on the value of state (clear or backtrack). Case clear corresponds to a situation in which Algorithm A has just cleared an edge, i.e., the last execution of the main while-loop has resulted in pushing some extended move in Q. Case backtrack corresponds to a situation when the last execution of main while-loop has resulted in popping the stack Q, i.e., has resulted in the recontamination of an edge. Let us first focus on the case state = clear. Algorithm A focuses on specific extended moves, only those that do not imply recontamination (this is because A eventually computes a monotone strategy). More formally, let us consider a valid state S of the stack Q, i.e., S is a sequence of extended moves denoted by M1 | . . . |Mr . Pushing an extended move M in Q results in a new state, denoted by S|M . We say that a extended move M is valid according to Q if S ′ = S|M is a valid state. Note that A does not maintain the set X of clear edges and the set of available searchers. Indeed, given a valid state S of the stack Q, one can easily construct XS by executing the partial search strategy described by S. A searcher is then available if either it stands at a node not in δ(XS ) or it stands at a node also occupied by a searcher of lower index. There is therefore a simple characterization of a valid extended move M according to a valid state S of Q: If S = ∅, then M is valid if and only if either u0 is a 1-degree node and M = (a1 , a1 , 1), or k > 1 and M = (a2 , a1 , 1). If S = ∅, M = (ai , aj , p) is valid according to Q if and only if either i = j, ai stands at a node u ∈ δ(XS ), and p is the only contaminated port of node u, or i = j, ai is available, aj stands at a node u ∈ δ(XS ), and p is a contaminated port of node u. The first instruction of the case state = clear consists in checking whether there exists a valid extended move according to Q. The key issue is to choose which extended move to apply, among all possible valid extended moves. For this choice, the extended moves are ordered in lexicographic order. Definition 3. Let M = (ai , aj , p) and M ′ = (ai′ , aj ′ , p′ ) be two extended moves. We define M ≺ M ′ if and only if either (i < i′ ), or (i = i′ , and j < j ′ ), or (i = i′ , j = j ′ , and p < p′ ). If there is an extended move that is valid according to Q then Algorithm A chooses the one that has minimum lexicographic order among all extended moves that are valid according to Q. If there is no extended moves that are valid according to Q, then A switches to the state backtrack. For this purpose, the last move in Q is popped out, and stored in the global variable Mlast . If fact, if Q = ∅, then backtracking is not possible, and A decides that k searchers are not sufficient to clear the network.
Distributed Chasing of Network Intruders
77
Input: k ≥ 1 searchers a1 , a2 , · · · , ak and a node u0 of a graph G. Output: a boolean possible, and a stack Q of extended moves. begin Q ← ∅; state ← clear; decided ← f alse; while not decided do if all searchers are available then decided ← true; possible ← true; else /* case state = clear */ if state = clear then if there exists a valid extended move according to Q then (ai , aj , p) ← minimum valid extended move according to Q; push(ai , aj , p); else if Q = ∅ then Mlast ← pop(); state ← backtrack; else decided ← true; possible ← f alse; /* case state = backtrack */ else Let Mlast = (ai , aj , p); if there exists a valid extended move according to Q larger than (ai , aj , p) then (a′i , a′j , p′ ) ← min valid extended move according to Q larger than (ai , aj , p); push(a′i , a′j , p′ ); state ← clear; else if Q = ∅ then Mlast ← pop(); else decided ← true; possible ← f alse; endif endif endwhile return(possible, Q); end.
Fig. 1. The Algorithm A
Let us now focus on the case state = backtrack. A considers the move Mlast . If there is an extend move M ≻ Mlast that is valid according to the stack, then A performs the smallest such move by pushing M in the stack, and going back to state clear. Otherwise A carries on backtracking by popping out the last extended move from the stack. 3.2
Property of Algorithm A
Lemma 1. Algorithm A completes for k = mcs(G, u0 ), and then the stack Q describes a monotone connected search strategy for G starting at u0 and using k searchers. Sketch of proof. First we prove that, after any execution of the while-loop, the state of the stack is valid. The main tools for the proof in then an ordering of the states of the stack. We order them the same way we ordered extended moves. Precisely, given S = M1 | · · · |Mr and S ′ = M1′ | · · · |Mr′ ′ , two states of
78
L. Blin et al.
the stack Q, S ≺ S ′ if and only if there exists i ≤ min{r, r′ } such that Mi ≺ Mi′ and, for any j < i, Mj = Mj′ . Also, let us say that a valid sequence of extended moves is complete if the corresponding search strategy clears the whole network. Consider S = M1 | . . . |Mr a sequence of extended moves corresponding to a partial execution of a search strategy using at most k searchers. We prove that either there exists a complete sequence S ′ of extended moves with S ′ ≺ S, or Algorithm A eventually computes state S of the stack. Based on these preliminary results, we prove that if mcs(G, u0 ) > k then Algorithm A returns (f alse, ∅) for k. Conversally, we prove that if mcs(G, u0 ) = k, and if S is the smallest complete sequence of valid extended moves corresponding to a monotone connected search strategy in G starting from u0 , then Algorithm A returns (true, Q) for k, where Q is in state S. As a direct consequence of these results, we get that Algorithm A computes a minimal monotone connected search strategy ⊓ ⊔ starting from u0 in G.
4
Fully Distributed Search Strategy
In this section, we describe the main features of protocol dist_search. In this description, we assume that searchers are able to communicate by exchanging messages of size O(log k) bits where k is the number of searchers currently involved in the search. With this facility, we will show that dist_search captures the intruder with mcs(G, u0 ) searchers. Using an additional searcher for implementing communications between the mcs(G, u0 ) other searchers, dist_search captures the intruder with mcs(G, u0 ) + 1 searchers in total. Assuming that the searchers can communicate by exchanging messages is only for the purpose of simplifying the presentation. Moreover, for the sake of simplicity, we assume that two searchers on the same node can ”see” each other. Obviously, this can be implemented with the whiteboards, but would unnecessarily complicate the presentation. First, we describe the data structure used by dist_search. 4.1
Data Structure of dist_search
Every searcher has a state variable that can take k + 2 different values where k is the current number of searchers. These k+2 states are: clear, backtrack, and (help, j), for j = 1, . . . , k. Initially, all searchers are in state clear. During the execution of the protocol, (1) a searcher is in state clear if it has just cleared an edge; (2) a searcher is in state backtrack if it has just backtracked through an edge that it has previously cleared; and (3) a searcher is in state (help, j) if it is aiming at joining the searcher j to help him clearing the network (i.e., one of them will guard a node, while the other will clear an edge incident to this node). The messages that searchers can exchange are of four types: start, move, help and sorry. (1) start is an initialization message that is only used to start Protocol dist_search (only agent a1 receives this message, at the very beginning of the protocol execution). (2) If a searcher i receives a message (move, j) from some searcher aj , then it is the turn of searcher ai to proceed. (As it should appear clear later, the searchers schedule themselves so that exactly one searcher
Distributed Chasing of Network Intruders
79
performs an action at a time). (3) If a searcher ai receives a message (help, j) from some searcher aj , then aj is currently just arriving at the same node as ai to help ai . (Note that ai and aj could use the whiteboard to communicate, and this type of messages is just used for a purpose of unification with the other message types). (4) If a searcher ai had received a message (move, j) or (help, j) from some searcher aj and, after having possibly performed several actions, it turns out that these actions are useless, then ai sends a message (sorry, i) back to searcher aj . The whiteboard of every node contains a local stack, and two vectors direc− tion[] and cleared_port[]. The protocol insures that, after the node has been visited by a searcher, direction[0] indicates the port number to take for reaching the homebase, and, for i > 0, direction[i] is the port number of the edge that searcher ai has used to leave the current node the last time it was at this node. At node v, for any 1 ≤ p ≤ deg(v), cleared_port[p] = 1 if and only if the edge corresponding to the port number p is clear. When a searcher at a node v decides to perform any action, it saves a trace of this action in the local stack. A trace is a triple (X, a, x) where X is a symbol, a is a searcher’s ID, and x is either a port number, or a searcher’s ID, depending on symbol X. More precisely: (1) (CC, i, p) means that p is the only contaminated (C) port, and searcher ai decided to clear (C) the edge that corresponds to p; (2) (CJ, i, p) means that some searcher joined (J) ai at this node, and ai decided to clear (C) the edge that corresponds to p; (3) (JJ, i, j) means that searcher ai decided to join (J) the searcher aj ; (4) (RT, i, j) means that searcher ai received (R) a message from searcher aj ; (5) (ST, i, j) means that searcher ai decided to send (S) a message to searcher aj ; (6) (AC, i, p) means that searcher ai arrived (A) at v by port p after clearing (C) the corresponding edge; (7) (AH, i, p) means that searcher ai arrived (A) at v by port p in order to join another (H) searcher. 4.2
The Protocol Dist_Search
The protocol dist_search organizes the movements of the searchers, and the messages exchanged between the searchers, in a specific order. Based on a lexicographic order of the searchers’ actions, dist_search orders them in order to always execute the smallest action that can be performed. The principle of dist_search is to try every possible monotone connected search strategy using k searchers, until either the whole graph is clear, or no searcher can move without implying recontamination. In the latter case, the searcher that made the last move backtracks, and dist_search tries the next action according to the lexicographic order on the actions. The termination of dist_search is insured as follows. The graph is cleared at time t if and only if all searchers are occupying clear nodes at this time, i.e., nodes whose all incident edges are clear. This configuration is identified by the searchers because searcher a1 tries to help all the other searchers, from a2 to ak , but none of them needed help. Conversely, the searchers identify that k searchers are not sufficient to clear the graph when they are all occupying the homebase, and try to pop the local stack that is empty. In this case, a1 calls for a new
80
L. Blin et al.
Program of searcher i at node v. begin /* Searcher i receives a message */ Case: message = start decide(); message = (move, j) push(RT, i, j); decide(); message = (help, j) push(RT, i, j); p ← smallest contaminated port; clear edge(CJ, i, p) message = (sorry, j) back();
/* Searcher i arrives at node v by port p */ Case: state = clear if no other searcher is at v then erase whiteboard; direction[0] ← p; cleared_port[p] ← 1; push(AC, i, p); if i = 1 then push(ST, i, 1); send message (move, i) to 1; else decide(); state = (help, j) push(AH, i, p); join(j); state = backtrack back(); end
Fig. 2. Skeleton of Protocol dist_search
searcher, and the k + 1 searchers are ready to try again capturing the intruder from the homebase. A skeleton of the protocol dist_search is given in Figures 2-3. More precisely, Figure 2 describe the global behavior of a searchers, using subroutines described in Figure 3. A searcher reacts to either the reception of a message (cf. left part of Figure 2), or to its arrival at a node (cf. right part of Figure 2). The message type start is uniquely for the purpose of the initialization: initially, searcher a1 receives a message start (and hence calls procedure decide()). If searcher ai receives a message (move, j), then, by definition of such a message, it simply means that it is the turn of ai to proceed. Therefore, ai writes on the whiteboard of the node where it is currently standing that received a message from searcher aj giving it turn to proceed. For this purpose, ai pushes (RT, i, j) in the local stack. The nature of the next actions of ai depends on the result of procedure decide(). Let us list all other cases depending on the message received by ai . If ai receives a message (help, j) then it means that aj has just arrived at the same node as ai to help him. Thus, ai pushes (RT, i, j) in the local stack, and clears the edge with the smallest port number p among all contaminated edges incident to the node where ai is standing. This action is performed by calling procedure clear edge(CJ, i, p). Finally, if ai receives a message (sorry, j), then it means that ai had sent a message (move, i) or a message (help, i) to aj but aj could not do anything, or all actions aj attempted lead to backtracking. Therefore, ai calls procedure back() to figure out which searcher it can help next. The action of searcher ai arriving at some node v by port p depends on its local state. In state (help, j), ai aims at joining aj to help him clearing the network. Hence ai pushes (AH, i, p) in the local stack to indicate that it arrived here by port p in order to join another searcher, and then calls procedure join() to figure out what to do next in order to join aj . Procedure join() uses indications on whiteboards. Recall that if aj was at a node, the whiteboard contains in direction[j] the port number through which aj left that node.
Distributed Chasing of Network Intruders
clear_edge(action X, ID i, port p) /* X ∈ {CC; CJ} */ begin push(X, i, p); cleared_port[p] ← 1; state ← clear; move(p); end move(port_number p) begin direction[i] ← p; leave current vertex by port number p; end
81
next_searcher(searcher_ID i) begin j ← i + 1; if i is not smallest searcher at v then while (j is at node v) and (j ≤ k) do j ← j + 1; if j ≤ k then push(ST, i, j); send (move, i) to j; else back() end
Fig. 3. Procedures clear_edge, next_searcher and move
Agent ai returns to the homebase using direction[0] until it passes through a node where direction[j] is set, in which case ai starts following this direction to eventually find aj . In state backtrack, ai simply calls procedure back() to carry on its backtracking. The case where ai arrive at a node v in state clear is more evolved. If there is no other searcher at v then ai erases the whiteboard since it was accessible to the intruder, and thus its content is meaningless (when a searchers arases a whiteboard, it reset all local variables to 0, and the stack to ∅). Then ai sets direction[0] to p to indicate that it arrived here via port p, and sets cleared_port[p] to 1 to indicate that the edge of port p is clear. ai then pushes (AC, i, p) in the local stack at v to indicate that indeed ai arrived at v by port p after clearing the corresponding edge. At this point, the behavior of ai depends on whether i = 1 or not. While a1 simply calls decide() to figure out what to do next, ai for i > 1 proposes to a1 to proceed next. For this purpose, ai sends a message (move, i) to a1 . Of course, to keep trace of this action, ai pushes (ST, i, 1) in the local stack. Remark. Note that the actions are ordered. For instance, if several incident edges can be cleared then the cleared one is with the smallest port number. Similarly, after clearing an edge, ai proposes to the smallest searcher a1 to proceed next. Protocol dist_search always tries to perform the smallest action. This is in particular the role of procedure next searcher(i) described on the right side of Figure 3. This procedure aims at determining which searcher aj proceeds next. In the case where ai is the searcher with smallest index occupying the node, j = i + 1. Otherwise, i.e., ai is not the searcher with smallest index occupying the node, j is the smallest index > i such that aj is not occupying the same node as ai . Once j is found, ai offers to aj to proceed next, by sending it a message (move, i). As always, a trace of this action is kept at the current node by pushing (ST, i, j) in the local stack. If there is no aj with j > i occupying a node different from the one occupied by ai , then ai calls back() for the purpose of backtracking. The procedures clear edge() and move() described in the left side of Figure 3 execute clearing an edge, and traversing an edge, respectively. (Of course, clearing an edge requires traversing it). Procedures decide(), back(), and join() are avoided due to lack of space.
82
5
L. Blin et al.
Sketch of Proof of Dist_Search
First, one can check that at any step of dist_search there is only one operation performed, on only one of the stacks distributed over all nodes of the network. Indeed, only the searcher who has just received a message can perform an action, and in particular modify a stack. Thus we can define a virtual stack, Qvirtual , where we push or pop all the moves performed by the searchers, instead of pushing or popping them in and out of the distributed stacks. Precisely, a move is a pair (ai → aj , p) to be interpreted as follows. If i = j, then (ai → aj , p) means that ai leaves its current node by port p with the objective of joining aj . The move (ai → ai , p) means that ai leaves its current node by port p, for clearing the corresponding edge. Clearly, an extended move corresponds to a sequence of moves. From the interpretation above, the extended move (ai , ai , p) is identical to the move (ai → ai , p), and if i = j then the extended move (ai , aj , p) is identical to the sequence of moves (ai → aj , p1 ), (ai → aj , p2 ), . . . , (ai → aj , pℓ ), (min{ai , aj } → min{ai , aj }, p) where p1 , . . . , pℓ is a sequence of port numbers corresponding to a clear path from the node occupied by ai to the node occupied by aj when the extended move (ai , aj , p) is considered. Qvirtual is updated in the following way. At every execution of the Procedure move(), we push or pop a move in Qvirtual as follows. If ai applies move(p) during the execution of Procedure clear edge(X, i, p), then the move (ai → ai , p) is pushed in Qvirtual . If ai applies move(p) during the execution of Procedure join(j), then the move (ai → aj , p) is pushed in Qvirtual . Finally, if a searcher applies move(p) during the execution of Procedure back(), then Qvirtual is popped. With this definition of Qvirtual , we show that the stack Q of the centralized algorithm A, and the virtual stack Qvirtual are equivalent in the following way. Let Q = M1 | · · · |Mr be a sequence of extended moves (possibly empty). Qvirtual is strongly equivalent to Q if, for any 1 ≤ j ≤ r, there exists a sequence of moves Sj equivalent to Mj such that Qvirtual = S1 | · · · |Sr . Qvirtual is weakly equivalent to Q if for any 1 ≤ j ≤ r, there exists a sequence of moves Sj equivalent to Mj such that Qvirtual = S1 | · · · |Sr |Sr+1 where Sr+1 = (ai → ai′ , p1 ), (ai → ai′ , p2 ), . . . , (ai → ai′ , pℓ ) where p1 , · · · , pℓ is a sequence of port numbers corresponding to a path from a searcher ai to a searcher ai′ , in the cleared part of the graph corresponding to the configuration associated to Q in state M1 | · · · |Mr . Two strongly equivalent stacks correspond to exactly the same strategy (i.e., at the end of both strategies, the set of cleared edges, and the positions of the searchers are the same). If Q and Qvirtual are weakly equivalent, then the strategy associated to Qvirtual consists in performing the strategy associated to Q and then to move some searcher to the node occupied by some other searcher (via a path in the cleared part of the graph, and without recontamination). The proof of dist_search proceeds by considering the algorithm step by step, where a step is a moment of the execution where an edge is either cleared or recontaminated. That is, a step of dist_search denotes a step of its execution when a move of type (ai → ai , p) is pushed in or popped out Qvirtual .
Distributed Chasing of Network Intruders
83
Formally, we prove that, for any t ≥ 0, the virtual stack Qvirtual after step t of dist_search is equivalent to the stack Q constructed by A. In other words, we prove that, at any step t ≥ 0, both algorithms construct the same partial strategy, that is the cleared subgraph and the positions of the searchers that guard the border of this cleared subgraph are the same for both strategies. Simultaneously, we prove that for any step, when an extended move is popped out in A, all the traces of the equivalent sequence of moves in dist_search are removed from the distributed whiteboards. Our proof is by induction on number of steps. Let us assume that the centralized stack Q and the virtual stack Qvirtual are equivalent up to step t. We consider the next step. The difficulty of the proof is in the number of different cases to consider. There are actually exactly fourteen cases to consider, grouped in two groups: – Group A: Q and Qvirtual just cleared an edge e. The first case is if the graph is entirely clear. Otherwise there are 3 cases: (1) a searcher can clear a new edge alone, or (2) a searcher can join another searcher and one of them can clear a new edge, or (3) no other edge can be cleared and the clearing of e has to be canceled. These cases have to be combined with 3 other cases depending on the way e has been cleared. Thus Group A yields 7 cases in total. – Group B: Q and Qvirtual just cancelled the clearing of an edge. Then, either another edge e can be cleared, or no other edge can be cleared (and the last cleared edge, say e′ , has to be canceled). In the former case, there are 3 subcases depending on the type of move that has been popped out the stack (canceling corresponding to popping out the stack). In the latter case, there are 4 subcases depending on the way e′ had been cleared. Thus Group B yields 7 additional cases. The proof of correctness consists in a careful analysis of each of these 14 cases. Finally, every agent uses at most O(log k) bits of memory to store the label of another agent in state (help, j). The whiteboard size is O(m log n) by a careful analysis of the protocol. Acknowledgments. The first and fourth authors received additional supports from the project “ALGOL” of the ACI Masses de Donn´ees, and from the project “ROM-EO” of the RNRT program. The second and third authors received additional supports from the project “PairAPair” of the ACI Masses de Donn´ees, from the project “Fragile” of the ACI S´ecurit´e Informatique, and from the project “Grand Large” of INRIA.
References 1. S. Arnborg, D. Corneil, and A. Proskurowski. Complexity of finding embeddings in a k-tree. SIAM J. Alg. Disc. Meth. 8(2):277-284, 1987. 2. L. Barri`ere, P. Flocchini, P. Fraigniaud, and N. Santoro. Capture of an intruder by mobile agents. In 14th ACM Symp. on Parallel Algorithms and Architectures (SPAA), pages 200-209, 2002.
84
L. Blin et al.
3. L. Barri`ere, P. Fraigniaud, N. Santoro, and D. M. Thilikos. Searching is not jumping. In 29th Workshop on Graph Theoretic Concepts in Computer Science (WG), Springer-Verlag, LNCS 2880, pages 34–45, 2003. 4. D. Bienstock, Graph searching, path-width, tree-width and related problems (a survey), DIMACS Ser. in Discrete Mathematics and Theoretical Computer Science, 5 (1991), pp. 33–49. 5. D. Bienstock and P. Seymour. Monotonicity in graph searching. Journal of Algorithms 12:239–245, 1991. 6. R. Breisch. An intuitive approach to speleotopology. Southwestern Cavers VI(5):72–78, 1967. 7. U. Feige, M. Hajiaghayi, and J. Lee. Improved approximation algorithms for minimum-weight vertex separators. In 37th ACM Symposium on Theory of Computing (STOC), 2005. 8. P. Flocchini, F.L. Luccio, and L. Song. Decontamination of chordal rings and tori. Proc. of 8th Workshop on Advances in Parallel and Distributed Computational Models (APDCM), 2006. 9. P. Flocchini, M. J. Huang, F.L. Luccio. Contiguous search in the hypercube for capturing an intruder. Proc. of 18th IEEE Int. Parallel and Distributed Processing Symposium (IPDPS), 2005. 10. F. Fomin, P. Fraigniaud and N. Nisse. Nondeterministic Graph Searching: From Pathwidth to Treewidth. In 30th International Symposium on Mathematical Foundations of Computer Science (MFCS), LNCS 3618, pages 364-375, Springer, 2005. 11. F. V. Fomin, D. Kratsch, and I. Todinca. Exact algorithms for treewidth and minimum fill-in. In 31st Int. Colloquium on Automata, Languages and Programming (ICALP 2004), LNCS vol. 3142, Springer, pp. 568–580, 2004. 12. P. Fraigniaud and D. Ilcinkas. Directed Graphs Exploration with Little Memory. Proc. 21st Symposium on Theoretical Aspects of Computer Science (STACS), LNCS 2296, pages 246-257, 2004. 13. P. Fraigniaud and N. Nisse. Connected Treewidth and Connected Graph Searching. In 7th Latin American Theoretical Informatics, LNCS 3887, pages 470-490, 2005. 14. L. Kirousis, C. Papadimitriou. Interval graphs and searching. Discrete Math. 55, pages 181-184, 1985. 15. L. Kirousis, C. Papadimitriou. Searching and Pebbling. Theoretical Computer Science 47, pages 205-218, 1986. 16. A. Lapaugh. Recontamination does not help to search a graph. Journal of the ACM 40(2):224–245, 1993. 17. F. S. Makedon and I. H. Sudborough, On minimizing width in linear layouts, Discrete Appl. Math., 23:243–265, 1989. 18. N. Megiddo, S. Hakimi, M. Garey, D. Johnson and C. Papadimitriou. The complexity of searching a graph. Journal of the ACM 35(1):18–44, 1988. 19. T. Parsons. Pursuit-evasion in a graph. Theory and Applications of Graphs, Lecture Notes in Mathematics, Springer-Verlag, pages 426–441, 1976. 20. K. Skodinis Computing optimal linear layout of trees in linear time. In 8th European Symp. on Algorithms (ESA), Springer, LNCS 1879, pages 403-414, 2000. (Also, to appear in SIAM Journal on Computing). 21. B. Yang, D. Dyer, and B. Alspach. Sweeping Graphs with Large Clique Number. In 15th Annual International Symposium on Algorithms and Computation (ISAAC), pages 908-920, 2004.
Election in the Qualitative World J´er´emie Chalopin LaBRI, Universit´e Bordeaux 1 351 cours de la Lib´eration 33405 Talence, France [email protected]
Abstract. In [3], Barri`ere et al. consider a qualitative model of distributed computing, where the labels of the entities are distinct but mutually incomparable. They study the leader election problem in a distributed mobile environment and they wonder whether there exists an algorithm such that for each distributed mobile environment, it either states that the problem cannot be solved in this environment, or it successfully elects a leader. In this paper, we give a positive answer to this question. We also give a characterization of the distributed mobile environments where the election problem can be solved.
1
Introduction
Consider an intercontinental highway network linking different cities in different countries. In each city, the directions to the other cities are written in the language that is locally spoken. Consider now a set of different drivers coming from different countries. Initially, each driver starts in his town and all the drivers want to meet at a single place. The only mean they have to communicate is to leave messages in each city they reach, but each driver can only speak his mother tongue: he can see that another driver left some message, but he cannot understand it. Moreover, each driver can consistently distinguish the different directions in each city, but the drivers cannot agree on an alphabetical order on these directions: a French driver would not be able to figure out how to order Chinese words in the Chinese way, for example. We wonder whether there exists a procedure that enables them to meet at a single point in a finite time. In distributed computing, the links incident to each process are usually labelled by distinct numbers in order to allow each process (or each mobile agent) to consistently distinguish its neighbours; this labelling is usually called a portsnumbering. In fact, these numbers allow not only to distinguish the links, but also to order them. Many distributed algorithms assume also that all the processes can be unambiguously identified, and therefore the processes are given numbers. Again, one can see that this allows to order the different processes according to their labels. This usual setting is a quantitative model, since each label can be seen as a number. Nevertheless, as in the example presented above, one may be able to distinguish labels without being able to order them. In this paper, we consider P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 85–99, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
86
J. Chalopin
distributed mobile environments where mobile agents are scattered all over a network. All the agents have distinct colors (their labels), which are mutually incomparable: each agent can just check whether two colors are equal or not. The links incident to each vertex are also given distinct incomparable colors. This model is close to the one introduced by Barri`ere et al. in [3]; it is qualitative, in the sense that there is no a priori order between the labels. As in [3], we study the impact of the lack of a total order on the set of labels in a distributed mobile environment. In this way, we investigate the leader election problem, that is a classical problem to highlight the differences between various models of distributed computing. In usual models, there is always an implicit order over the set of labels, since for each agent, each information is just a sequence of bits. Nevertheless, consider an algorithm designed to be executed by mobile agents over a network. If the agents have been implemented by different companies, and if the specifications of the algorithm do not specify how the integers must be represented, some agents can for instance store numbers with most significant bit first whereas other agents store numbers with least significant bit first; in this case, the agents would not agree on the meaning of the sequence 01101. Moreover, it is always interesting to deal with algorithms that need less specifications, since they are generally more robust, and easier to implement in different models of distributed computing. The Model. In this paper, an agent is an entity which executes an algorithm: it can move from place to place (with some data and its algorithm) through communication links, it can make local computations on a place (a place provides tools for local computations: data, memories and process) and leave messages on a place. In our model, the environment is represented by a simple undirected connected graph G = (V (G), E(G)) and a set E of mobile agents is scattered over G. Communications between agents is achieved through writing messages on whiteboards, where agents can read, write, and erase messages. There is one whiteboard on each vertex of G, and access to a whiteboard is in mutual exclusion. Initially, all the whiteboards are empty. Let p : E → V (G) be the injection describing the initial placement of the agents in G. The vertex p(r) is called the homebase of the agent r ∈ E. We will denote such a distributed mobile environment by (G, E, p). We consider a set of colors C and a function color : E → C that associates to each agent a unique color. There is no a priori order on the set of colors: each agent can give its own order on the set of colors, but the agents do not agree on a particular order. Each agent can understand a message it has written, but it cannot understand a message written by another agent, it can just know the color of the message. We also suppose that initially, the homebases are marked: they contain a marker that enables each agent to know that a place is a homebase and to detect the color of this homebase. In each place, the incident links are labelled by different colors that enable each agent to consistently distinguish the neighbours of the place: for each vertex u, there exists an injective function δu that associates a color from a new set C ′ (i.e., C ′ ∩ C = ∅) to each edge incident
Election in the Qualitative World
87
to u. The set δ = {δu : u ∈ V (G)} constitutes the ports-labelling of G. Thanks to this labelling δ, each agent can make a distinction between the incident edges of each vertex. Such a distributed colored mobile environment will be denoted by (G, δ, E, p, color). The agents are asynchronous, in the sense that every action they perform (computing, moving, etc.) takes a finite but otherwise unpredictable amount of time. Moreover, we suppose that an agent has not an initial knowledge of the network topology, neither of its size nor of the number of agents in the system. The actions an agent a located at a node v can perform depends on the current state of a, the current state of the whiteboard at v, and the color of the port through which a entered v. According to these informations, a can decide to write a message on the whiteboard of v, to leave v (through a port whose color may result from some computation), or to stay at v (for example, to wait that another agent leaves a message on the whiteboard). This model is more restrictive than the one presented in [3], since in the model of Barri`ere et al. the agents cannot agree on an order on the set of colors, but they fully understand the symbols written by the other agents. However, the necessary condition presented in our model is the same as the one presented in [3]: the results presented in this paper remain true in the model of [3]. The Election Problem. The election problem is one of the paradigms of the theory of distributed computing. In the distributed mobile setting, the aim of a leader election algorithm is to distinguish one agent among the others. All the agents execute the same protocol, i.e., the only initial difference between two agents is their colors. At the end of the execution of the algorithm, there is exactly one agent in the state elected, whereas all the other agents enter the state non-elected. Moreover, it is supposed that once an agent enters in the state elected or non-elected, it remains in such a state until the end of the computation. Another important problem in this setting is the rendez-vous problem. The aim of a rendez-vous algorithm is to reach a configuration where all the mobile agents gather in the same vertex of the graph. These two problems are equivalent, since once an agent has been elected, if all the agents agree on the label elected, all the agents can gather in the homebase of the elected agent. Reversely, once all the agents have gathered in some place, the first agent that writes on the whiteboard of this place is elected, whereas all the others become non-elected. There exists a large variety of results for these problems in the mobile agent setting assuming different properties of the environment [2, 4, 5, 10, 11]. The election problem has also been extensively studied in the distributed setting, and particularly in anonymous networks, where the processes do not have distinct labels [1, 6, 9, 13]. Consider a graph G and a set of agents E scattered over the network according to a function p. We say that we can solve the election problem on (G, E, p) if the problem can be solved on (G, δ, E, p, color) for all ports-labellings δ and all agent-coloring functions color. This implies that an election algorithm in the distributed mobile environment (G, E, p) must not use some particularity of the ports-labelling or make any assumption on the set of colors (for example, if one know that there is always a red agent, one can design an algorithm that elects
88
J. Chalopin
the red agent). Note that, as for anonymous networks in the distributed setting [9, 13], the protocols must not depend on the ports-labelling. Indeed, the role of the ports-labelling is just to enable an agent to make a distinction between the different neighbours of a vertex. As in [3], we say that an algorithm A is an effective election algorithm if for each distributed mobile environment (G, E, p), each ports-labelling δ and each coloring function color, for all the executions of A on (G, δ, E, p, color), either all the agents detect that the election problem cannot be solved in (G, E, p), or the agents successfully elect one of them. In particular, note that such an algorithm does not need any initial knowledge about the topology, the size, the diameter of the network or about the number of agents. Main Results. In this work, we give a characterization (Theorem 1) of distributed mobile environments, where the election problem can be solved. In [3], Barri`ere et al. wonder whether there exists an effective algorithm for the qualitative world. The algorithm we describe gives a positive answer to this question (Theorem 2). To obtain a necessary condition (Proposition 2), we use well-balanced automorphisms that have been introduced by Boug´e in [8]. Then, we show that this necessary condition is also sufficient: we use some links between fibrations and automorphisms presented in [7] to describe an effective algorithm in Section 4.2 that solves the election problem when the necessary condition is satisfied.
2
Preliminaries
Labelled Digraphs. In the following, we will consider directed graphs (digraphs) with multiple arcs and self-loops. A digraph D = (V (D), A(D), sD , tD ) is defined by a set V (D) of vertices, a set A(D) of arcs and by two maps sD and tD that assign to each arc two elements of V (D) : a source and a target (in general, the subscripts will be omitted); if a is an arc, the arc a is said to be going out of s(a) and coming into t(a). We say that s(a) is a predecessor of t(a) and that t(a) is a successor of s(a). A digraph D is strongly connected if for all vertices u, v ∈ V (D), there exists a sequence of arcs a1 , a2 , . . . ap such that s(a1 ) = u, ∀i ∈ [1, p − 1], t(ai ) = s(ai+1 ) and t(ap ) = v. In the following, we will only consider strongly connected digraphs. A symmetric digraph D is a digraph endowed with a symmetry, that is, an involution Sym : A(D) → A(D) such that for every a ∈ A(D), s(a) = t(Sym(a)). A digraph homomorphism γ between the digraph D and the digraph D′ is a mapping γ : V (D) ∪ A(D) → V (D′ ) ∪ A(D′ ) such that if u, v are vertices of D and a is an arc such that u = s(a) and v = t(a) then γ(u) = s(γ(a)) and γ(v) = t(γ(a)). We say that γ is an isomorphism if γ is bijective and γ −1 is a homomorphism, too. Throughout the paper we will consider digraphs where the vertices and the arcs are labelled with labels from a recursive label set L. A digraph G labelled over L will be denoted by (D, λ), where λ : V (D) ∪ A(D) → L is the labelling
Election in the Qualitative World
89
function. The digraph D is called the underlying digraph and the mapping λ is a labelling of D. A mapping γ : V (D)∪A(D) → V (D′ )∪A(D′ ) is a homomorphism from (D, λ) to (D′ , λ′ ) if γ is a digraph homomorphism from D to D′ which preserves the labelling, i.e., such that λ′ (γ(x)) = λ(x) for every x ∈ V (D)∪A(D). Labelled digraphs will be designated by bold letters like D, G, . . . If D is a labelled digraph, then D denotes the underlying digraph. Let G = (V (G), E(G)) be a connected simple graph. The symmetric strongly connected digraph associated to G and denoted by Dir(G) is (V, A) defined by: there is an arc a1 from v1 to v2 and an arc a2 from v2 to v1 in A if {v1 , v2 } ∈ E(G) and Sym(a1 ) = a2 . Note that this digraph does not contain multiple arcs or selfloops. Given a mobile environment (G, E, p), we define the labelling function χp of the vertices by χp (v) = 1 if there exists an agent a such that p(a) = v, and χp (v) = 0 otherwise. A distributed mobile environment (G, E, p) can therefore be represented by the labelled digraph (Dir(G), χp ). For any set S, |S| denotes the cardinality of S. For any integer q, we denote by [1, q] the set of integers {1, 2, . . . , q}. Fibrations and Coverings. The notions of fibrations and coverings are fundamental in this work; definitions and main properties are presented in [7]. A fibration between the digraphs D and D′ is a homomorphism ϕ from D to ′ D such that for each arc a′ of A(D′ ) and for each vertex v of V (D) such that ϕ(v) = v ′ = t(a′ ) there exists a unique arc a in A(D) such that t(a) = v and ϕ(a) = a′ . The arc a is called the lifting of a′ at v, D is called the total digraph and D′ the base of ϕ. We shall also say that D is fibred (over D′ ). The fibre over a vertex v ′ (resp. an arc a′ ) of D′ is the set ϕ−1 (v ′ ) of vertices of D (resp. the set ϕ−1 (a′ ) of arcs of D). An opfibration between the digraphs D and D′ is a homomorphism ϕ from D to D′ such that for each arc a′ of A(D′ ) and for each vertex v of V (D) such that ϕ(v) = v ′ = s(a′ ) there exists a unique arc a in A(D) such that s(a) = v and ϕ(a) = a′ . A covering projection is a fibration that is also an opfibration. If a covering projection ϕ : D → D′ exists, D is said to be a covering of D′ via ϕ. A symmetric digraph D is a symmetric covering of a symmetric digraph D′ via a homomorphism ϕ if D is a covering of D′ via ϕ such that ∀a ∈ A(D), ϕ(Sym(a)) = Sym(ϕ(a)). A digraph D is symmetric-covering-minimal if there does not exist any digraph D′ not isomorphic to D such that D is a symmetric covering of D′ . Given two strongly connected digraphs D and D′ , an interesting property satisfied by any covering projection ϕ from D to D′ is that there exists q ∈ N such that ∀x′ ∈ V (D′ ) ∪ A(D′ ), |ϕ−1 (x′ )| = q. The notions of fibrations and coverings extend to labelled digraphs in a natural way: the homomorphisms must preserve the labelling. Examples of fibrations and coverings are given in Figure 1. Fibrations, Coverings and Automorphisms. We now describe some properties of the relations that exist between fibrations and the automorphisms of a digraph. These results are described and proved in [7].
90
J. Chalopin 2 1
2
1
1
G
H 1
BΓ (G) (G) G/Γ (G)
2
1
2
1
2
1
2
1
2
BΓ (H) (H) H/Γ (H)
Fig. 1. The digraph G is fibred over BΓ (G) (G) via the homomorphism ϕG that maps each vertex of G labelled i to the unique vertex labelled i of BΓ (G) (G). The digraph H is a covering of BΓ (H) (H) via the homomorphism ϕH defined in the same way. The digraph G/Γ (G) (resp. H/Γ (H)) is the digraph whose vertices and arcs correspond to equivalence classes of vertices and arcs of G (resp. H) under the action of Γ (G) (resp. Γ (H)).
An automorphism σ of a digraph G is an isomorphism from the digraph G onto itself. Consider a subgroup Γ of the group Γ (G) = Aut(G) of the automorphisms of a digraph G = (G, λ); we will denote by Id the identity automorphism of G. The action of this group on G induces an equivalence relation over the vertices and the arcs of G: for each x, x′ ∈ V (G)∪A(G), x ∼Γ x′ if there exists σ ∈ Γ such that σ(x) = x′ . The equivalence class of x is called the orbit of x and is denoted by [x]Γ . Recall that an automorphism of (G, λ) must preserve the labelling, and therefore for all elements x1 , x2 ∈ [x]Γ , λ(x1 ) = λ(x2 ). If Γ = Γ (G), we will note x ∼ x′ (resp. [x]) for x ∼Γ x′ (resp. [x]Γ ). Remark 1. For all vertices v, v ′ ∈ V (G), if v ∼Γ v ′ , then there is a bijection between the incoming arcs of v and the incoming arcs of v ′ . We will now describe two kinds of constructions. The first one allows us to build a digraph BΓ (G) from a digraph G such that G is fibred over BΓ (G). The second one allows to build the quotient-graph G/Γ . Examples are presented in Figure 1 where Γ = Γ (G). From the relation ∼Γ , we construct the directed graph BΓ (G) defined as follows: V (BΓ (G)) is the set of the equivalence classes of V (G) under the action of Γ and there are as many arcs from [v]Γ to [w]Γ as each vertex in [w]Γ has predecessors in [v]Γ . Due to Remark 1, this does not depend on the choice of the element of [w]Γ . We define the labelling ν of BΓ (G) by ν([v]Γ ) = λ(v) for each v ∈ V (G). We label the arcs from [v] to [w] with the labels of the arcs from the elements of [v] to w in G. By Remark 1, there exists a fibration ϕ from G to (BΓ (G), ν). We consider also the quotient-graph G/Γ whose vertices and arcs are the equivalence classes of the vertices and the arcs of G under the action of Γ and whose labelling μ is defined by μ([x]Γ ) = λ(x) for each x ∈ V (G) ∪ A(G). There exists a natural surjective homomorphism from (BΓ (G), ν) to G/Γ which is the
Election in the Qualitative World
91
identity on the vertices and which maps an arc a to [a]Γ (a can be seen as an arc of G). We say that a subgroup Γ of Γ (G) acts freely on G if for each x, y ∈ V (G) ∪ A(G), there is at most one σ ∈ Γ such that σ(x) = y. Equivalently, Γ acts freely on G if and only if for each σ ∈ Γ \ {Id}, σ has no fixpoint. In the following, we will use a particular class of automorphisms: the class of well-balanced automorphisms. These automorphisms have been introduced by Boug´e in [8] to study the importance of the guards in CSP through the symmetric election problem. In [12], Palamidessi uses also well-balanced automorphisms to study the same problem in order to give a hierarchy between different subsets of the π-calculus. An automorphism σ of a digraph G is well-balanced if there exists an integer q such that for each vertex or arc x of G, |{σ k (x) | k ∈ N}| = q. Equivalently, σ is well-balanced if and only if the subgroup Γσ generated by σ acts freely on G. The group Γ contains only well-balanced automorphisms if and only if Γ acts freely on G. Thanks to this equivalence and the results of Boldi and Vigna [7], we have the following property. Proposition 1. Given any strongly connected digraph G, the quotient projection Γ : G → G/Γ is a covering projection if and only if for each σ ∈ Γ , σ is well-balanced.
3
Impossibility Result
The following proposition gives a necessary condition that the distributed mobile environment (G, E, p) must verify if there exists an election algorithm for (G, E, p). This necessary condition is equivalent to the one presented in [3]. Proposition 2. Consider a graph G and an initial placement of the agents p. If there exists a non-trivial well-balanced automorphism σ of the digraph G′ = (Dir(G), χp ), then there is no election algorithm over the graph G with the initial placement of the agents p. Using known results in distributed computing [6, 9, 13], we can show that in the anonymous setting, i.e., when the agents can understand each other but do not have distinct labels, there exists an election algorithm for an environment (G, E, p) if and only if the labelled digraph G′ = (Dir(G), χp ) is symmetriccovering-minimal. Moreover, from Proposition 1, we know that if the symmetric digraph G′ = (Dir(G), χp ) admits a non-trivial well-balanced automorphism σ, then G′ is a symmetric covering of G′ /Γσ that is not isomorphic to G′ . Consequently, an interesting corollary of Proposition 2 is that if the election problem cannot be solved on (G, E, p) in the qualitative setting, then it cannot be solved on (G, E, p) in the anonymous setting. On the other hand, we will show in the following that this necessary condition is also sufficient. Note that there exist symmetric digraphs that are not symmetric-covering-minimal and that does not admit any non-trivial well-balanced automorphism. It means that one can solve the election problem in strictly more environments in the qualitative setting than in the anonymous one.
92
4 4.1
J. Chalopin
An Effective Election Algorithm How to Order the Equivalence Classes?
We use the same ideas as Barri`ere et al. [3] to define a total order between the different equivalent classes. The idea is to construct an ordering on the unlabelled digraphs of size n; we extend it to digraphs labelled by elements of a totally ordered set. Consider a labelled digraph G = (G, λ) without multiple arcs where λ is a labelling function from V (G) ∪ A(G) to a totally ordered set L with a minimal element ⊥. We suppose that ∀x ∈ V (G) ∪ A(G), λ(x) ∈ L \ {⊥}. Let n = |V (G)| and consider an enumeration function num of the vertices (i.e., num is a one-to-one mapping from V (G) onto [1, n]). We say that num is an increasing enumeration of the vertices if for all vertices v, v ′ ∈ V (G), if num(v) ≤ num(v ′ ), then λ(v) ≤L λ(v ′ ). Given an increasing enumeration num, we define the adjacency matrix Mnum as follows: for all vertices v, v ′ , Mnum [num(v), num(v ′ )] = ℓ, if there is an arc from v to v ′ labelled by ℓ, and Mnum [num(v), num(v ′ )] = ⊥ otherwise. To this matrix, we associate the word w(Mnum ) obtained by the concatenation of the n rows of Mnum . To each vertex v ∈ V (G) (resp. arc a ∈ A(G)), we choose num such that (num(v), w(Mnum )) (resp. (num(s(a)), num(t(a)), w(Mnum ))) is minimum for the lexicographic order and associate this value, denoted by π(v) (resp. π(a)), to v (resp. a). Note that there exists an automorphism σ of G such that σ(x) = x′ if and only if π(x) = π(x′ ). Consequently, this induces a total ordering of the equivalence classes of vertices and arcs: we will write [x′ ] ≺ [x] if π(x) is greater than π(x′ ) in the lexicographic order. Remark 2. In the following, we will show that all the agents agree on a total order of the classes and all the agents use the same order. Actually, as it was already explained in [3], even if the agents cannot agree on an a priori order over the set of colors, they can agree on an order on the different classes, provided that all the agents have the same representation of the graph (up to isomorphism). In fact, we suppose that each agent has its own totally ordered set isomorphic to (N, ≤) and each agent can use its own way to compute its order: the algorithm does not make any assumption on the way the order is implemented by each agent. 4.2
An Election Algorithm
In this subsection, we describe our effective election algorithm. In a first phase all the agents reconstruct the digraph (Dir(G), χp ) and check that the election problem can be solved on (G, E, p). Then, using its knowledge of the graph, each agent constructs the equivalence classes induced by Γ ((Dir(G), χp )). During successive rounds, using the order between the different classes defined above, some agents become passive and get the label non-elected, whereas the active agents mark some vertices and some arcs of the digraph to obtain a new labelling μ of the digraph on which all the active agents agree. At the end of the computation,
Election in the Qualitative World
93
the automorphism group of (Dir(G), µ) consists only of the identity and each vertex has a unique label. At this point, there is exactly one active agent that is elected. A high level description of the algorithm is presented in Algorithm 1. Algorithm 1. The Election Algorithm Every agent builds a map of the graph; Synchronization; if there exists a non-trivial well-balanced automorphism of G′ = (Dir(G), χp ) then Every agent knows that it is impossible to solve the election problem; else Every agent marks as many vertices as possible; Synchronization; /* Initially, all the agents are active */ repeat The active agents compute the classes of all the vertices and all the arcs; The active agents give different numbers to different classes of vertices and arcs; if All the active agents are not in the same class then Select active agents; The passive agents take the label non-elected ; The active agents mark the homebases of the passive agents; Synchronization; else if G′ is not a covering of BΓ (G′ ) (G′ ) then The active agents mark a class of vertices; Synchronization; else if G′ is not a covering of G′ /Γ (G′ ) then The active agents mark a class of arcs; Synchronization; else /* In this case, there is exactly one active agent */ The active agent takes the label elected ; until An agent is elected ;
A Synchronization Procedure. In the algorithm we describe below, we distinguish different rounds. An important point is that an active agent does not enter in a new round if another active agent has not finished the previous one. To be able to avoid this kind of situation, we synchronize the active agents. Each agent can consistently distinguish its homebase; therefore, we can construct an algorithm such that no agent needs to write anything on its homebase. Moreover, we suppose that each agent has already built its own map of the graph and does not need to write anything on any whiteboard in order to perform a traversal of the graph. In the following, the active agents will do some traversals of the network and they will store the colors of the marks that appear on each vertex to construct what we will call a colored map of the network. The marks that appear in a colored map of an active agent will correspond to marks that have been put by other active agents during the round (but it will not necessary contain all
94
J. Chalopin
the marks the active agents should put during this round). In the algorithm described below, each active agent can know from a colored map if any other active agent has marked all the vertices it should have marked during the round. Furthermore, in each round of the algorithm, each agent will mark at least one vertex (which is not its homebase). In the synchronization procedure described below, some active agents will have to wait on some particular vertices for other agents to put (resp. remove) some marks. Each time an agent arrives on a place where it has to wait for a mark to be put (resp. removed), it can immediately continue to execute the procedure if this mark is present (resp. not present). To synchronize the agents, we proceed as follows. During each round, each active agent r executes the following instructions. (1) The agent r marks some vertices (but not its homebase) according to the computation rules of the round. (2) The agent r does a traversal of the network and stores all the colors of the marks that appear on each vertex to construct a colored map of the network. (3) If there exists another active agent r′ that has not finished Step (1) (the agent r can detect it from the colored map it has of the network), then the agent r goes to the homebase of r′ and waits until the agent r′ puts a mark on its homebase. Then the agent r does a traversal of the network and stores all the colors of the marks that appear on each vertex in order to update its colored map of the network. (4) The agent r puts a mark on its homebase. (5) The agent r does a traversal of the network and each time it arrives on the homebase of another agent r′ , it waits until the agent r′ marks its homebase. (6) The agent r does a traversal of the network and it removes the marks it puts during Step (1), but not the mark on its homebase. (7) The agent r does a traversal of the network. Each time it arrives on a vertex that has been marked by another active agent r′ during this round (but that is not the homebase of r′ ), it waits until the agent r′ removes its mark. (8) The agent r removes the mark it puts on its homebase. (9) The agent r does a traversal of the network. Each time it arrives on the homebase of an active agent r′ , it waits until the agent r′ removes its mark on its homebase. We can note that the synchronization procedure enables also to erase all the marks that have been put on the vertices during the round, i.e., when one agent has finished Step (9) of a round, then all the marks that have been left by the active agents during this round have been erased. The following proposition ensures that the procedure is indeed a synchronization procedure. Proposition 3. Each time an agent starts executing Step (1) of the i + 1th round, then each active agent knows what vertices have been marked by the other active agents during Step (1) of the ith round and all the marks that have been put during the ith round have been removed. Moreover, the synchronization procedure avoids any deadlock.
Election in the Qualitative World
95
Initialization. During the first phase of the algorithm, each agent reconstructs the graph with the position and the colors of the different homebases. Using the whiteboards, each agent performs a depth first traversal of the graph. Since each agent can distinguish all the homebases, we suppose that during this traversal, the agents do not write anything on the whiteboard of any of the homebases. Once an agent has reconstructed the whole graph, it performs a traversal of the network using the information it has stored to erase what it has written on the whiteboards. At this point, each agent puts a mark on the homebase of another agent. During this first phase, no agent has written anything on its homebase. Furthermore, an agent has finished to perform this phase if and only if it has marked the homebase of another agent and this can be checked from a colored map of the network. Moreover, at the end of this phase, each agent has reconstructed a map of the network and it knows the position of all the homebases. We can therefore use the synchronization procedure defined above at this point. If the digraph (Dir(G), χp ) admits a well-balanced automorphism σ different from Id, then each agent detects it and declares that the election problem is unsolvable in this environment. We will now suppose that (Dir(G), χp ) does not admit such an automorphism. Once the graph is known by all the agents, each agent tries to mark as many vertices of the networks as possible. It does a traversal of the network and each time it arrives on a vertex that is not a homebase, it performs one of the two following actions. Either the whiteboard is blank and it puts a mark with its color on the whiteboard, or there is already a mark on the whiteboard and it stores the color of the mark. Once an agent has finished this traversal, it puts a mark on the homebase of another agent. Again we use the synchronization procedure at this point. Then each agent is aware of the different vertices marked by the other agents during this round. At the end of this phase, each agent reconstructs a graph where all the vertices are colored (they belong to the agent that has this color) and it knows the position and the color of the homebases of all the other agents. How can the agents increase their territory? During the different phases of the algorithm, some agents become passive whereas the others continue to execute the protocol in order to elect one of them. In our algorithm, in order to break the symmetry between the agents, all the vertices must belong to one active agent, and all the active agents must agree on which agent a vertex belongs to. During the initialization, each vertex is marked by one agent and we say that it belongs to this agent. Once an agent becomes passive, the vertices that were belonging to this agent must be given to another agent. Once a selection between agents is done, the agents that become passive take the label non-elected and become passive until the end of the algorithm, whereas the others try to mark the homebases of these agents that have just become passive. Each active agent knows what are the colors of the other active agents. From its representation of the graph, each active agent can reach the homebases of the passive agents.
96
J. Chalopin
The first agent that reaches such a homebase during this round puts a mark with its color on the vertex. The other agents (there is already a mark on the homebase when they reach it) store the color of the agent that owns this vertex (i.e., the color of the mark). Again, at the end of its traversal of the graph, each agent puts a mark on the homebase of another active agent. Therefore, each active agent can detect from a colored map if another active agent has finished this phase. Then the active agents apply the synchronization procedure. If an agent has marked the homebase of a passive agent, then all the vertices that were belonging to this passive agent belong now to this active agent. For each vertex of the graph, all the active agents agree on the color of the agent that owns this vertex. How to refine the labelling µ? During the execution of the algorithm, the agents mark vertices and arcs to break the symmetry that may exist in the network. In this way, at each round, numbers will be associated to some vertices and arcs and we will obtain a labelling of the graph µ. Initially, all the homebases have the label 1 whereas all the other vertices have the label 0 and all the arcs are labelled 0. At the beginning of each round, from its representation (Dir(G), µ) of the graph, each agent computes the value π(v) (resp. π(a)) for each vertex v ∈ V (Dir(G)) (resp. for each arc a ∈ A(Dir(G))). We say that two agents are equivalent if their homebases are in the same equivalence class, and we use the order ≺ on the homebases of the agents to order the classes of agents. Since all the agents agree on the order to compare the equivalence classes, we can use the following procedure. If there exist two vertices v, v ′ such that µ(v) = µ(v ′ ) and π(v) = π(v ′ ), then let m be the lowest number such that there exist v, v ′ with µ(v) = µ(v ′ ) = m and [v] ≺ [v ′ ]. Suppose that there exist exactly j classes {[vi ]|i ∈ [1, j]} such that µ(vi ) = m and [v1 ] ≺ [v2 ] ≺ · · · ≺ [vj ]. For each vertex v ∈ [vi ] with i < j, we define µ′ (v) = q + i, where q is the greatest label that appears on a vertex in (G, µ). The labels of the other vertices are not changed. We apply the same method to arcs using the order we have on the classes of arcs, i.e., the lexicographic order over the π(a). Thanks to this procedure, two arcs that are not in the same class are given distinct labels. We repeat this procedure, until all the vertices (resp. all the arcs) that have the same label are in the same equivalence class. If some active agents do not own the same number of vertices in a given class. We consider now a configuration such that two vertices (resp. arcs) in different classes have different numbers. Consider a class of agents [r] and a class of vertices [v]. We define N otBalanced([r], [v]) to be false if all the agents of [r] own the same number of vertices in [v], and true otherwise. If there exist [r], [v] such that N otBalanced([r], [v]) is true, then we apply the following technique to split some class of vertices. Consider the minimum class [r] of agents, according to ≺, such that there exists a class [v] of vertices satisfying N otBalanced([r], [v]). Consider the minimum class of vertices [v] such that N otBalanced([r], [v]) is true. In this case, we
Election in the Qualitative World
97
give different numbers to the homebases of the agents that do not own the same number of vertices in [v]. We subdivide the class [r] into a partition R1 , . . . , Rj such that the agents in Ri own strictly more vertices in [v] than the agents in Ri′ when i < i′ . Using the same technique as before, we give different numbers to the homebases of the agents that are not in the same Ri and then obtain a new representation of the digraph (Dir(G), µ′ ). Then, the agents try to refine again this new labelling. How to split the arc classes thanks to the colors of their ends? We will say that an arc a belongs to an agent r, if r owns s(a) and t(a). Otherwise, the arc is such that s(a) belongs to an agent r1 and t(a) to a distinct agent r2 . We will say that this arc is shared by r1 and r2 . If there exists a class of arcs [a] such that some arcs of [a] belong to some agents, whereas the other arcs are shared by distinct agents, then we apply the following technique. Consider a class of arcs a such that for each class [a′ ] ≺ [a], either [a′ ] contains only arcs that belong to some agents or [a′ ] contains only arcs shared by different agents. We suppose also that [a] contains arcs that belong to some agents and arcs that are shared. All the arcs in [a] that are shared by distinct agents are relabelled q + 1, where q is the greatest label that appears on an arc in (Dir(G), µ). Then, the agents try to refine again this new labelling. If some active agents are in different classes. At this point, if the active agents are not in the same equivalence class, we are able to select some agents. Consider all the equivalence classes of active agents that contains a minimal number of agents. Among these classes, we select the class [r] such that π(v) is minimal, where v is the homebase of r. The agents that do not belong to this class take the label non-elected and become passive. The agents of the class [r] remain active and try to increase their territory as explained above. Then they try to refine again the labelling µ. If G′ = (Dir(G), µ) is not a covering of BΓ (G′ ) (G′ ). There exist some configurations where it is impossible to select some agents just by using the representation the agents have of the graph, because there is too much symmetry in the graph. Nevertheless, we now explain how active agents can break these symmetries by marking some vertices or arcs. All the active agents agree on the graph G′ = (Dir(G), µ). All these agents consider the automorphism group Γ (G′ ) and construct the graphs BΓ (G′ ) (G′ ) and G′ /Γ (G′ ). We already know that G′ is fibred over BΓ (G′ ) (G′ ). If G′ is not a covering of BΓ (G′ ) (G′ ), it implies that there exist two classes of vertices [v] |[v ′ ]|. Let [r] be the class of the homebases of the active and [v ′ ] such that |[v]| = agents. Consider a class [v] such that for each class [v ′ ] ≺ [v], |[v ′ ]| = |[r]| and |[v]| = |[r]|. We already know that each active agent owns the same number of vertices in [v] and therefore |[r]| divides |[v]|. Each active agent then marks a vertex it owns that is in [v]. An agent has finished this round if and only if it has marked exactly one vertex in [v]: it can be detected from a colored map of the graph. Then, the agents synchronize.
98
J. Chalopin
At the end of this round, all the agents give the number q + 1 to the vertices that have just been marked, where q is the greatest label that appears on a vertex in (Dir(G), µ). Using this new labelling µ′ , the active agents try to refine the labelling µ′ , as explained above. If G′ = (Dir(G), µ) is not a covering of G′ /Γ (G′ ). We suppose now that G′ is a covering of BΓ (G′ ) (G′ ) but not of G′ /Γ (G′ ). It means that all the equivalence classes of vertices have the same size s, but there exists an equivalence class of arcs [a] such that |[a]| > s. Instead of marking vertices, we mark arcs in this round. Each class [a] of arcs of G′ corresponds to exactly one arc in G′ /Γ (G′ ). Consider the class of arcs [a] such that for each class [a′ ] ≺ [a], |[a′ ]| = s but |[a]| > s. We already know that each active agent owns exactly one vertex in [s(a)] and one vertex in [t(a)]. Since |[a]| > s and since two arcs in the same class are either both owned by an agent or both shared by distinct agents, we know that each arc in [a] is shared. To select arcs from [a], each agent r just chooses one arc ar in [a] such that s(ar ) belongs to r and then puts a mark with its color on t(ar ). An agent has finished this round if and only if it has marked exactly one vertex: it can be detected from a colored map of the graph. Then, the agents synchronize. Once an agent knows what vertices have been marked by the other agents, it knows what are the arcs that have been marked. At the end of this round, all the agents give the number q + 1 to the arcs that have just been marked, where q is the greatest label that appears on an arc in (Dir(G), µ). Using this new labelling µ′ , the active agents try to refine again the labelling µ′ , as explained above. If G′ is a covering of G′ /Γ (G′ ). At this point, G′ = (Dir(G), µ) is a covering of G′ /Γ (G′ ). From Proposition 1, it implies that Γ (G′ ) contains only well-balanced automorphisms, and since we already know that there is no wellbalanced isomorphism of (Dir(G), χp ) different from Id, we have Γ (G′ ) = {Id}. Consequently, there is exactly one active agent, since the set of active agents is an equivalence class of the relation induced by Γ (G′ ) and this agent takes the label elected. 4.3
The Characterization
In Section 3, we have shown that if the graph (Dir(G), χp ) admits a well-balanced automorphism, then it is impossible to solve the election problem on (G, E, p). The algorithm described in Section 4.2 is an algorithm that answers that it is impossible to solve the problem if the graph (Dir(G), χp ) admits a well-balanced automorphism, and otherwise it successfully elects an agent: it is an effective algorithm. We have therefore proved the following theorems. Theorem 1. There exists an election algorithm for a distributed mobile environment (G, E, p) if and only if (Dir(G), χp ) does not admit a non-trivial wellbalanced automorphism.
Election in the Qualitative World
99
Theorem 2. Algorithm 1 is an effective election algorithm in the qualitative world. The traditional complexity measures for mobile agents are the number of agents moves and the amount of time of a synchronous execution of the algorithm, where in each round, each active agent traverses an edge. In a distributed mobile environment (G, E, p) with |V (G)| = n, |E(G)| = m and |E| = k, when executing Algorithm 1, the agents detect with O(mk) moves in time O(m) if the election problem can be solved; if it is possible, they successfully elects a leader with O(mn log k) moves in time O(mn).
References 1. D. Angluin. Local and global properties in networks of processors. In Proceedings of the 12th Symposium on Theory of Computing, STOC’80, pages 82–93, 1980. 2. B. Awerbuch, M. Betke, R. Rivest, and M. Singh. Piecemeal graph exploration by a mobile robot (extended abstract). In Proc. of the 8th annual conference on Computational Learning Theory, COLT’95, pages 321–328. ACM Press, 1995. 3. L. Barri`ere, P. Flocchini, P. Fraigniaud, and N. Santoro. Can we elect if we cannot compare? In Proc. of the 15th annual ACM Symposium on Parallel Algorithms and Architectures, SPAA’03, pages 324–332. ACM Press, 2003. 4. L. Barri`ere, P. Flocchini, P. Fraigniaud, and N. Santoro. Rendezvous and election of mobile agents: Impact of sense of direction. Theory of Computing Systems, to appear. 5. M. Bender and D. Slonim. The power of team exploration: Two robots can learn unlabeled directed graphs. In Proc. of the 35th annual Symposium on Foundations of Computer Science, FOCS’94, pages 75–85, 1994. 6. P. Boldi, B. Codenotti, P. Gemmell, S. Shammah, J. Simon, and S. Vigna. Symmetry breaking in anonymous networks: Characterizations. In Proc. 4th Israeli Symposium on Theory of Computing and Systems, pages 16–26. IEEE Press, 1996. 7. P. Boldi and S. Vigna. Fibrations of graphs. Discrete Math., 243:21–66, 2002. 8. L. Boug´e. On the existence of symmetric algorithms to find leaders in networks of communicating sequential processes. Acta Informatica, 25(2):179–201, 1988. 9. J. Chalopin and Y. M´etivier. A bridge between the asynchronous message passing model and local computations in graphs (extended abstract). In Proc. of Mathematical Foundations of Computer Science, MFCS’05, volume 3618 of LNCS, pages 212–223, 2005. 10. S. Das, P. Flocchini, A.Nayak, and N. Santoro. Distributed exploration of an unknown graph. In Proc. of the 12th international colloquium on Structural Information and Communication Complexity, SIROCCO’05, volume 3499 of LNCS, pages 99–114, 2005. 11. A. Dessmark, P. Fraigniaud, and A. Pelc. Deterministic rendezvous in graphs. In Proc. of the 11th annual European Symposium on Algorithms, ESA’03, volume 2832 of LNCS, pages 184–195, 2003. 12. C. Palamidessi. Comparing the expressive power of the synchronous and the asynchronous π-calculus. Mathematical Structures in Computer Science, 13(5):685–719, 2003. 13. M. Yamashita and T. Kameda. Computing on anonymous networks: Part i - characterizing the solvable cases. IEEE Transactions on parallel and distributed systems, 7(1):69–89, 1996.
Fast Deterministic Distributed Algorithms for Sparse Spanners Bilel Derbel and Cyril Gavoille⋆ LaBRI, Universit´e Bordeaux 1 351, Cours de la Lib´eration, 33405 Talence, France {derbel, gavoille}@labri.fr
Abstract. This paper concerns the efficient construction of sparse and low stretch spanners for unweighted arbitrary graphs with n nodes. All previous deterministic distributed algorithms, for constant stretch spanner of o(n2 ) edges, have a running time Ω(nǫ ) for some constant ǫ > 0 depending on the stretch. Our deterministic distributed algorithms construct constant stretch spanners of o(n2 ) edges in o(nǫ ) time for any constant ǫ > 0. √ More precisely, in the Linial’s free model, we construct in nO(1/ log n ) time, for every graph, a 5-spanner of O(n3/2 ) edges. The result is extended to O(k2.322 )-spanners with O(n1+1/k ) edges √ for every parameter k 1. If the minimum degree of the graph is Ω( n ), then, in the same time complexity, a 9-spanner with O(n) edges can be constructed. Keywords: Distributed algorithms, graph spanners, time complexity, Linial’s free model, deterministic and randomized algorithms.
1
Introduction
This paper deals with deterministic distributed construction of sparse and low stretch graph spanners. Intuitively, spanners can be thought of as a generalization of the concept of a spanning tree. We look for a spanning subgraph such that the distance between any two nodes in the subgraph is bounded by some constant times the distance in the whole graph. More formally, H is a k-spanner of a graph G if H is a spanning subgraph of G, and if dH (u, v) k · dG (u, v) for all nodes u, v of G, where dX (u, v) denotes the distance from u to v in the graph X. The smallest k for which H is a k-spanner is called the stretch of H, and the size of H is its number of edges. The quality of a spanner refers to the trade-off between the stretch and the size of the spanner. The distributed model of computation we will be concerned with is the Linial’s free model [26], also known as LOCAL model in [34]. In this model, communication is completely synchronous and reliable. At every time unit, each node may send or receive a message of unlimited size to or from all its neighbors, and can ⋆
Supported by the project “PairAPair” of the ACI Masses de Donn´ees.
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 100–114, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
Fast Deterministic Distributed Algorithms for Sparse Spanners
101
locally compute any function. The model also assumes that each node is equipped with a unique identifier. Much as PRAM algorithms in parallel computing give a good indication of parallelism, the free model gives a good indication of the locality and distributed time. From a theoretical point of view, we are interested in the locality nature of constructing graph spanners, i.e., what spanners can we compute assuming only some local knowledge? The locality of a distributed problem is often expressed in term of the time needed to resolve it. In fact, in the distributed setting, the best a node can do in O(t) time units is to collect its t neighborhood. For instance, Θ(log∗ n) time are necessary and sufficient to compute a maximal independent set for trees, bounded degree graphs, or bounded growth graphs with n nodes [11, 21, 27, 22]. Results are known for other fundamental problems such as non-uniform coloring [2, 33], minimum spanning tree [16, 17, 29, 28, 35], small dominating set [25, 38], and maximal matching [23, 27]. Graph spanners are in the basis of various applications in distributed systems. For instance, Peleg and Ullman [36] establish the relationship between the quality of spanners, and the time and message complexity of network synchronizers (see also [1, 32]). Spanners are also implicitly used for the design of low stretch routing schemes with compact tables [12, 14, 37, 39, 41], and appear in many parallel and distributed algorithms for computing approximate shortest paths and for the design of compact data-structures, a.k.a. distance oracles [9, 20, 40, 42, 10]. 1.1
Related Works
Sparse and low stretch spanners can be constructed from (d, c)-decomposition of Awerbuch and Peleg [6], that is a partition of the graph into clusters of diameter at most d such that the graph obtained by contracting each cluster can be properly c-colored. There are several deterministic algorithms for constructing (d, c)-decompositions [3, 4, 5, 33]. The resulting distributed algorithms provide k 1. However, O(k)-spanners of size O(n1+1/k ), for any integral parameter √ these algorithms run in Ω(n1/k+ǫ ) time, where ǫ = Ω(1/ log n ), and provide a stretch s 4k − 3. Better stretch-size trade-offs exist but with an increasing time complexity. Recently, a deterministic distributed algorithm has been proposed for constructparticular, ing a (2k − 1)-spanner of size O(n1+1/k ) in O(n1−1/k ) time [13]. In √ 3-spanners of size O(n3/2 ) can be deterministically constructed in O( n ) time. Elkin et al. [15, 19, 18] develop a distributed algorithm for spanners such that the distance between two nodes in the spanner is at most 1 + ǫ times the distance in the original graph plus β. The size is O(βn1+δ ) whereas the time is O(nδ ), where β = β(δ, ǫ) is independent of n but grows super-polynomially in δ −1 and ǫ−1 . Randomized algorithms achieving better performances exist. Baswana et al. [8, 7] gave a randomized algorithm which computes an optimal (2k − 1)-spanner with expected size O(n1+1/k ) in O(k) time. The latter stretch-size trade-off is optimal since, according to an Erd¨ os Conjecture verified for k = 1, 2, 3, 5 [43], there are graphs with Ω(n1+1/k ) edges and girth 2k + 2 (the length of the small-
102
B. Derbel and C. Gavoille
est induced cycle), thus for which every s-spanner requires Ω(n1+1/k ) edges if s < 2k + 1. However, as mentioned in [4], a randomized solution might not be acceptable in some cases, especially for distributed computing applications. In the case of graph spanners, deterministic algorithms that guarantee a high quality spanner are more than of a theoretical interest. Indeed, one cannot just run a randomized distributed algorithm several times to guarantee a good decomposition, since it is impossible to efficiently check the global quality of the spanner in the distributed model. 1.2
Results
We consider unweighted connected graphs with n nodes. All previous deterministic distributed algorithm for O(1)-spanner of size o(n2 ) have a running time Ω(nδ ) for some constant δ > 0 depending on the stretch. In this paper we construct constant stretch spanner of size o(n2 ) in o(nǫ ) time for any constant ǫ > 0. √ O(1/ log n ) time for every More precisely, in the free model we construct in n graph a 5-spanner of O(n3/2 ) edges. The result is extended to larger stretch spanner of size O(n1+1/k ) for every k 1. More precisely, for k power of two, the stretch is at most k log2 5 < k 2.322 . For other values of k, we obtain stretches s = s(k) which surprisingly depend on the positions of the first two leading 1’s in the binary written of k (cf. the table below for the first values). k 1 2 3 4 5 s(k) 1 5 9 25 33
√ We also show that if the minimum degree of the graph is Ω( n ), then, in the same time complexity, a 9-spanner with O(n) edges can be constructed. The previous algorithms have simple randomized versions with improved performances. In particular, we can compute√a 5-spanner of size O(n log2 n) in O(log n) time if the minimum degree is Ω( n ). 1.3
Outline of the Paper
The main idea to break the O(nδ ) time barrier is to abandon the optimality on the stretch-size trade-off. We show that constant stretch spanners can be constructed on the basis of a maximal independent set, i.e., a set of pairwise non-adjacent nodes, maximal for inclusion. This can be deterministically com√ puted in nO(1/ log n ) time [4, 33]. Therefore, the time complexity to construct our spanners is improved by a factor of n1/k . The generic algorithm is described in Section 2 and analyzed in Section 3, where a distributed implementation is presented. We mainly reduce the problem to the computation of an independent ρdominating set, that is a set X of pairwise non-adjacent nodes such that every node of the graph is at distance at most ρ from X. Using the terminology of [34], a ρ-dominating set if nothing else than a (ρ, s)-ruling set for some s > 1. Actually, in order to optimize the stretch, the main algorithm combines two strategies in a way depending on the binary written of k.
Fast Deterministic Distributed Algorithms for Sparse Spanners
103
In Section 4, we present the main results about 5- and 9-spanners. Observing that for ρ = 1 an independent ρ-dominating set is a maximal independent set, √ we conclude that our generic algorithm can be implemented to run in nO(1/ log n ) time for ρ = 1. Several optimizations are then proposed including randomization and graphs of large minimum degree.
2 2.1
A Generic Algorithm Definitions
Let us consider an unweighted connected graph G = (V, E). Given an integer t 1, the t-th power of G, denoted by Gt , is the graph obtained from G by adding an edge between any two nodes at distance at most t in G. For a set of nodes H, G[H] denotes the subgraph of G induced by H. For X, Y ⊆ V , let dG (X, Y ) = min {dG (x, y) | x ∈ X and y ∈ Y }. We associate with each v ∈ V a region, denoted by R(v), that is a set of nodes containing v and inducing a connected subgraph of G. Given C ⊆ V , GC denotes the graph whose node set is C, and there is an edge between u and v in C if dG (R(v), R(u)) = 1. We denote by R+ (v) = {u ∈ V | dG (u, R(v)) 1} and + by RC (v) = {u ∈ C | dG (R(u), R(v)) 1}. The eccentricity of a node v in G is defined as maxu∈V {dG (u, v)}. For a node v ∈ X, we denote by BFS(v, X) a Breadth First Search spanning tree in X rooted at v. We define IDS(G, ρ) as any independent ρ-dominating set of G. Finally, we define the integer ℓ(x) as follows: −1 if x 0, ℓ(x) = ⌊log2 x⌋ otherwise. In the reminder of the paper we assume the free model of computation as defined in the introduction. We define the time complexity of a distributed algorithm to be the worst-case number of time units from the beginning of the algorithm to its termination. 2.2
Description of the Algorithm
The main idea of the algorithm is to find an efficient clustering of dense regions in the graph. A high level description of the algorithm, named Spanner, is given in Fig. 1. Intuitively, i0 represents the relative position of the first two leading 1’s in the binary written of k. The algorithm works in many phases, where new regions are formed at each phase. There are two types: the light regions (L) and the heavy regions (H). At a given phase, some of the heavy regions are selected and enlarged by including nodes from other neighboring regions. One important observation is that each new enlarged region is connected and the new constructed regions are mutually disjoint. At each phase of the algorithm, one of the two strategies depicted in Fig. 2 and Fig. 3 applies. The main idea behind the two strategies is the same: choose
104
B. Derbel and C. Gavoille Spanner Input: a graph G = (V, E) with n = |V |, and integers ρ, k 1 Output: a spanner S 1. i0 := ℓ(k)−ℓ(k −2ℓ(k) ); C := V ; r = 0; ∀v ∈ V , R(v) := {v}, and c(v) := v 2. for i := 1 to ℓ(k) + 1 do: if i = i0 then Strategy 1 else Strategy 2
Fig. 1. The algorithm Spanner
some well selected dense regions and merge them with the other ones in order to form new larger regions. The main difference is that the density of a region is computed in a different way. The stretch of the output spanner depends on the way the radius of the regions increases and on the total number of phases of the algorithm, depending on the volume of the regions. And, radius and volume increase very differently. On one hand, in Strategy 1, a region is dense if its neighborhood is n1/k times greater than its size. Applying only Strategy 1 allows to obtain small stretch for small values of k. However, asymptotically, the stretch is exponential in k. On the other hand, in Strategy 2, a region is dense if the number of its neighboring regions is n1/k times greater than its size which provides an exponential growth of the size of a region. Applying only Strategy 2 allows to obtain asymptotically stretches polynomial in k. The main idea of algorithm Spanner is to switch from one strategy to an other at each phase in order to obtain the smallest possible stretch. A full analysis shows that, by alternating Strategy 1 and Strategy 2, the best stretch can be obtained by applying Strategy 1 only once at a well chosen phase i0 . Typically, i0 = p − q if k = 2p + 2q with p > q. We associate with each region R(v) an active node, called center, and the set of centers forms C. Initially, each node is the center of the region formed by itself. Each phase i ∈ {1, . . . , ℓ(k) + 1} can be decomposed in seven parts we briefly sketch.
L := v ∈ C, |R+ (v)| n1/k · |R(v)| and H := C \ L; ∀(u, v) ∈ L × V such that ∃ edge e between R(u) and v, S := S ∪ {e} X := IDS(G2(r+1) [H], ρ) ∀z ∈ V , if dG (z, X) (2ρ + 1)r + 2ρ, then set c(z) to be its closest node of X, breaking ties with identities. 5. ∀v ∈ X, R(v) := {z ∈ V | c(z) = v} 6. ∀v ∈ X, S := S ∪ BFS(v, R(v)) 7. C := X and r := (2ρ + 1)r + 2ρ 1. 2. 3. 4.
Fig. 2. Strategy 1
Fast Deterministic Distributed Algorithms for Sparse Spanners
+ 1. L := v ∈ C, |RC (v)| n1/k · |R(v)|
105
and H := C \ L
2. ∀(u, v) ∈ L × C such that ∃ edge e between R(u) and R(v), S := S ∪ {e} 3. X := IDS((GC )2 [H], ρ) 4. ∀u ∈ C, if dGC (u, X) 2ρ, then set c(u) to be its closest node of X in GC , breaking ties with identities. 5. ∀v ∈ X, R(v) := {R(u) | u ∈ C and c(u) = v} 6. ∀v ∈ X, S := S ∪ BFS(v, R(v)) 7. C := X and r := (4ρ + 1)r + 2ρ
Fig. 3. Strategy 2
In Step 1, we compute the two sets H and L corresponding respectively to heavy and light regions. In Step 2, a light region is connected with some neighboring nodes. This step is crucial in the stretch bound analysis. If Strategy 1 is applied, then each light region is connected with each neighboring node in V , i.e., ∀u ∈ L, R+ (u) is spanned. If Strategy 2 is applied, then each light region is connected with every neighboring region. Note that at the beginning of a given phase, every region is spanned by a BFS tree constructed in Step 6 of the previous phase. The nodes H are then processed at the aim of constructing new regions with a set of new centers. The key point of our construction is to efficiently merge all the regions defined by the set H into more dense, connected and disjoint regions. In order to guarantee that the algorithm terminates quickly, the dense regions must grow enough. More precisely, if a dense region R(v) is enlarged it must contain at least its neighborhood R+ (v) when Strategy 1 is applied or its neighborhood in the graph GC if Strategy 2 is applied. It is clear that two regions at distance one or two (in G or in GC depending on the strategy 1 or 2) cannot grow simultaneously without overlapping. Thus, a difficulty is to elect in an efficient way the centers of regions that are allowed to grow in parallel. In Step 3, we compute an independent ρ-dominating set X in the graph G2(r+1) [H] if Strategy 1 is applied (resp. (GC )2 [H] for Strategy 2), where r is a radius that grows at each phase. The set X defines the set of nodes allowed to grow in parallel. In order to guarantee that nodes in non selected regions in Step 3 (the set H \ X) will be spanned by the output spanner, we must merge them with nodes in the selected regions. Thus, in Step 4, we define a coloring strategy allowing a correct merge process. In fact, in order to ensure that the new regions are disjoint, we let nodes choose their new region in a consistent manner, i.e., a node chooses to be in the region of the closest node in X breaking ties using identities. If Strategy 1 is applied then each node chooses by itself its new dominator, i.e., its new region. However, once a node u chooses its new dominator node v, and in order to ensure that the new formed regions are connected, we include all the nodes in the shortest path between u and v, even those in non dense region. If Strategy 2 is applied then, the center of each region chooses a new region and merge its whole region with the new chosen region.
106
B. Derbel and C. Gavoille
In Step 5, the new regions are formed according to the coloring step. Note that as soon as the new region are formed, they are spanned in Step 6. Finally, in Step 7, the set C and the variable r are updated for the next phase.
3
Analysis of the Algorithm
For every phase i, we denote by Hi (resp. Xi and Li ) the set H (resp. X and L) computed during phase i, i.e., after Steps 1 and 3 of phase i. Similarly, we denote by ci (z) the color of z assigned during phase i, i.e., after Step 4 of phase i. We denote by Ci the set C at the beginning of phase i, and ri denotes the value of r at the beginning of phase i. For a node v ∈ Ci , we denote by Ri (v) the region of v at the beginning of phase i. In the following we need the four important properties. Lemma 1. At the beginning of phase i, every v ∈ Ci is of eccentricity at most r in G[Ri (v)]. Lemma 2. At the beginning of phase i, for every two nodes u = v ∈ Ci , Ri (u) ∩ Ri (v) = ∅. Lemma 3. At the beginning of phase i = i0 , if |Ri (v)| Vi for every v ∈ Ci , then |Ri+1 (v)| n1/k · Vi2 for every v ∈ Ci+1 . Lemma 4. For every node u ∈ V , there exists a phase i and a node v ∈ V such that: – at the beginning of phase i, v ∈ Ci and u ∈ Ri (v); and – v is in the set Li computed in Step 1 of phase i. 3.1
Stretch and Size Analysis
Lemma 5. For any integer k, ρ 1, the stretch s of the output spanner S of algorithm Spanner verifies (4ρ + 1)ℓ(k) if k = 2ℓ(k) , s ℓ(k) 2(2ρ + 1)(4ρ + 1)ℓ(k)−1 + 4ρ(4ρ + 1)ℓ(k−2 ) − 1 otherwise. Proof. As a consequence of Lemma 4 and Step 6 of the algorithm, every node u ∈ V is spanned by the output S of the algorithm, i.e., S is a spanner of G. From the initialization step of the algorithm, we have r1 = 0. Let us denote by i1 = ℓ(k) and i2 = ℓ(k − 2ℓ(k) ), i.e., i0 = i1 − i2 . For every 1 < i i0 , we have ri = (4ρ + 1)ri−1 + 2ρ. Thus, ri = 21 · (4ρ + 1)i−1 − 1 for 1 i i0 . Let us consider an edge (z, z ′ ) ∈ E. Using Lemma 4, there exists a phase j (resp. j ′ ) and a node v (resp. v ′ ) such that v ∈ Cj (resp. v ′ ∈ Cj ′ ), z ∈ Rj (v) (resp. z ′ ∈ Rj ′ (v ′ )) and v ∈ Lj (resp. v ′ ∈ Lj ′ ). We take v (resp. v ′ ) to be the first dominator of z, i.e., node in C whose region contains z, (resp. z ′ ) that fall into set L. In fact, one can see that node z (or z ′ ) can be in a sparse region at
Fast Deterministic Distributed Algorithms for Sparse Spanners
107
some phase and switch to a dense region at the next phase, because either its sparse region has been merged with a neighboring dense one (if Strategy 2 is applied), or it is in the neighborhood of a dense region, or it is on a shortest path leading to a dense region (if Strategy 1 is applied). W.l.o.g., suppose that j j′. Case 1: i2 = −1. Hence, i0 = ℓ(k) + 1 and k = 2ℓ(k) . By induction and using Lemma 3, at the beginning of phase i0 , the size of the region of any node in Ci0 i0 −1 −1)/k is at least n(2 = n(k−1)/k . Note that we apply Strategy 1 at phase i0 . Thus, every node in Ci0 will be in L. Subcase 1.1: Suppose that j j ′ < i0 . Thus, using Step 6, a BFS tree spanning Rj (v) is added to the output spanner at phase j − 1. In addition, one can easily show that there exists a node v ′′ ∈ Cj such that z ′ ∈ Rj (v ′′ ). Hence, a BFS tree spanning Rj (v ′′ ) is added to the output spanner at phase j − 1. Using Step 2, there exists an edge e ∈ S connecting Rj (v) and Rj (v ′′ ). Thus, dS (z, z ′ ) 4rj + 1 = 2(4ρ + 1)j−1 − 1. Subcase 1.2: Suppose that j = j ′ = i0 . Hence, Strategy 1 is applied at phase j. Thus, a BFS tree spanning Rj (v) is added to the output spanner at phase j −1. Using Step 2, Rj+ (v) is also spanned. Thus, because z ′ ∈ Rj+ (v), dS (z, z ′ ) 2rj + 1 = 2ri0 + 1 (4ρ + 1)i0 −1 . Finally, because ρ > 0, in both subcases, the stretch is bounded by (4ρ + 1)ℓ(k) . Case 2: i2 0. Hence, at the beginning of phase i0 + 1, the radius of a region is at most (2ρ + 1)ri0 + 2ρ. Thus, 1 (2ρ + 1) · (4ρ + 1)i0 −1 − 1 + 2ρ (1) 2 Suppose i2 = 0. For every i0 + 1 < i ℓ(k) + 1, we have ri = (4ρ + 1)ri−1 + 2ρ. Thus, by induction, for every i0 + 1 < i ℓ(k) + 1, ri0 +1 =
1 ri = (4ρ + 1)i−i0 −1 · ri0 +1 + ((4ρ + 1)i−i0 −1 − 1) 2 In particular, 1 rℓ(k)+1 = (4ρ + 1)ℓ(k)−i0 · ri0 +1 + ((4ρ + 1)ℓ(k)−i0 − 1) 2 Thus,
1 (2) rℓ(k)+1 = (4ρ + 1)i2 · ri0 +1 + ((4ρ + 1)i2 − 1) 2 Now suppose that i2 = 0. Hence, i0 = ℓ(k) and it is easy to see that Eq. 2 is still true.
Subcase 2.1: Suppose that j = i0 . Thus, it easy to show that there exists a node v ′′ ∈ Cj such that z ′ ∈ Rj (v ′′ ). Using Step 6, Rj (v ′′ ) and Rj (v) were spanned by a BFS tree at phase j − 1. In addition, because Strategy 2 is applied at phase j, an edge e connecting Rj (v) and Rj (v ′′ ) is added at phase j (Step 2). Thus, dS (z, z ′ ) 4rj + 1.
108
B. Derbel and C. Gavoille
Subcase 2.2: Suppose that j = i0 . Thus, because Rj+ (v) is spanned, dS (z, z ′ ) 2rj + 1. At phase ℓ(k) + 1, all active nodes will be in the set Lℓ(k)+1 . Thus the stretch is bounded by 4rℓ(k)+1 + 1. Using Eq. (1) and (2), we have: 4rℓ(k)+1 + 1 = 4 (4ρ + 1)i2 · ri0 +1 + 12 ((4ρ + 1)i2 − 1) + 1 ⊓ ⊔ = 2(2ρ + 1)(4ρ + 1)i1 −1 + 4ρ(4ρ + 1)i2 − 1 Lemma 6. For any integer k, ρ 1, the size of the output spanner S of algorithm Spanner is O(log k · n1+1/k ). 3.2
Distributed Implementation and Time Complexity
In the free model, distributed computation of some distributed procedure A on Gt [H] can be easily simulated on G as follows, charging the overall time by a factor of t. Hereafter, we assume that each node u ∈ G can determine if it belongs or not to H. Indeed, consider one communication step in A running on some node u of Gt [H] followed by one local computation step. In G, an original message in A is sent from u with a counter initialized to t − 1 as an extra field. Now, each node v ∈ G, upon the reception of a message with some counter in its header: 1) decrements the counter; 2) stores this message if v ∈ H; and 3) forwards the incoming message with the updated counter to all its neighbors in G if the updated counter is non-null (if many messages are received during a round, then they are concatenated before being sent). After t communication rounds in G, every node u ∈ H starts the local computation step of A on the base of all received messages during the last t communication rounds. Similarly, given C ⊆ V , the computation of some distributed procedure A on GC can be simulated on G as follows, charging the overall time by a factor O(r) where r is an upper bound of the eccentricity of a node v ∈ C in G[R(v)]. At each time procedure A requires for a node v of GC to send a message to a neighbor, v broadcasts the message in G[R(v)] (which is connected). The nodes at the frontier of R(v), i.e., nodes having neighbors in different regions, broadcast also the message out their region. Symmetrically, upon the reception of messages from different regions, messages are concatenated and a convergecast is performed to v. The time overhead for one step of A is at most 2r + 1. Relying on the above discussions, running procedure A on G2(r+1) [H] or on (GC )2 [H] can be simulated on G within a factor of O(r) on the time complexity. Lemma 7. For any integer k, ρ 1, Spanner can be implemented with a deterministic distributed algorithm in O(log k · ρlog k · τ ) time, where τ is the time complexity to compute an independent ρ-dominating set in a graph of at most n nodes.
4 4.1
Applications to Low Stretch Spanners Constant Stretch Spanners with Sub-quadratic Size
Let MIS(n) denote the time complexity for computing, by a deterministic distributed algorithm, a maximal independent set (MIS) in a graph with at most n
Fast Deterministic Distributed Algorithms for Sparse Spanners
109 √
nodes. The fastest deterministic algorithm [33] shows that MIS(n) nO(1/ log n ) . It is also known that MIS(n) Ω( log n/ log log n) [23]. It is not difficult to check that a set X is an independent 1-dominating set if and only if X is a maximal independent set (cf. [34, pp. 259, Ex. 4]). Thus, using the fast distributed MIS algorithm as a subroutine in algorithm Spanner, we obtain: Theorem 1. There is a deterministic distributed algorithm that given a graph G with n nodes and any fixed integer k = 2p with p 0, constructs a (k log2 5 )spanner for G with O(n1+1/k ) edges in O(MIS(n)) time. Proof. Size and time are direct consequences of lemmas 3 and 7 fixing k and ρ = 1. Note that ℓ(k) = p = log k. Thus, using Lemma 5, the stretch of the ⊓ ⊔ output spanner is bounded by 5log k = k log 5 . Theorem 2. There is a deterministic distributed algorithm that given a graph G with n nodes and any fixed integer k = 2p + 2q − 1 with p q > 0, constructs a (6 · 5p−1 + 4 · 5q−1 − 1)-spanner for G with O(n1+1/k ) edges in O(MIS(n)) time. Proof. Size and time are direct consequences of lemmas 3 and 7 fixing k and ρ = 1. p If p = q, then k = 2p+1 − 1 = j=0 2j . Hence, ℓ(k) = p and ℓ(k − 2ℓ(k) ) = ℓ(2p+1 − 1 − 2p ) = ℓ(2p − 1) = p − 1. Thus, using Lemma 5 (second case), the stretch of the output spanner is bounded by 6 · 5p + 4 · 5p−1 − 1. q−1 p If p = q, then k = 2 + j=0 2j . Hence, ℓ(k) = p. In addition, ℓ(k − 2ℓ(k) ) = ℓ(2p + 2q − 1 − 2p ) = ℓ(2q − 1) = q − 1. Thus, using Lemma 5 (second case), the stretch of the output spanner is bounded by 6 · 5p + 4 · 5q−1 − 1. ⊓ ⊔ Corollary 1. For every integer k such that k = 2p + 2q − 1, where p q 0, there is a deterministic distributed algorithm that given a graph G with n nodes, constructs a s[k]-spanner for G with O(n1+1/k ) edges in O(MIS(n)) time, where s[k] is given by Table 1. Table 1. Stretch and Strategy examples for k = 2p + 2q − 1 (p, q) (0, 0) (1, 0) (1, 1) (2, 0) (2, 1) (2, 2) (3, 0) (3, 1) (3, 2) (3, 3) k 1 2 3 4 5 7 8 9 11 15 s[k] 1 5 9 25 33 49 125 153 169 249 i0 1 2 1 3 2 1 4 3 2 1
4.2
Graphs with Large Minimum Degree
It is known that sparser spanners exist whenever the minimum degree increases (cf. the concluding remark of [7]). In this paragraph, we show that graphs with minimum degree large enough enjoy an O(1)-spanner with only O(n) edges, moreover computable with a fast deterministic distributed algorithm.
110
B. Derbel and C. Gavoille
Let us first note that if a graph G has a ρ-dominating set X, then G has a (4ρ + 1)-spanner with at most n + |X|2 /2 edges. Assuming we are given such a dominating set, the spanner can be constructed distributively in O(ρ) time by first clustering the nodes of the graph around the nodes in the dominating set, and then by connecting every two neighboring clusters. The two endpoints either belong to the same cluster, and thus the endpoints are at distance at most 2ρ in the spanner, or belong to two adjacent clusters. In that case the endpoints are at distance at most 2ρ + 1 + 2ρ in the spanner using the selected inter-cluster edge of the spanner. Proposition 1. For every parameter ρ 1, there exists a deterministic distributed algorithm that given a graph G with n nodes and a ρ-dominating set X, constructs a (4ρ + 1)-spanner for G with at most n + |X|2 /2 edges in O(ρ) time. This proposition √ can be combined with the observation that if G has√minimum degree δ n log n, then G has a 1-dominating set X of size O( n log n ). Indeed, this can be proved using the following greedy algorithm [30]: one starts with X = ∅ and with the set of all radius-1 balls, B = {N [v] | v ∈ V }, where N [v] = {u ∈ V | dG (u, v) 1}. Then, while B is nonempty, one selects a node x ∈ V for X that belongs to the maximum number of balls in the current set B. The set B is updated by removing all balls containing x. The constructed set X is a 1-dominating set that |X| n(1 + ln n)/ minv∈V |N [v]| √ √and it can be shown which is at most O( n log n ) if δ n log n. Thus, the problem is to efficiently compute such 1-dominating set. Unfortunately, no deterministic distributed implementation of the greedy algorithm faster than O(|X|) is known. A small ρ-dominating set can be computed much more efficiently in O(ρ log∗ n) time by the algorithm of [25]. Unfortunately, its guaranteed size for X is only of O(n/ρ). Finally, no algorithm is known to √ run in o( n log n ) time for this problem. However, using our algorithm, we obtain a 9-spanner with only O(n) edges, moreover with a better time complexity. Theorem 3. There exists a deterministic distributed √ algorithm that given a graph G with n nodes and minimum degree δ n, constructs a 9-spanner for G with at most 3n/2 edges in O(MIS(n)) time. Proof. The algorithm consists in two stages. First, we construct an MIS for G2 . Then, each node of the MIS constructs its region using the coloring technique of Spanner. The spanner is obtained by considering the edges spanning the regions and the edges connecting every two adjacent regions (cf. Proposition 1). The number of√ nodes belonging to the MIS, and thus the number of regions, is at most n/δ n. Therefore, the number of edges of the spanner is at most √ 2 n + n /2 = 3n/2. The radius of a region is bounded by 2. Thus, the stretch is 2 · 2 + 1 + 2 · 2 = 9. ⊓ ⊔ 4.3
Randomized Distributed Implementation Issues
In [31], Luby gives a simple and efficient randomized PRAM algorithm for computing an MIS in O(log n) expected time. Luby’s algorithm can be turned to run
Fast Deterministic Distributed Algorithms for Sparse Spanners
111
in the free model, and we obtain a distributed algorithm for computing an independent 1-dominating set which terminates within O(log n) expected time. We remark that upon termination of the algorithm, the constructed 1-dominating set is always correct, the randomization is only on the running time, i.e., it is a Las Vegas algorithm. The two randomized algorithms we present below guarantee the stretch and the size bounds for the constructed spanners, while the O(k) time (Monte Carlo) randomized algorithms [8] do not give any guarantee on the spanner size. This is of course achieved at the price of increasing the stretch factor of the spanner. Thus, we obtain the following randomized version of Theorems 1 and 2: Theorem 4. There is a ( Las Vegas) randomized distributed algorithm that given a graph G with n nodes and any fixed integer k = 2p with p 0, constructs a (k log2 5 )-spanner for G with O(n1+1/k ) edges in O(log n) expected time. Theorem 5. For every fixed integer k 3, there is a ( Las Vegas) randomized distributed algorithm that given a graph G with n nodes and any fixed integer k = 2p + 2q − 1 with p q > 0, constructs a (6 · 5p−1 + 4 · 5q−1 − 1)-spanner for G with O(n1+1/k ) edges in O(log n) expected time. Recently, in [24], Khun et al. show that every packing problem can be approximated by a constant factor with high probability in O(log n) time in the free model. Therefore, the (Monte Carlo) algorithm of [24] implies a randomized constant approximation algorithm for the minimum 1-dominating set problem with O(log n) time. Thus, using Proposition 1, we obtain the following result (to be compared with Theorem 3 and [8]): Theorem 6. There exists a ( Monte Carlo) randomized distributed algorithm √ that given a graph G with n nodes of minimum degree δ n, constructs a 5-spanner for G in O(log n) time. The size is O(n log2 n) edges with high probability. More generally, for a minimum degree δ graph, we obtain a 5-spanner with O(n + (n log n/δ)2 ) edges. Let us remark that, in Theorem 6, 5 is the best possible bound on √ the stretch if δ w(n1/4 log n). In fact, there exist graphs with minimum degree c n (for some constant c > 0) and girth 6 (the length of its smallest cycle). Thus, the deletion of any edge implies a stretch √ of at least 5 for its endpoints. Therefore, any spanner with size less than 12 cn n have stretch at least 5, and O(n + (n log n/δ)2 ) = √ o(n n ) if δ w(n1/4 log n).
5
Conclusion
In this paper we have considered deterministic distributed algorithm to construct low stretch and sparse spanners of unweighted arbitrary graphs. In particular√ we have shown that 5-spanner with O(n3/2 ) edges can be constructed in √ 2 nO(1/ log n ) time. Let us observe that log n < n1/ log n only for n > 24 . In other
112
B. Derbel and C. Gavoille √
words, deterministic distributed n1/ log n time algorithms might be competitive1 over randomized log n time algorithms for distributed system up to n 32656 processors. We left open the two following problems: 1. Reduce the stretch from 5 to optimal stretch 3, without increasing the size of the spanner and the running time. More generally, is it possible, for every k 1, to compute with a deterministic distributed algorithm a (2k − 1)spanners of size O(n1+1/k ) in O(MIS(n)) time? 2. Reduce the time complexity to o(MIS(n)), possibly with some small stretch and size increasings. More precisely, is it possible to compute with a deterministic distributed algorithm a constant stretch spanner with o(n2 ) edges in o(MIS(n)) time? Using our approach, it suffices to show that there is a constant ρ for which an independent ρ-dominating set can be computed in o(MIS(n)) time for every graph.
References 1. Baruch Awerbuch. Complexity of network synchronization. Journal of the Association for Computing Machinery, 32:804–823, 1985. 2. Baruch Awerbuch. Optimal distributed algorithms for minimum weight spanning tree, counting, leader election and related problems. In 19th Annual ACM Symposium on Theory of Computing (STOC), pages 230–240. ACM Press, May 1987. 3. Baruch Awerbuch, Bonnie Berger, Lenore J. Cowen, and David Peleg. Near-linear cost sequential and distributed constructions of sparse neighborhood coverss. In 34th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 638–647. IEEE Computer Society Press, November 1993. 4. Baruch Awerbuch, Bonnie Berger, Lenore J. Cowen, and David Peleg. Fast distributed network decompositions and covers. Journal of Parallel and Distributed Computing, 39:105–114, 1996. 5. Baruch Awerbuch, Bonnie Berger, Lenore J. Cowen, and David Peleg. Near-linear time construction of sparse neighborhood covers. SIAM Journal on Computing, 28(1):263–277, February 1998. 6. Baruch Awerbuch and David Peleg. Sparse partitions. In 31th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 503–513. IEEE Computer Society Press, October 1990. 7. Surender Baswana, Telikepalli Kavitha, Kurt Mehlhorn, and Seth Pettie. New constructions of (α, β)-spanners and purely additive spanners. In 16th Symposium on Discrete Algorithms (SODA), pages 672–681. ACM-SIAM, January 2005. 8. Surender Baswana and Sandeep Sen. A simple linear time algorithm for computing a (2k − 1)-spanner of O(n1+1/k ) size in weighted graphs. In 30th International Colloquium on Automata, Languages and Programming (ICALP), volume 2719 of Lecture Notes in Computer Science, pages 384–396. Springer, July 2003. 9. Surender Baswana and Sandeep Sen. Approximate distance oracles for unweighted ˜ 2 ) time. In 15th Symposium on Discrete Algorithms (SODA), pages graphs in O(n 271–280. ACM-SIAM, January 2004. 10. Edith Cohen. Fast algorithms for constructing t-spanners and paths with stretch t. SIAM Journal on Computing, 28(1):210–236, 1998. 1
This obviously depends on the constants hidden in the O-notation.
Fast Deterministic Distributed Algorithms for Sparse Spanners
113
11. Richard Cole and Uzi Vishkin. Deterministic coin tossing with applications to optimal parallel list ranking. Information and Control, 70(1):32–53, 1986. 12. Lenore J. Cowen. Compact routing with minimum stretch. Journal of Algorithms, 38(1):170–183, 2001. 13. Bilel Derbel, Mohamed Mosbah, and Akka Zemmari. Fast distributed graph partition and application. In 20th IEEE International Parallel & Distributed Processing Symposium (IPDPS). IEEE Computer Society Press, April 2006. 14. Tamar Eilam, Cyril Gavoille, and David Peleg. Compact routing schemes with low stretch factor. Journal of Algorithms, 46:97–114, 2003. 15. Michael Elkin. Computing almost shortest paths. In 20th Annual ACM Symposium on Principles of Distributed Computing (PODC), pages 53–62. ACM Press, 2001. 16. Michael Elkin. A faster distributed protocol for constructing a minimum spanning tree. In 15th Symposium on Discrete Algorithms (SODA), pages 359–368. ACMSIAM, January 2004. 17. Michael Elkin. Unconditional lower bounds on the time-approximation tradeoffs for the distributed minimum spanning tree problems. In 36th Annual ACM Symposium on Theory of Computing (STOC), pages 331–340. ACM Press, May 2004. 18. Michael Elkin and David Peleg. (1 + ǫ, β)-spanner constructions for general graphs. SIAM Journal on Computing, 33(3):608–631, 2004. 19. Michael Elkin and Jian Zhang. Efficient algorithms for constructing (1 + ǫ, β)spanners in the distributed and streaming models. In 23rd Annual ACM Symposium on Principles of Distributed Computing (PODC), pages 160–168. ACM Press, July 2004. 20. Cyril Gavoille, David Peleg, St´ephane P´erenn`es, and Ran Raz. Distance labeling in graphs. Journal of Algorithms, 53(1):85–112, 2004. 21. Andrew V. Goldberg, Serge A. Plotkin, and Gregory E. Shannon. Parallel symmetry-breaking in sparse graphs. SIAM Journal on Discrete Mathematics, 1(4):434–446, 1988. 22. Fabian Kuhn, Thomas Moscibroda, Tim Nieberg, and Roger Wattenhofer. Fast deterministic distributed maximal independent set computation on growth-bounded graphs. In 19th International Symposium on Distributed Computing (DISC), volume Lecture Notes in Computer Science. Springer, September 2005. 23. Fabian Kuhn, Thomas Moscibroda, and Roger Wattenhofer. What cannot be computed locally! In 23rd Annual ACM Symposium on Principles of Distributed Computing (PODC), pages 300–309. ACM Press, July 2004. 24. Fabian Kuhn, Thomas Moscibroda, and Roger Wattenhofer. The price of being near-sighted. In 17th Symposium on Discrete Algorithms (SODA), pages 980–989. ACM-SIAM, January 2006. 25. Shay Kutten and David Peleg. Fast distributed construction of small k-dominating sets and applications. Journal of Algorithms, 28(1):40–66, 1998. 26. Nathan Linial. Distributive graph algorithms - Global solutions from local data. In 28th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 331–335. IEEE Computer Society Press, October 1987. 27. Nathan Linial. Locality in distributed graphs algorithms. SIAM Journal on Computing, 21(1):193–201, 1992. 28. Zvi Lotker, Boaz Patt-Shamir, Elan Pavlov, and David Peleg. Minimum-weight spanning tree construction in O(log log n) communication rounds. SIAM Journal on Discrete Mathematics, 35(1):120–131, 2005. 29. Zvi Lotker, Boaz Patt-Shamir, and David Peleg. Distributed MST for constant diameter graphs. In 20th Annual ACM Symposium on Principles of Distributed Computing (PODC), pages 63–71. ACM Press, 2001.
114
B. Derbel and C. Gavoille
30. Laszlo Lov´ asz. On the ratio of optimal integral and fractional covers. Discrete Mathematics, 13:383–390, 1975. 31. Michael Luby. A simple parallel algorithm for the maximal independent set problem. SIAM Journal on Computing, 15(4):1036–1053, November 1986. 32. Shlomo Moran and Sagi Snir. Simple and efficient network decomposition and synchronization. Theoretical Computer Science, 243(1-2):217–241, 2000. 33. Alessandro Panconesi and Aravind Srinivasan. On the complexity of distributed network decomposition. Journal of Algorithms, 20(2):356–374, 1996. 34. David Peleg. Distributed Computing: A Locality-Sensitive Approach. SIAM Monographs on Discrete Mathematics and Applications, 2000. 35. David Peleg and Vitaly Rubinovich. A near-tight lower bound on the time complexity of distributed minimum-weight spanning tree construction. SIAM Journal on Computing, 30(5):1427–1442, 2000. 36. David Peleg and Jeffrey D. Ullman. An optimal synchornizer for the hypercube. SIAM Journal on Computing, 18(4):740–747, 1989. 37. David Peleg and Eli Upfal. A trade-off between space and efficiency for routing tables. Journal of the ACM, 36(3):510–530, July 1989. 38. Lucia Draque Penso and C. Barbosa Valmir. A distributed algorithm to find kdominating sets. Discrete Applied Mathematics, 141(1-3):243–253, May 2004. 39. Liam Roditty, Mikkel Thorup, and Uri Zwick. Roundtrip spanners and roundtrip routing in directed graphs. In 13th Symposium on Discrete Algorithms (SODA), pages 844–851. ACM-SIAM, January 2002. 40. Liam Roditty, Mikkel Thorup, and Uri Zwick. Deterministic constructions of approximate distance oracles and spanners. In 32nd International Colloquium on Automata, Languages and Programming (ICALP), volume Lecture Notes in Computer Science, 2005. 41. Mikkel Thorup and Uri Zwick. Compact routing schemes. In 13th Annual ACM Symposium on Parallel Algorithms and Architectures (SPAA), pages 1–10. ACM Press, July 2001. 42. Mikkel Thorup and Uri Zwick. Approximate distance oracles. Journal of the ACM, 52(1):1–24, January 2005. 43. Rephael Wenger. Extremal graphs with no C 4 ’s, C 6 ’s, or C 10 ’s. Journal of Combinatorial Theory, Series B, 52(1):113–116, 1991.
Efficient Distributed Weighted Matchings on Trees⋆ Jaap-Henk Hoepman1 , Shay Kutten2 , and Zvi Lotker3 1
Institute for Computing and Information Sciences Radboud University Nijmegen, Nijmegen, the Netherlands [email protected] 2 Faculty of Industrial Engineering and Management Technion, Haifa, Israel [email protected] 3 CWI, Amsterdam, the Netherlands [email protected]
Abstract. In this paper, we study distributed algorithms to compute a weighted matching that have constant (or at least sub-logarithmic) running time and that achieve approximation ratio 2 + ǫ or better. In fact we present two such synchronous algorithms, that work on arbitrary weighted trees. The first algorithm is a randomised distributed algorithm that computes a weighted matching of an arbitrary weighted tree, that approximates the maximum weighted matching by a factor 2 + ǫ. The running time is O(1). The second algorithm is deterministic, and approximates the maximum weighted matching by a factor 2 + ǫ, but has running time O(log ∗ |V |). Our algorithms can also be used to compute maximum unweighted matchings on regular and almost regular graphs within a constant approximation.
1
Introduction
A matching M (G) of a graph G = (V, E) is any subgraph of G where no two edges are incident to the same vertex. A matching is maximal if no other edge from G can be added to the matching without violating this requirement. Let w(e) be the weight of an edge e ∈ E of G, where w(e) > 0. Define the weight w(G) of a graph G to be the sum of the weights of all its edges. Then a maximum weighted matching M ∗ (G) of G is a matching whose weight is the maximum among all matchings of G. We say that an algorithm achieves approximation ratio α if for all graphs G, the matching it returns has weight at least α1 w(M ∗ (G)), i.e., α1 of the weight of the maximum weighted matching of that graph. For sequential algorithms, the problem is well studied. For unweighted graphs, Micali and Vazirani [MV80] present an O( |V ||E|) time algorithm that computes a maximum matching. For weighted graphs Gabow [Gab90] gives an O(|V ||E|+ ⋆
Id: random-matchings.tex,v 1.18 2006/04/20 08:28:26 jhh Exp .
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 115–129, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
116
J.-H. Hoepman, S. Kutten, and Z. Lotker
|V |2 log |V |) time algorithm, computing the maximum weighted matching. Both return an exact solution, and not approximations. Surprisingly, few distributed algorithms to compute (an approximation of) the maximum weighted matching of the communication graph are known. For unweighted graphs, there are deterministic distributed algorithms computing a maximal matching in trees [KS00], and bipartite and general graphs [CHS02]. A randomised algorithm for the general case also exists: Israeli and Itai [II86] compute a maximal matching (i.e., no approximation) in running time O(log |V |). For weighted graphs, Uehara et al. [UC00] present a constant time distributed algorithm with approximation ratio O(Δ) (where Δ is the maximum degree of the graph). Recently, Wattenhofer et al. [WW04] presented a randomised distributed algorithm to compute a weighted matching M (G) with approximation ratio 5 and running time O(log2 |V |) for general graphs, and approximation ratio 4 and O(1) running time for trees. Hoepman [Hoe04] presents an O(|E|) time1 deterministic distributed algorithm that computes a weighted matching for general graphs with approximation ratio 2. This algorithm is based on sequential algorithms by Preis [Pre99] and Avis [Avi83], and does not require collecting all information in one node (which increases the message complexity). In this paper, we study distributed algorithms to compute a weighted matching that have constant (or at least sub-logarithmic) running time and that achieve approximation ratio 2 + ǫ or better. In fact, we present two such algorithms for arbitrary weighted trees, thus improving the previous algorithm of Wattenhofer et al. [WW04]. The first algorithm — presented in Sect. 3 — is randomised, and achieves approximation ratio 2 + ǫ in running time O(1). An interesting feature of this algorithm is that the quality of the approximation depends on the number of rounds the algorithm is allowed to run. The second algorithm — presented in Sect. 4 — is deterministic, and achieves approximation ratio 2+ǫ in running time O(log∗ |V |). We start by introducing our computation model and some notation in Sect. 2, show how our algorithms can also be applied to achieve constant approximations to the maximum (unweighted) matchings for regular and almost regular graphs in Sect. 5, and finish with some pointers to further research in Sect. 6.
2
Model and Notation
Consider a distributed system with n nodes, whose communication graph is G = (V, E). In this paper, G is a tree (denoted T ) or a regular graph. Nodes can exchange point-to-point messages with their neighbours over the edges E in the graph. Each edge e has a weight w(e), known to both endpoints of that edge. The system is synchronous and operates in rounds of message exchanges. We measure time complexity of our algorithms as the number of rounds needed to perform 1
Careful analysis shows that the time complexity is actually at most O(diam G), the diameter of the graph.
Efficient Distributed Weighted Matchings on Trees
117
the computation. We note that our algorithms also work in the asynchronous setting, after some minor modifications. We write G for general graphs, T for trees, P for paths and S for segments (that are pieces of a path). The number of edges in G is |G|, and w(G) is the weight of G, i.e., the sum of the weights of all edges of G. M (G) is a weighted matching of graph G, and M ∗ (G) is the maximum matching of graph G. weighted Let X be a random variable. We write E X Q(X) for the conditional expectation over X given that Q(X) holds. By definition (1) E X Q(X) = xPr X = x Q(X) x:Q(x)
and for disjoint Qi that together span the whole range of X we have E X Qi (X) Pr [Qi (X)] . E [X] =
(2)
i
Our protocols are described in plain English, and not in any formal protocol notation, because they are quite straightforward.
3
Randomised Case: Constant Running Time
The protocol runs in four phases, and is parameterised by a real-valued constant p between 0 and 1 and an integer constant k greater than 1. First, given input tree T , a set of paths P (T ) is generated by letting nodes select their heaviest incident edge as a potential member of a path. In the second phase, each path is cut into short segments by randomly removing edges from the path, each with probability p. Subsequently, each segment is tested to see whether its length is shorter than k. In the fourth phase, for these short segments an optimal matching is computed in time O(k), while for the remaining longer segments a constant-time randomised algorithm computes a 2 approximation of the optimal matching for this segment. Combining all matchings, and compensating for the loss of dropped edges when cutting paths into segments, this gives an O(k) algorithm to compute a matching, for which we prove an approximation ratio of 2 + ǫ for arbitrary ǫ > 0. Because k is a constant, the running time is O(1). 3.1
Computing the Paths
We use the same procedure to construct a set of paths P (T ) from a given tree T as presented by Wattenhofer et al. [WW04]. That is, a node u requests the addition of its heaviest incident edge (u, v) to this set of paths from its neighbour v. Such a requested edge is only added to the set of paths if either u also receives a request from v (for the same edge), or if v sent a grant to u for its request. Nodes request exactly one edge each. Nodes only grant at most one request, being the heaviest request coming in over an edge it didn’t request itself (assuming unique weights,
118
J.-H. Hoepman, S. Kutten, and Z. Lotker
Fig. 1. Counterexample for non-tree graphs
or breaking ties). All remaining edges (either not granted or not requested) are dropped and will not be members of any path. Because at most 2 edges per node remain, a node is a part of at most one path, and the procedure yields a set of disjoint paths. Because nodes select the heaviest incident edge, these paths cannot be cycles (we assume unique edge weights). The following lemma shows that we do not loose too much weight constructing paths this way, provided that the graph we start with is a tree. Lemma 3.1 ([WW04]). For trees T and P (T ) computed as described above, w(P (T )) ≥ w(M ∗ (T )) . In contrast, the following counterexample shows that for non-trees the difference in weight between the paths constructed for that graph and its maximum weight matching can be unbounded. Consider the graph in Fig. 1. One node connects to the central node over an edge with weight 3. This node requests this edge as a path member, and the central node grants that request. Furthermore, 2n nodes are connected to the central node through an edge with weight 2, while these nodes are connected pairwise through edges with weight 1. These 2n nodes each request the edge with weight 2 as a potential path member, but all these requests are rejected by the central node. Hence, the path consists of just one edge, and has total weight w(P (G)) = 3. However, the maximum weighted matching consists of the edge with weight 3, as well as all n edges with weight 1. Hence w(M ∗ (G)) = 3 + n. 3.2
Cutting the Paths into Segments
In the next phase, each path P is cut into segments S(P ) as follows. Every vertex sends, for each of its edges on the path, a cut request over this edge with √ probability p. An edge is cut if both endpoints sent a cut request to each other. The other edges remain. Each connected component forms a segment S in S(P ). We see that the probability for each edge to be cut is exactly p. The expected number of removed edges is p|P |, and the expected weight of all edges removed together is p · w(P ).
Efficient Distributed Weighted Matchings on Trees
119
Lemma 3.2. Let S(P ) be a random variable corresponding to the segments computed for a path P by the random process described above. Then ⎡ ⎤ E⎣ w(S)⎦ = (1 − p)w(P ) . S∈S(P )
Proof. Only edges in some S ∈ S(P ) contribute to the weight. Let P consist of edges ei , and define random variables Xei such that Xei = 1 iff ei is a member of some segment (i.e., not cut), and 0 otherwise. Then Pr [Xei = 1] = (1 − p) and ⎤ ⎡ w(ei )Xei w(S)⎦ =E E⎣ ei ∈P
S∈S(P )
=
E [w(ei )Xei ]
ei ∈P
=
ei ∈P
w(ei )Pr [Xei = 1] = (1 − p)
This proves the lemma. 3.3
w(ei ) .
ei ∈P
⊓ ⊔
Estimating the Size of the Segment
After cutting the path into segments, each vertex determines the size of the segment it is a member of. Or, to be more precise, it determines whether the segment is smaller or larger than k edges. It does so in the following manner. Vertices at the edge of a segment start the computation, by sending a distance message with value 1 along the only incident edge that belongs to a segment (and recording 0 as the distance from the other end). Nodes that receive a distance message record the distance coming in over that edge, and add one before forwarding it over the other segment edge. Forwarding stops if a segment endpoint is reached, or when the distance in the message equals k. If nodes do not record a distance for both edges, the total length of the segment is larger than k. Otherwise, the sum of both distances equals the length of the segment. In either case, all nodes know whether the length of the segment is ≤ k or > k. The running time is at most k. 3.4
Computing Matchings on the Segments
Segments compute their matching depending on their sizes, as determined in the previous phase. If a node finds it is not a member of a segment (or rather, it is a member of a segment of size 0) it does nothing. Otherwise, it cooperates with all other nodes in the same segment as described below. Consider a segment S ∈ S(P ). If |S| ≤ k, we compute a good matching M (S) for S in time k by computing two matchings M and M ′ by adding edges in S alternately to M or M ′ , and selecting the matching with maximum weight. Such
120
J.-H. Hoepman, S. Kutten, and Z. Lotker
a computation could be initiated by both endpoints of the segment. We note the running time is O(k). In the following lemma we bound the weight of the resulting matching from below2 . Lemma 3.3. For a matching M (S) of S (with |S| ≤ k) computed as described above, 1 E [w(M (S))] ≥ w(S) . 2 Proof. By construction we find two matchings M and M ′ with S = M + M ′ , and therefore w(S) = w(M ) + w(M ′ ). As we select the heaviest matching, the lemma follows. ⊔ ⊓ If |S| > k, we compute a matching M (S) for S in one round by letting vertices vote for the incident edge that should be added to the matching with equal probability (segment endpoints vote for their only edge with p = 1). An edge is only added if both its endpoints vote for it. Lemma 3.4. For a matching M (S) of S (with |S| > k) computed as described above, 1 E [w(M (S))] ≥ w(S) . 4 Proof. As each edge has at most 2 incident edges on the segment, the probability that an edge is added is at least 14 . Define random variables Xei such that Xei = 1 if the i-th edge ei of S is in the matching. Then, similar to the proof of lemma 3.2, E [w(M (S))] = w(ei )Pr [Xei = 1] . ei ∈S
As Pr [Xei = 1] ≥ 14 , the lemma follows. 3.5
⊓ ⊔
Merging the Results
The final matching M (T ) for tree T is obtained by merging all matchings computed for all segments in S(P ) for each path P in P (T ). We conclude our analysis by estimating the weight of the resulting matching. First we look at a single, but arbitrary, path P . In what follows, let S(P ) be a random variable corresponding to the segments computed for P by the random process described in section 3.2. Let S be a random variable ranging over all members of S(P ). For such a path P , define C(P ) to be the cycle obtained by merging the two endpoints of P into a single node. Given a segmentation of P , define sb and se to be the first and last segment of P , respectively, where sb starts at the endpoint and se ends at the endpoint (and where either segment may be empty if the 2
Even though the process is deterministic, we state the bound in terms of an expectation, because that is more useful further on.
Efficient Distributed Weighted Matchings on Trees
121
first and/or last edge of P happened to be cut). A segmentation of P induces a segmentation on the cycle C(P ), by taking all segments, and merging sb and se into a single segment s¯c . Let S(C(P )) be a random variable corresponding to the segments computed for C(P ). Let S¯ be a random variable ranging over all members of S(C(P )). For segments computed on this cycle, we have the following proposition. Proposition 3.5. For all i ≤ |P |, ¯ = i ≤ (1 − p)i . Pr |S|
Proof. Clearly, to have a segment of length i, we need i uncut edges. This happens with probability (1 − p)i . If i = |P |, then this is the exact probability (the segment happens to be the whole cycle), otherwise we need at least 1 (i = |P |−1) or 2 cut edges, that each lower the probability with a factor p. ⊔ ⊓
We also need the following uniformity property on the distribution of the weights over the segments computed for the cycle. Proposition 3.6. For any k ≥ 0,
¯ E w( S) ¯ =k =k ¯ |S| E w(S) ¯ E |S|
Proof. Let σ be a random variable, ranging over the single edges in a segment ¯ Let σ1 , σ2 , . . . be the edges in S. ¯ Then S. ¯ = k ={Using the fact that S¯ consists of k edges σi .} ¯ |S| E w(S) k ¯ w(σi ) |S| = k E i=1
={Independent of length of S¯ now.} k E w(σi ) i=1
={By symmetry of C(p)
all edges appear the same number of times. } kE [w(σ)] By Eq. 2 we have ¯ = ¯ = i Pr |S| ¯ =i ¯ |S| E w(S) E w(S) i
={By the above.} ¯ =i iE [w(σ)] Pr |S| i
¯ =E [w(σ)] E |S|
Combining both equations proves the proposition.
⊓ ⊔
122
J.-H. Hoepman, S. Kutten, and Z. Lotker
Next, we bound the expected weight of a matching of an arbitrary segment S¯ from S(C(P )) in terms of the expected weight of S¯ itself. ¯ of S¯ computed as described above, Lemma 3.7. For a matching M (S)
k+1 ¯ ≥ 1 1 − (1 + kp)(1 − p) ¯ . E w(M (S)) E w(S) 2 2 2p ¯ Proof. First observe that E w(M (S)) depends on two random processes: the selection of a segment s¯ from S(C(P )), and the random variable C denoting the coin sequence thrown by the randomised algorithm that computes M (¯ s). Let M (c, s¯) denote the (deterministic) result of M (¯ s) when the coins thrown are fixed to sequence c. Then ¯ ={S¯ and C are independent} E w(M (S)) M (c, s¯)Pr [C = c])Pr S¯ = s¯ ( s¯
c
≥{Split according to |¯ s| and using Lemma 3.3 and 3.4} 1 1 = w(¯ s)Pr S¯ = s¯ + w(¯ s)Pr S¯ = s¯ 2 4 s¯:|¯ s|≤k s¯:|¯ s|>k ¯ .} ={Rearranging sums and definition of E w(S) 1 1 ¯ E w(S) − w(¯ s)Pr S¯ = s¯ 2 4 s¯:|¯ s|>k ¯ > k Pr |S| ¯ > k = Pr S¯ = s¯ } ={Using Eq. 1 and Pr S¯ = s¯ |S| 1 ¯ 1 ¯ ¯ ¯ >k E w(S) − E w(S) |S| > k Pr |S| 2 4 ={Using Prop. 3.6} ¯ =i 1 ¯ 1 ¯ Pr |S| E w(S) − E w(S) i ¯ 2 4 E |S| i>k ¯ ≥ 1} ≥{Using Prop. 3.5 and E |S| 1 1 ¯ − i(1 − p)i E w(S) 2 4 i>k
={Rearranging sums and computing geometric series.}
1 1 1 − p k(1 − p)k+2 − (k + 1)(1 − p)k+1 + (1 − p) − = − 2 4 p2 (−p)2 ¯ E w(S)
(1 − p)k+1 1 1 ¯ − (1 + kp) E w(S) = 2 2 4 p
This proves the lemma.
⊔ ⊓
Efficient Distributed Weighted Matchings on Trees
123
We also need the following two propositions. Proposition 3.8. E w(S¯ ≥ E [w(S)] .
Proof. Any random segmentation for S(P ) induces a segmentation of S(C(P )), with se and sb merged into s¯c where w(¯ sc = w(sb ) + w(se ). ⊓ ⊔ Proposition 3.9. ⎡
E⎣
S∈S(P )
⎤
⎡
w(M (S))⎦ ≥ E ⎣
¯ S∈S(C(P ))
⎤
¯ ⎦ w(M (S))
Proof. In what follows, let S(P ) be a random variable corresponding to the segments computed for a path P by the random process described in section 3.2. Let S(C(P )) be the corresponding set of segments for the cycle C(P ). For all S ∈ S(P ) unequal to the end segments sb and se , the corresponding seg¯ It remains to ment S¯ in S(C(P )) is the same, and hence w(M (S)) = w(M (S)). sc ))]. Split the matching M (¯ sc ) show that E [w(M (sb )) + w(M (se ))] ≥ E [w(M (¯ into two parts, mb (for s¯b ) and me (for s¯e ), that cover sb and se respectively. Let i ∈ {e, b}. We show E [w(M (si ))] ≥ E [w(mi )]. There are two cases. |si | ≤ k : In this case (see proof Lemma 3.3), the matching computed for si is optimal. As matching mi on s¯i is also a matching for si , the statement follows. s| > k as well, and the matching M (¯ sc ) is computed using |si | > k : Then |¯ the probabilistic method for long segments (cf. Lemma 3.4). Consider the random process that selects edges for inclusion in M (¯ sc ) and hence mi . The ‘end-edge’ of s¯i (the splitting edge at which the cycle is cut into the path P) has probability 1/2 to be included in M (si ) but only probability 1/4 to be included in mi = M (¯ si ). Hence the expected weight of the matching mi is lower than M (si ). This completes the proof.
⊓ ⊔
We now bound the weight of the matching computed for P as a whole. Theorem 3.10. For any path P , and matching M (P ) computed as above, E [w(M (P ))] ≥
1 2
(1 + kp)(1 − p)k+1 (1 − p)w(P ) . 1− 2p2
Proof. In what follows, let S(P ) be a random variable corresponding to the segments computed for a path P by the random process described in section 3.2.
124
J.-H. Hoepman, S. Kutten, and Z. Lotker
We have ⎡ ⎛
E [w(M (P ))] =E ⎣w ⎝
S∈S(P )
⎞⎤
⎡
M (S)⎠⎦ = E ⎣
≥{By Prop. 3.9} ⎡ ⎤ ¯ ⎦= E⎣ w(M (S)) ¯ S∈S(C(P ))
S∈S(P )
¯ S∈S(C(P ))
By Lemma 3.7 this is greater than or equal to
(1 + kp)(1 − p)k+1 1 1− 2 2p2 ¯
S∈S(C(P ))
⎤
w(M (S))⎦
¯ E w(M (S))
¯ E w(S)
which is bounded from below through Prop 3.8
1 (1 + kp)(1 − p)k+1 E [w(S)] 1− 2 2p2 S∈S(P )
which is further bounded from below using Lemma 3.2 by
1 (1 + kp)(1 − p)k+1 (1 − p)w(P ) . 1− 2 2p2 This completes the proof.
⊔ ⊓
We finish by combining all matchings for all paths. Corollary 3.11. For any tree T , and matching M (T ) computed as above, we have
(1 + kp)(1 − p)k+1 2E [w(M (T ))] ≥ 1 − (1 − p)M ∗ (T ) . 2p2 Hence, the approximation ratio of the algorithm is 2 + ǫ for arbitrary ǫ > 0.
Proof. Follows from Theorem 3.10 and Lemma 3.1 and the fact that M (T ) = ∪P ∈P (T ) M (P ). p To see that the approximation ratio is equivalent to 2 + ǫ, set ǫ = 1−p and observe that 1 −
4
(1+kp)(1−p)k+1 2p2
tends to 1 for k going to infinity.
⊓ ⊔
Deterministic Case: O(log∗ n) Running Time
Now consider a model where every node v has a unique identity ID(v). Again, fix a constant k. In [KP98] a deterministic distributed algorithm is presented to partition a tree (or a forest) into clusters of diameter O(k), each containing at least k + 1 nodes. This constructions is done in O(k log∗ n) time. More precisely:
Efficient Distributed Weighted Matchings on Trees
125
Lemma 4.1. [KP98] The collection Pout output by Algorithm DOM-Partition(k) is a partition (of the input tree T ). Furthermore, if T is of size n ≥ k + 1, then every cluster C in Pout has the following properties: – (a) |C| ≥ k + 1. – (b) Radius(C) ≤ 5k + 2.
Moreover, Algorithm DOM-Partition(k) requires time O(k log∗ n). This algorithm uses, as a subroutine, the algorithm of [GPS87]. Using this algorithm, it is easy to modify the randomised algorithm of the previous sections to become a deterministic algorithm (with a slightly higher time complexity of O(log∗ n)) as follows. Replace the second phase of the probabilistic algorithm (the randomised cutting of the paths into segments) by Algorithm DOM-Partition(k). This change would have been enough, had the weights of the edges been equal. We need to take some care here, because DOM-Partition(k) may have deleted heavy edges. The nodes of each segment si cooperate to perform the following operation. Consider eil , eir , the edges whose deletion separated segment si from the rest of the path. Let also eim be the minimum weight edge in this segment. If the weight of either eil or eir is larger than that of eim then eim is removed from the segment, and the largest of eil or eir is reinserted as a part of the segment. If two adjacent segments wish to swap the same separator (eil equals ei+1 r ) for a lighter one, then the segment with the smallest minimum weight edge eim wins and performs the swap. Clearly the above can be performed distributively in constant time (since k is a constant). The above correction may create segments that contain less than k nodes, or segments that are at most three times as long as the original segments. (A segment that itself is not split may join both the segment at its left and its right, however then these two segments are cut in exchange for the separating edges.) The rest of the algorithm needs no changes, except that we will have no segments that are longer than 15k + 6 for some constant k, so the special treatment of long segments is not necessary. The time complexity of the resulting procedure is O(log∗ n) since in the current paper we assume that k is a constant. Theorem 4.2. For any tree T , and matching M (T ) computed as above, we have
1 M ∗ (T ) . 2w(M (T )) ≥ 1 − k+1 1 Hence, the approximation ratio of the algorithm is 2/(1 − k+1 ) = 2 k+1 k , which 2 equals 2 + ǫ if we set ǫ = k . Proof. First we compute S∈S(P ) w(S) for an arbitrary path P . As Algorithm DOM-Partition(k) returns segments of length at least k + 1 (if the path has length at least k + 1, otherwise no edges are cut), the number of cut edges from P is at most |P |/(k + 1). Swapping the originally cut edges by lower weight ones does not change the number of cut edges. Since in every original segment we
126
J.-H. Hoepman, S. Kutten, and Z. Lotker
Fig. 2. Examples of simple graphs
swapped the minimum weight edge for a removed edge, the expected weight of the cut edges (after the swap) is at most w(P )/(k + 1). Hence
w(S) = (1 −
S∈S(P )
1 )w(P ) . k+1
Next we consider the weight of the matching returned for P . Similar to the proof of Th. 3.10, and using only Lemma 3.3 to bound w(M (S)) by 21 w(S) (the proof of that lemma not only works in the expected case but also in the deterministic case, because all segments have length less than 15k + 6) we have w(M (P )) ≥ This equals
1 w(S) . 2
S∈S(P )
1 w(S) , 2 S∈S(P )
and using the above result we see that w(M (P )) ≥
1 1 (1 − )w(P ) . 2 k+1
Combining the matching for all paths constructed for the tree, and by Lemma 3.1, the theorem follows. ⊔ ⊓
5
Regular and Almost Regular Graphs
We now show how the algorithms from the previous sections can be used to compute a constant approximation for the maximum matching of unweighted, arbitrary regular graph and almost regular graphs. In order to describe the algorithm we need the following notations. We denote by ”directed simple” a directed graph were each node has only one outgoing edge, in other words the out degree of the node is 1. Note that the number of directed edges in a directed-simple graph is n and therefore there is at least one directed cycle. See Fig. 2.
Efficient Distributed Weighted Matchings on Trees
127
The algorithm works in three phases. In the first phase we generate a directedsimple spanning subgraph, and in the second phase we transform the directedsimple spanning subgraph into a collection of disjoint paths. Finally, in the third phase, we can use one of the algorithms of the previous sections to compute the maximum matching for the graph (by assigning weight 1 to all edges). We make sure that the number of remaining edges after the second phase is a constant fraction of the number of nodes n. Because the maximum matching of an unweighted graph is never larger than n2 , the resulting maximum matching is a constant approximation. A natural way to construct a directed-simple spanning subgraph is for each node to select a random neighbour from the d neighbours uniformly. After this step, we have n directed edges. Denote the union of all these directed edges by G′ (V, E ′ ). Let Vi′ be the set of all the nodes in G′ that have a degree i (in-degree plus out-degree) and V ′ i be the set of all the nodes in G′ of degree bigger than or equal to i. The next lemma estimates the size of V1′ , V2′ , V ′ 3 . Lemma 5.1. Let G′ be the directed graph constructed as above. Then 1 1 E[|V1′ |] = (1 − )d n ≤ n d e 1 1 E[|V2′ |] = ((1 − )d−1 )n ≥ n d e E[|V ′ 3 |] = n − E[|V2′ |] − E[|V1′ |] Proof. First we compute the probability for a node to have a degree 2. P [d′ (v) = 2] = dd (1 − d1 )d−1 = (1 − d1 )d−1 ≥ 1e . The probability of a node to be of degree 1 is P [d′ (v) = 1] = (1 − d1 )d ≤ 1e . Now we use the linearity of the expectation and the lemma follows. The next corollary shows that for a regular graph the expected size of V2′ is linear. Corollary 5.2. For all d ≥ 2 n/e ≥ E[|V1′ |] ≥ n/4 n/2 ≥ E[|V2′ |] ≥ n/e 0.416n ≥ E[|V ′ 3 |] ≥ (1 − 1/e − 1/2)n = 0.132n When we remove the direction from the edges we get that each connected component in G′ is a union of paths, and it ends in a cycle. Let v be a node in G′ s.t d(v ′ ) > 2. From the definition of G′ it follows that there is only one edge that is outgoing from the node (this is the edge that was chosen by the node) and this node has more than one ingoing edge. In the next time step we transform the graph G′ into the graph G′′ by randomly removing all the extra incoming edges except one. After this step all the nodes in V ′ 3 have out-degree at most 1 and in-degree equal to 1. Note that the out-degree
128
J.-H. Hoepman, S. Kutten, and Z. Lotker
can actually become 0 if the outgoing edge happens to be incoming to another node v ′′ with degree d(v ′′ ) > 2 who removes this edge to reduce its in-degree to 1. Clearly after this step E[|V1′′ |] + E[|V2′′ |] ≥ E[|V3′ |] > 0.132n. Because all these nodes have degree 1 or 2, we have at least as many edges in the graph as well. Now, we assign weights 1 to all remaining edges, and run one of the algorithms from the previous section to compute a maximum weighted matching for the remaining graph. This yields a matching of size at least (E[|V1′′ |] + E[|V2′′ |])/3 ≥ 0.132 3 n. The reason we divide by 3 is that we may have a cycle of length 3. Since a maximum matching of the original unweighted regular graph is never larger than n2 , it follows that we have a randomised algorithm that proximate 3 = 11.36 approximation ratio the maximum matching with a in expected 21 0.132 for a regular graph in a constant time. Note that the same proof will work if the graph is not an r-regular graph but an almost r-regular graph. We say that a graph G is an α-d-regular graph if Δ δ < α, where Δ is the maximal degree and δ is the minimal degree. The next lemma replaces lemma 5.1 for α-d regular graphs. Lemma 5.3. Let G be an α-d-regular graph then E[|V1′ |] ≤ ne−1/α E[|V2′ |] ≤ ne−1/α
Δ Δ−1
E[|V ′ 3 |] = n − E[|V2′ |] − E[|V1′ |] If Δ = 2 then our graph is a forest with some cycles. Using the results from section 3.5 it follows that for a graph without cycles we have a 2 + ǫ approximation. Sine a cycle is very close to a path we can use the same idea for cycles, and get a 2 + ǫ approximation for graphs with Δ ≤ 2. So we may assume that Δ ≥ 3. The next corollary shows that for 1/ log(5/2) = 1.09136 > α-d-regular graph the expected size of V3′ is linear. Corollary 5.4. for all δ ≥ 2 and 1.09136 > α,
′ −1/α 2Δ − 1 E[|V3 |] ≥ n 1 − e = Ω(n) . Δ−1 Since the size of V3′ is linear in n we can apply the algorithm from the previous section and get a constant approximation which depends on α. Corollary 5.5. Let G(n, p) when p > log(n) be a random graph. Then our apn proximation algorithm for matching is a constant approximation. From the previous corollary it may seem our algorithm always computes a matching with a constant approximation to the maximum matching. The next example shows that this is not the case. Let Kn be a clique of size n. Let Cn2 be a cycle that contains n2 nodes. We connect all the node in Cn2 to all the nodes in Kn .
Efficient Distributed Weighted Matchings on Trees
129
Note that the number of node in this graph is |V | = n2 + n, and the number of edges is n2 + n3 . The order of the maximum matching is O(n2 ). However, the expected size of the matching that our algorithm computes is 2n. So in this case the approximation ratio of the algorithm is O( |V |).
6
Conclusions
We have presented efficient distributed algorithms that compute good approximations for the maximum weighted matchings for arbitrary weighted trees. Equally good algorithms for general graphs that compute constant approximations in sub-logarithmic time are not known. We have shown why our approach of constructing paths fails in the general case. Different techniques therefore seem required to handle arbitrary graphs efficiently.
References [Avi83]
Avis, D. A survey of heuristics for the weighted matching problem. Networks 13 (1983), 475–493. [CHS02] Chattopadhyay, S., Higham, L., and Seyffarth, K. Dynamic and selfstabilizing distributed matching. In 21st PODC (Monterey, CA, USA, 2002), ACM Press, pp. 290–297. [Gab90] Gabow, H. Data structures for weighted matching and nearest common ancestors with linking. In 1th SODA (San Fransisco, Ca., USA, 1990), ACM Press, pp. 434–443. [GPS87] Goldberg, A. V., Plotkin, S., and Shannon, G. Parallel symmetry breaking in sparse graphs. In 19th STOC (New York City, NY, USA, 1987), ACM Press. [Hoe04] Hoepman, J.-H. Simple distributed weighted matchings, 2004. eprint cs.DC/0410047. [II86] Israeli, A., and Itai, A. A fast and simple randomized parallel algorithm for maximal matching. Inf. Proc. Letters 22 (1986), 77–80. [KS00] Karaata, M., and Saleh, K. A distributed self-stabilizing algorithm for finding maximal matching. Computer Systems Science and Engineering 3 (2000), 175–180. [KP98] Kutten, S., and Peleg, D. Fast distributed construction of k-dominating sets and applications. Journal of Algorithms 28, 1 (1998), 40–66. √ [MV80] Micali, S., and Vazirani, V. An O( V E) algorithm for finding maximum matching in general graphs. In 21st FOCS (Syracuse, NY, USA, 1980), IEEE Comp. Soc. Press, pp. 17–27. [Pre99] Preis, R. Linear time 1/2-approximation algorithm for maximum weighted matching in general graphs. In 16th STACS (Trier, Germany, 1999), C. Meinel and S. Tison (Eds.), LNCS 1563, Springer, pp. 259–269. [UC00] Uehara, R., and Chen, Z. Parallel approximation algorithms for maximum weighted matching in general graphs. Inf. Proc. Letters 76 (2000), 13–17. [WW04] Wattenhofer, M., and Wattenhofer, R. Distributed weighted matching. In 18th DISC (Amsterdam, the Netherlands, 2004), R. Guerraoui (Ed.), LNCS 3274, Springer, pp. 335–348.
Approximation Strategies for Routing Edge Disjoint Paths in Complete Graphs Adrian Kosowski⋆ Gda´ nsk University of Technology Department of Algorithms and System Modeling [email protected]
Abstract. The paper deals with the well known Maximum Edge Disjoint Paths Problem (MaxEDP), restricted to complete graphs. We propose an off-line 3.75-approximation algorithm and an on-line 6.47approximation algorithm, improving earlier 9-approximation algorithms due to Carmi, Erlebach and Okamoto (Proceedings WG’03, 143–155). Next, it is shown that no on-line algorithm for the considered problem is ever better than a 1.50-approximation. Finally, the proposed approximation techniques are adapted for other routing problems in complete graphs, leading to an off-line 3-approximation (on-line 4-approximation) for routing with minimum edge load, and an off-line 4.5-approximation (on-line 6-approximation) for routing with a minimum number of WDM wavelengths.
1
Introduction
The fundamental networking problem of establishing point-to-point connections between pairs of nodes in order to handle communication requests has given rise to numerous path routing problems in graph theory. The topology of the network is modeled in the form of a graph whose vertices correspond to nodes, while edges represent direct physical connections between nodes. This paper deals with the well established problem of handling the maximum possible number of communication requests without using a single physical link more than once, known as the Maximum Edge Disjoint Paths Problem (MaxEDP). We focus on the construction of approximation algorithms for the NP-hard MaxEDP problem in complete graphs, which are used to model networks with direct connections between all pairs of nodes. Two basic algorithmic approaches are considered — off-line algorithms, which compute a routing for a known set of requests provided at input, and on-line algorithms, which have to handle requests individually, in the order in which they appear. Problem definition. The physical architecture of the network is given in the form of an undirected graph G = (V, E), where V denotes the set of nodes, while ⋆
Research supported by the State Committee for Scientific Research (Poland) Grant No. 4 T11C 047 25.
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 130–142, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
Approximation Strategies for Routing Edge Disjoint Paths
131
E represents the set of connections between them. A sequence of edges P = (e1 , e2 , . . . , el ) ∈ E l , such that ei = {vi , vi+1 } for some two vertices vi , vi+1 ∈ V , is called a path of length l = |P | in G, with endpoints v1 and vl+1 . The symbol P{u,v} is used to denote any path in G with endpoints u, v ∈ V . A pair of paths P1 and P2 is called conflicting if there exists an edge e ∈ E such that e ∈ P1 and e ∈ P2 . For a given set of paths R in graph G, the conflict graph Q(R) is a simple graph with vertex set R and edges connecting all pairs of vertices corresponding to paths from set R which conflict in G. An instance I in network G is defined as any multiset of pairs {u, v}, u, v ∈ V , u = v, such that each element of I represents a single communication request between a pair of nodes. An equivalent representation of instance I may be given in the form of the instance multigraph H(I) = (V, I), where communication requests are treated as edges of H(I). A routing R of instance I in network G is a multiset of paths in G, such that there is a one-to-one correspondence between paths P{u,v} ∈ R and elements {u, v} ∈ I. The set of all routings of instance I is denoted as R(I). For use in further considerations, we define the following parameters for any routing R: – dilation d(R), defined as the length of the longest path in routing R: d(R)= maxP ∈R |P |, – edge load π(R), given by the formula: π(R) = maxe∈E |{P ∈ R : e ∈ P }|. A routing R is said to consist of edge disjoint paths if π(R) = 1, or equivalently, if conflict graph Q(R) has no edges. A formal definition of the MaxEDP problem, expressed in these terms, is given below. Maximum Edge Disjoint Paths Problem [MaxEDP] Input: Instance I in graph G. Solution: A set of pairwise edge-disjoint paths Ropt , such that Ropt ∈ R(Iopt ) for some instance Iopt ⊆ I. Goal: Maximise the cardinality of Ropt . Notation. Throughout the paper, the complete graph with vertex set V is denoted KV . Unless otherwise stated, we will assume that the MaxEDP problem is considered for the instance I in complete graph G = KV = (V, E). The optimal solution to the MaxEDP problem is some routing Ropt ∈ R(Iopt ) (Iopt ⊆ I), while approximation algorithms yield a solution denoted as RS ∈ R(IS ) (IS ⊆ I), of not greater cardinality than Ropt . Approximation ratios are understood in | .The number of elements of a set or terms of upper bounds on the ratio |I|Iopt S| multiset, and also the length of a path, is written as |P |. The symbols ΔH and χ′H are used to denote the maximum vertex degree and the chromatic index of multigraph H, respectively. State-of-the-art results. In the case of general networks G, the MaxEDP problem is closely related to a family of unsplittable flow problems. In consequence MaxEDP is NP-hard, difficult to approximate in polynomial time within
132
A. Kosowski
Table 1. New complexity results for the MaxEDP problem in complete graphs Instance restriction | ΔH(I) ≤ |V 12 |I| < |V | |I| < k|V |, const k > 0 |I| < |V |s , const s ∈ (1, 2) general case
Off-line complexity O(|V |3 ) O(|V |) O(|V |3 ) NPH , PTAS 3.75-approximation
Prop. Prop. Thm. Thm. Thm.
On-line complexity 3 2 2 3, 4 1
O(|V |) per request Cor. 3 O(|V |) per request Cor. 3 not approx. within 1.50 for |I| ≥ 3|V | Thm. 8 6.47-approximation Thm. 7
1
a constant factor, and difficult to approximate within a factor of O(log 3 −ε |E|), for any ε > 0 (unless NP ⊆ ZPTIME(npoly log n ), [1]). The variant of MaxEDP 1 defined for directed graphs is even difficult to approximate within O(|E| 2 −ε ), for any ε > 0 [12]. Both the directed and undirected version are approximable 1 within a factor of O(|E| 2 ) [15]. When graph G is the complete graph KV , the MaxEDP problem, though remaining NP-hard, becomes approximable within a constant factor. The best known approximation ratio was equal to 9 both in the off-line and on-line model of computation, due to Carmi, Erlebach and Okamoto [4]. A comparison of known approximation algorithms is provided in Table 2 at the end of the paper. Our contribution and outline of the paper. In Section 2 we deal with the off-line MaxEDP problem in complete graphs, providing a 3.75-approximation algorithm based on the simple combinatorial concept of edge-coloring. Moreover, we show that for instances with significantly fewer than |V |2 requests, the problem is either polynomially solvable, or admits a polynomial time approximation scheme. For the on-line version of the problem, in Section 3 we provide a 6.47-approximation algorithm, and show that no algorithm is better than 1.50approximate, even for restricted instances. A summary of the most important new results concerning the MaxEDP problem is given in Table 1. Finally, in Section 4 we discuss the application of similar approximation techniques to other routing problems in complete graphs, and remark on their implementation in a distributed setting.
2
The Off-Line MaxEDP Problem in Complete Graphs
In the off-line routing model, it is assumed that all pairs of vertices forming the routed instance are initially known and all paths are determined by the routing algorithm at the same time. 2.1
Preliminaries: Bounds on Solution Cardinality
Factors in a multigraph. Let Fv be a set of nonnegative integers defined for each vertex v ∈ V . An F -factor in multigraph H = (V, I) is a set of edges of H such that the number of edges from this set which are incident to vertex v
Approximation Strategies for Routing Edge Disjoint Paths
133
belongs to Fv . An [a, b]-factor is defined as an F -factor such that each set Fv consists of all integers from the range [a, b]. An [a, b]-factor with the maximum number of edges may be found efficiently by reduction to a minimum weighted perfect matching problem. Proposition 1 ([16],[11]). The problem of finding an [a, b]-factor with the maximum possible number of edges in multigraph H = (V, I) can be solved in O(|I|3 ) time. Let I be an instance in graph KV . Consider an instance Iopt yielding an optimal solution to the MaxEDP problem for instance I. It is immediately evident that any vertex v ∈ V can belong to at most degKV v = |V | − 1 requests of Iopt , hence Iopt is a [0, |V | − 1]-factor in H(I) and we have the following bound. Corollary 1. The cardinality of the optimal solution to the MaxEDP problem for I is bounded from above by the size of the maximum [0, |V |−1]-factor in H(I). Instances admitting an edge-disjoint routing. It is interesting to note that relatively wide classes of instances can be entirely routed using edge disjoint paths and in polynomial time. A short characterisation of two classes useful in further considerations is given below. Proposition 2. If |I| < |V |, then the entire instance I can be routed in KV by edge disjoint paths, and a solution Ropt ∈ R(I) to the MaxEDP problem, such that d(Ropt ) ≤ 2, can be determined in O(|V |) time. Proof. The proof is constructive and proceeds by induction with respect to |V |. For |V | = 2, we have |I| ≤ 1 and the proposition is obviously true. Next, let |V | > 2 be fixed and let u ∈ V be a vertex belonging to the smallest number of requests in I, i.e. such that u is of minimal degree in H(I). Since |I| < |V |, it is evident that degH(I) u = 0 or degH(I) u = 1. In the former case, we select an arbitrary request {v1 , v2 } ∈ I, and return the solution to the MaxEDP problem for I in KV in the form of path ({v1 , u}, {u, v2}) added to the solution to MaxEDP for instance I \{{v1 , v2 }} in complete graph KV \{u} . Thus |Ropt | = 1 + (|I| − 1) = |I| by the inductive assumption. In the latter case, let {u, v} ∈ I be the only request involving vertex u. The sought routing then consists of the single-edge path ({u, v}) added to the solution to MaxEDP for instance I \ {{u, v}} in KV \{u} . The described approach may easily be implemented in the form of an algorithm with O(|V |) time complexity. Observe that the thesis of Proposition 2 does not hold if |I| = |V | (it suffices to consider an instance composed of |V | requests between a fixed pair of vertices). Nevertheless, if |I| ∈ O(|V |) the problem can be solved in polynomial time (see Theorem 2). | Proposition 3. If ∆H(I) ≤ |V 12 , then the entire instance I can be routed in KV by edge disjoint paths, and a solution Ropt ∈ R(I) to the MaxEDP problem, such that d(Ropt ) ≤ 2, can be determined in O(|V ||I|) time.
134
A. Kosowski
Proof. First, let us observe that the size of any instance I fulfilling the assump| tions of the theorem is bounded by |I| ≤ |V2 | · |V 12 . The sought routing Ropt ∈ R(I) consisting of edge disjoint paths can be formed by sequentially assigning paths to requests from I (in arbitrary order), in such a way as to preserve the following conditions: 1. The length of any path added to Ropt is at most 2. | 2. Each vertex of graph KV is the center of at most |V 12 paths. It suffices to show that the described construction of routing Ropt is always possible. Suppose that at some stage of the algorithm Ropt fulfills conditions 1 and 2, and the next considered request is {v1 , v2 }. Vertex v1 is the endpoint of | |V | at most |V 12 − 1 paths and the center of at most 12 paths already belonging to | Ropt , thus at least 3|V 4 edges of KV incident to v1 do not belong to any path of Ropt . The same is true for vertex v2 . Thus we immediately have that the set U of vertices connected to both v1 and v2 by edges unused in Ropt is of cardinality 3|V | |V | | |U | ≥ 3|V 4 + 4 − |V | = 2 . Since routing Ropt currently consists of fewer than | |I| ≤ |V2 | · |V 12 paths, by the pigeonhole principle there must exist a vertex u ∈ U | such that u is the center of fewer than |V 12 paths from Ropt . Therefore the request {v1 , v2 } may be fulfilled by adding path ({v1 , u}, {u, v2}) 1 to routing Ropt , thus preserving the assumptions of the construction, which completes the proof. 2.2
An Off-Line 3.75-Approximation Algorithm
Theorem 1. There exists a 3.75-approximation algorithm for the MaxEDP problem in complete graphs with O(|I|3 ) runtime. The dilation of the returned solution is not greater than 2. Proof. Let I be an arbitrary instance in complete graph KV , and let Iopt ⊆ I be a subset of the considered instance whose routing is an optimal solution to the MaxEDP problem. We denote by H ∗ = (V, I ∗ ) a multigraph H ∗ ⊆ H(I) with the maximum possible number of edges, such that ∆H ∗ < |V |. Since the edge set of multigraph H ∗ is in fact a maximum [0, |V | − 1]-factor in H(I), by Proposition 1 multigraph H ∗ can be determined in O(|I|3 ) time. Moreover, by Corollary 1 we have |Iopt | ≤ |I ∗ |. We will now show that there exists an algorithm with O(|I|3 ) runtime which finds a routing RS ∈ R(IS ) composed of edge disjoint paths, such that IS ⊆ I ∗ ⊆ I and the obtained solution is a 3.75-approximation of the optimal MaxEDP |I ∗ | opt | ≥ |I3.75 . Instance IS is constructed as a subset of the edge set solution, |IS | ≥ 3.75 of multigraph H ∗ . Since ∆H ∗ < |V |, by a well known result due to Shannon [10], | the chromatic index χ′H ∗ is bounded by χ′H ∗ ≤ 3∆2H ∗ < 3|V 2 , and an edge 3|V | coloring of multigraph H ∗ using not more than 2 colors can be obtained in O(|I|3 ) time. Without loss of generality we may assume that colors are labelled 1
Throughout the paper, we assume that edges of the form {v, v} which appear in notation when enumerating edges of paths should be treated as nonexistent.
Approximation Strategies for Routing Edge Disjoint Paths
135
| with integers from the range {1, . . . , 3|V 2 }, in such a way that a color with a smaller label is never assigned to fewer edges than a color with a larger label. Let IC denote the subset of edges from I ∗ colored with colors from the range {1, . . . , |V |}. Due to the adopted ordering of the color labels, we immediately have |IC | ≥ 23 |I ∗ |. For each edge {v1 , v2 } ∈ IC , let c{v1 ,v2 } denote the color assigned to this edge, which is an integer from the range {1, . . . , |V |}, and as such may be treated as an identifier of some vertex in graph KV (see Fig. 1 for an exemplary illustration). Let us now consider routing RC of instance IC in graph KV , defined as follows: RC = {({v1 , c{v1 ,v2 } }, {c{v1 ,v2 } , v2 }) : {v1 , v2 } ∈ IC }. No vertex of H ∗ may ever be incident to two edges from IC of the same color, therefore each edge {v1 , v2 } of graph KV belongs to at most two paths of routing RC — one path, in which v1 is an end vertex and v2 is a central vertex (an edge color in IC ), and another path in which the functions of vertices v1 and v2 are reversed. Routing RC thus fulfills the following conditions: d(RC ) ≤ 2 and π(RC ) ≤ 2. Consequently, each path of RC may only conflict with at most two other paths, and the conflict graph Q(RC ) is of degree bounded by ∆Q(RC ) ≤ 2. Graph Q(RC ) is thus a set of isolated vertices, paths and cycles. Notice that the three vertex cycle C3 is a connected component of Q(RC ) only if some three paths form a triangle, i.e. P1 , P2 , P3 ∈ RC and P1 = ({v1 , v3 }, {v3 , v2 }), P2 = ({v2 , v1 }, {v1 , v3 }), P3 = ({v3 , v2 }, {v2 , v1 }), for some three vertices v1 , v2 , v3 ∈ V . Such a structure may however be easily eliminated by removing paths P1 , P2 , P3 from RC and replacing them by the following three paths: P1′ = ({v1 , v2 }), P2′ = ({v2 , v3 }), P3′ = ({v3 , v1 }), which satisfy the same set of requests and whose conflict graph consists of three isolated vertices. The sought suboptimal solution RS to the MaxEDP problem is now obtained by indicating a maximum independent set RS in conflict graph Q(RC ). Graph Q(RC ) has |RC | vertices, and once all cycles C3 have been eliminated the independent set RS consists of at least 52 |RC | vertices (or equivalently, |IS | ≥ 52 |IC |). Therefore, we finally obtain the following bound:
|I ∗ | |I ∗ | |IC | 3 5 |Iopt | ≤ = ≤ · = 3.75 |IS | |IS | |IC | |IS | 2 2 which completes the proof of the approximation ratio of the designed algorithm. It is interesting to note that although the off-line MaxEDP problem in complete graphs is NP-hard even for relatively small instances (Theorem 3), the conjecture that it is APX -hard still remains open [4], and the only inapproximability result concerns the on-line problem (Theorem 8). In fact, in the following subsection we show that for all instances of sufficiently bounded size, the off-line MaxEDP problem is not APX -hard. 2.3
Problem Complexity for Bounded Instances
We now deal with the MaxEDP problem restricted to instances I such that |I| < |V |s for some s < 2, and study the increasing difficulty of the problem with the increase of the bound on |I|.
136
A. Kosowski
Fig. 1. Construction of an approximate solution to the MaxEDP problem for instance I = {{1, 2}, {1, 2}, {1, 3}, {2, 3}, {3, 4}} in complete graph K4 : a) an edge coloring of multigraph H ∗ (in the considered case IC = I ∗ = I), b) a routing RC of instance IC in graph K4 and its conflict graph Q(RC ) (the independent set of paths forming the sought routing RS is marked in bold)
Theorem 2. An optimal solution to the MaxEDP problem in complete graphs can be determined in O(|V |3 ) time if the size of the input instance is bounded by |I| ≤ k|V |, for any constant value of parameter k > 0. Proof. Let T ⊆ V be defined as the set of all vertices belonging to more than |V | |V | 24 requests, T = {v ∈ V : degH(I) v > 24 }. Suppose that |V | ≥ 1248k (the problem for all smaller graphs may be solved by exhaustive search). Property. The size of the solution Ropt ∈ R(Iopt ) to the MaxEDP problem for instance I remains unchanged even if paths need not be disjoint with respect to edges from the edge set E ∗ of subgraph KV \T ⊆ KV . Indeed, let R∗ be a routing of a maximal possible instance I ∗ ⊆ I such that no edge from E\E ∗ belongs to more than one path of R∗ . We create an instance I ∗∗ in graph KV \T by successively considering all paths P ∈ R∗ , and adding to I ∗∗ a request consisting of the first and the last vertex from V \ T which appears in P . We now proceed to establish that it is possible to reroute instance I ∗∗ in KV \T using edge disjoint paths, leading to the conclusion that Iopt = I ∗ is a valid solution to MaxEDP in KV . Let v ∈ V \ T be arbitrarily chosen. By definition of set T , we have degH(I ∗ ) v ≤ | degH(I) v ≤ |V 24 . Since each vertex v ∈ V \ T is obviously connected to at most |T | vertices from T , we immediately have degH(I ∗∗ \I ∗ ) v ≤ |T |. Combining the
| last two inequalities we obtain degH(I ∗∗ ) v ≤ |V 24 + |T |. Since 2k|V | ≥ 2|I| = |V | v∈T degH(I) v ≥ 24 |T |, we have |T | ≤ 48k. Taking into v∈V degH(I) v ≥
account the assumption |V | ≥ 1248k, we finally obtain degH(I ∗∗ ) v ≤ |V | 24
|V | 24
+ |T | ≤
1 |V |+1248k 1 + 48k = 12 ( − 48k) ≤ 12 |V \ T |, which means that by Proposition 3 2 ∗∗ instance I can be routed in KV \T by means of edge disjoint paths, closing the proof of the property. Let I ′ ⊆ I denote the set of requests from I with at least one vertex in T , and ′ let Iopt ⊆ I ′ be a maximal subset of I ′ which can be routed by edge disjoint paths ′ ∪ (I \ I ′ ) ⊆ I is therefore a maximal subset of I which in KV . The instance Iopt can be routed by paths conflicting only within the edge set of graph KV \T , and by the proven Property such a routing can be converted to a correct solution to
Approximation Strategies for Routing Edge Disjoint Paths
137
the MaxEDP problem for I. The problem of finding Iopt ⊆ I is thus reduced to ′ finding Iopt ⊆ I ′ . Furthermore, when considering instance I ′ all vertices from set V \ T may be regarded as indistinguishable (after once more relaxing the edge disjointness condition within KV \T ). Thus graph KV may be reduced to the multigraph G′ formed by connecting each of the vertices of KT to one additional vertex u using exactly |V \ T | edges. In order to solve the MaxEDP problem for instance I ′ in G′ , we consider all possible arrangements of paths in the edge set of KT , taken over all routings of all subsets of instance I ′ . Note that the number of such arrangements is bounded, since |T | ∈ O(1). For a fixed arrangement of paths in the edge set of KT , the MaxEDP problem for instance I ′ in G′ can be easily reduced to the MaxEDP problem for a related instance in the multistar G′ \ KT . The latter problem can in turn be solved in O(|I|3 ) = O(|V |3 ) time, using a generalisation of a technique from [7] (the solution proceeds by reduction to the problem of finding a maximal [0, |V \ T |]-factor in a multigraph). This procedure determines the complexity of the entire algorithm; the final rerouting step within KV \T only requires O(|V ||I|) = O(|V |2 ) time by Proposition 3. Theorem 3. The MaxEDP problem in complete graphs is NP-hard even for instances of size bounded by |I| ≤ |V |s , for any value of parameter s > 1. Proof (sketch). The proof proceeds by reduction from the MaxEDP problem in complete graphs with cardinality restriction |I| ≤ |V |2 , which was shown to be NP-hard in [8]. Let s = 1 + ε, ε > 0. Consider an arbitrary subset of vertices V ′ ⊆ V of cardinality equal to at most |V |ε . Let I ′ be any instance in KV ′ . We define instance I in KV as follows: I = I ′ ∪ {{u, v} : u ∈ V ′ , v ∈ V \ V ′ }; for sufficiently large |V | we have |I| ≤ |V |s . The proof is complete when we observe that an optimal solution Ropt to the MaxEDP problem for instance I in graph KV is always equal to the union of two sets of paths: the set of all oneedge paths connecting vertices from KV ′ with vertices from KV \V ′ , and some ′ optimal solution Ropt to the MaxEDP problem for instance I ′ in graph KV ′ . ′ | + |V ′ |(|V | − |V ′ |). In particular, we have: |Ropt | = |Ropt Theorem 4. The MaxEDP problem in complete graphs admits a polynomial time approximation scheme for instances of size bounded by |I| ≤ |V |s , for any value of parameter s < 2. Proof (sketch). Let |I| = |V |s , where s = 2 − ε, ε > 0. The proof is in essence similar to that of Theorem 2. We adopt the same definition of set T , obtaining 1 |T | ≤ 48|V |1−ε . In all considerations we assume |V | ≥ 1248 ε , so that the Property stated in the proof of Theorem 2 also holds in this case. By this property, any subset of instance I such that each vertex from T is the endpoint of at most |V \T | paths can be routed in KV using edge disjoint paths. This implies that any maximal [0, |V \ T |]-factor in H(I) is a suboptimal solution IS to the considered MaxEDP problem. On the other hand, the cardinality of the optimal solution |Iopt | is bounded from above by the size of the maximal [0, |V |−1]-factor in H(I) by Corollary 1. The sizes of the considered factors in H(I) are closely related, |V | | 1 ≤ |V |−2|T which leads to the following bound: |I|Iopt | ≤ 1−96|V |− ε . Thus, for any S|
138
A. Kosowski
δ > 0 the considered approach achieves an approximation ratio of 1 + δ provided 1 |V | > (96(1 + max{12, δ −1 })) ε , whereas the problem may be optimally solved by exhaustive search for all smaller values of |V |. A summary of the main results of the section is given in Table 1.
3
The On-Line MaxEDP Problem in Complete Graphs
On-line algorithms for the MaxEDP problem, which are considered in this paper, are treated as a special case of greedy algorithms. We assume that successive requests from instance I appear sequentially at input, becoming known to the algorithm only once the previous request has been processed. The decision taken at every step as to whether some path fulfilling the current request should be added to the constructed edge disjoint routing RS is inadvertent and impossible to change at a later stage of the algorithm. Approximation ratios are calculated with respect to the best possible solution Ropt in the off-line model. 3.1
An On-Line 6.47-Approximation Algorithm
A slight modification of the approximation algorithm provided for the off-line case (Theorem 1) allows for its on-line operation. In the considered approach, the algorithm sequentially processes requests from instance I, treating them as edges of multigraph H(I), and at every step attempts to color the edge using a color from the range {1, . . . , |V |}. A generalization of this problem was recently considered by Favrholdt and Nielsen [9], under the name of the maximum k-edgecolorable subgraph problem for a multigraph. They stated that any fair on-line algorithm (i.e. an algorithm which always colors an edge, if only a color from the range {1, . . . , k} is available) leads to a 2√13−3 -approximation of the solution. In fact, the obtained result was significantly stronger; we shall reformulate it here for easier use in further considerations. Theorem 5 ([9]). For any multigraph H = (V, I), any fair on-line algorithm for the k-edge-colorable subgraph problem labels a subset of edges IC ⊆ I with √ colors {1, . . . , k}, such that |IC | ≥ (2 3 − 3)|I ∗∗ |, where I ∗∗ denotes a maximal [0, k]-factor in H. In particular, the above theorem holds √ for k = |V |, thus using the notation from Theorem 1 we may write |IC | ≥ (2 3 − 3)|I ∗ |. As the coloring proceeds, the sought routing RS may be incrementally constructed using an on-line independent set algorithm applied to graph Q(RC ). Since graph Q(RC ) only consists of cycles, paths and isolated vertices, we obtain |IS | ≥ 13 |IC |. Combining the obtained relations leads to the bound: |I ∗ | |I ∗ | |IC | 1 |Iopt | ≤ = ≤ √ · 3 < 6.47 |IS | |IS | |IC | |IS | 2 3−3 which may be expressed by means of the following statement.
Approximation Strategies for Routing Edge Disjoint Paths
139
Corollary 2. There exists a 6.47-approximation algorithm for the on-line MaxEDP problem in complete graphs, requiring O(|V |) time to process a single request. The dilation of the returned solution is not greater than 2. In fact, the algorithm resulting from the above considerations can be written in much simpler form, as described in the next subsection. 3.2
Performance Analysis of the BGA Algorithm
The bounded length greedy algorithm (BGA) is an on-line strategy for the MaxEDP problem, introduced in [13]. The basic principle of its operation is that at every step an attempt is made to route the current request by the shortest possible path P which does not contain any of the edges already belonging to RS , and to add P to the solution RS provided |P | ≤ L, where L is a fixed parameter of the algorithm. The computed routing RS therefore fulfills the bound d(RS ) ≤ L. The BGA strategy was last studied by Carmi, Erlebach and Okamoto [4], who bounded its approximation ratio for L = 4 using an unsplittable flow technique. Theorem 6 ([4]). The BGA strategy with L = 4 is a 9-approximation on-line algorithm for the MaxEDP problem in complete graphs. However, it is interesting to note that further bounding of the parameter L may lead to algorithms for which a better approximation ratio can be proven. Theorem 7. The BGA strategy with L = 2 is a 6.47-approximation on-line algorithm for the MaxEDP problem in complete graphs. Proof (sketch). The proof is based on the observation that each step of BGA with L = 2 combines the properties of an on-line algorithm for the edge-colorable subgraph problem with those of an on-line independent set algorithm, thus implementing an approach very similar to that described in Subsection 3.1. A request {u, v} can only be routed using BGA by a path P = ({u, w}, {w, v}) of length at most 2 via some vertex w ∈ V if edge {u, v} of multigraph H(I) can be labeled with color w ∈ {1, . . . , |V |}, and if path P does not conflict with any paths previously added to RS . The only difference is that the |V |-edge-colorable subgraph of H(I) implicitly found by the BGA algorithm need not correspond to that obtained by means of any fair algorithm, since in a step of BGA an edge of H(I) is not colored whenever any color assignment is possible, but only when assigning a color contributes to the size of the resultant solution RS . Careful analysis shows that this does not affect the overall approximation ratio which remains equal to 6.47 (Corollary 2). A further interesting property of the BGA strategy with parameter L = 2 is that it finds an edge disjoint routing of the whole instance I in the cases considered in Propositions 2 and 3. | Corollary 3. If ∆H(I) ≤ |V 12 , or |I| ≤ |V | − 1, then the entire instance I can be routed in GV by edge disjoint paths, and an optimal solution such that d(Ropt ) ≤ 2 is always determined by the BGA strategy with L = 2.
140
3.3
A. Kosowski
Inapproximability Results
Whereas the complexity of finding a solution to the off-line MaxEDP problem in complete graphs still remains open, we now show that the on-line version is not approximable within a constant factor for sufficiently large instances. Theorem 8. There does not exist any on-line approximation algorithm for the MaxEDP problem in complete graphs with an approximation ratio smaller than 1.50, even when considering instances of size |I| < k|V |, for any k ≥ 3. Proof. By contradiction, suppose that some on-line MaxEDP algorithm A has an approximation ratio not worse than 1.50. Given any graph KV , let instance I begin with |V | − 1 requests of the form {u, v}, for some two distinguished vertices u, v ∈ V . At this point the routing RS obtained by algorithm A consists of p paths, where p ≥ 23 (|V | − 1) (otherwise the instance is ended, and we have |Ropt | = |V | − 1 > 1.50|RS |). Instance I is now completed by presenting a further 2(|V | − 2) requests of the form {u, w} and {v, w}, taken over all vertices w ∈ V \ {u, v}. Since the number of paths which end in any vertex (in particular, u or v) cannot exceed |V | − 1, the total number of paths eventually belonging to RS is bounded by |RS | ≤ p + 2((|V | − 1) − p) ≤ 34 (|V | − 1), whereas |Ropt | = opt | 2(|V | − 2) + 1 = 2(|V | − 1) − 1, hence the ratio |R |RS | cannot be smaller than 1.50 for arbitrarily large values of |V |. Even in the on-line model, the gap remaining between the 1.50 inapproximability result of Theorem 8 and the 6.47-approximation algorithm from Theorem 7 is quite substantial. A partial attempt to bridge it may be performed by considering the inapproximability of specific classes of on-line algorithms. For example, the BGA algorithm and similar strategies are never better than 3-approximate for certain classes of instances [4].
4
Final Conclusions
The technique adopted in the proof of Theorem 1 — which may basically be thought of as routing by edge coloring — provides efficient approximation Table 2. A comparison of presented approximation algorithms for the MaxEDP problem in complete graphs with previous results (updated from [4]) Principle of operation
Model Approximation ratio Dilation Reference
Shortest-path-first variant of BGA Set tripartition BGA with L = 4 BGA with L = 4
off-line off-line on-line on-line
54 27 17 9
≤4 ≤4
BGA with L = 2 Routing by edge coloring
on-line off-line
6.47 3.75
≤2 ≤2
[8], [8], [13], [4],
2001 2001 2002 2003
Thm. 7 Thm. 1
Approximation Strategies for Routing Edge Disjoint Paths
141
algorithms for a number of routing problems in complete graphs and similar extremely dense topologies. When applying this approach, the approximation ratio may vary depending on the considered problem, and is usually given in the form of the product of two parameters M1 · M2 , where M1 denotes the relative loss in the first phase of the algorithm (determining an edge coloring), and M2 is the relative loss in the second phase (post-processing the edge coloring). For the MaxEDP problem, the applied techniques constitute a substantial improvement on earlier results (Table 2). We now give two more examples of routing problems for which fixed-ratio approximation algorithms can be similarly obtained. The edge load routing problem. For a given instance I in graph KV , we consider the problem of finding a routing Ropt ∈ R(I), such that edge load π(Ropt ) is the minimum possible [2, 3]. In order to construct an approximation approach with respect to π(RS ) within KV , observe that multigraph H(I) can always be efficiently edge-colored with at most 1.5(|V | − 1) π(Ropt ) colors in the off-line model, or 2(|V | − 1) π(Ropt ) colors in the on-line model. By applying a similar approach as that in the proof of Theorem 2, it is easy to see that the instance corresponding to any (|V | − 1)-edge-colorable subgraph of H(I) can always be routed with load at most 2, both in the off-line and the on-line model. Thus we have M2 = 2 and M1 = 1.5 (off-line) or M1 = 2 (on-line), finally obtaining an off-line 3-approximation algorithm and an on-line 4-approximation algorithm for edge load routing in complete graphs. The WDM wavelength count routing problem. This modification of the edge load routing problem is of special importance from the point of view of application in so called all-optical wavelength division multiplexing (WDM) networks [2, 5, 6]. For a given instance I in graph KV , the sought routing Ropt ∈ R(I) should minimize the value of a parameter called WDM wavelength count w(Ropt ), defined as the chromatic number of conflict graph Q(Ropt ). The proposed construction of an approximation algorithm with respect to w(RS ) is nearly the same as for bounded edge load, the only difference being that in the second stage of the algorithm (|V | − 1)-edge-colorable subgraphs of H(I) can always be routed using 3 wavelengths. Therefore in this case we have M2 = 3 and M1 = 1.5 (off-line) or M1 = 2 (on-line), yielding an off-line 4.5-approximation algorithm and an on-line 6-approximation algorithm for the considered problem. Finally, let us remark on a general property of the approximate solutions obtained using the proposed approach: in all cases the dilation is bounded by a value of 2. Using paths with at most 1 intermediary node between the communicating pair of endpoints is advantageous from the point of view of resource usage, and additionally simplifies the routing process. Indeed, if the on-line version of the routing algorithm is considered in a distributed setting, each node can independently decide whether it may participate in the routing of a given communication request. Thus each request can be processed in O(1) synchronous rounds, achieving a time-optimal routing process.
142
A. Kosowski
Acknowledgement. The author would like to express his gratitude to the anonymous referees for their numerous helpful comments and suggestions for the improvement of this paper.
References 1. M. Andrews, L. Zhang, Hardness of the undirected edge-disjoint paths problem. Proc. STOC’05 (2005), 276–283. 2. B. Beauquier, J.C. Bermond, L. Gargano, P. Hell, S. P`erennes and U. Vaccaro, Graph problems arising from wavelength routing in all-optical networks. Proc. WOCS’97 (1997), Geneve, Switzerland. 3. J. Bialogrodzki, Path Coloring and Routing in Graphs. In: Graph Colorings, M. Kubale ed., Contemporary Math. 352, AMS (2004), USA, 139–152. 4. P. Carmi, T. Erlebach, Y. Okamoto, Greedy edge-disjoint paths in complete graphs. Proc. WG’03, LNCS 2880 (2003), 143–155. 5. S. Choplin, L. Narayanan, J. Opatrny, Two-Hop Virtual Path Layout in Tori. Proc. SIROCCO’04, LNCS 3104 (2004), 69–78. 6. T. Erlebach, K. Jansen, The complexity of path coloring and call scheduling. Theoret. Comp. Sci. 255 (2001), 33–50. 7. T. Erlebach, K. Jansen, The Maximum Edge-Disjoint Paths Problem in Bidirected Trees. SIAM J. Discret. Math. 14 (2001), 326–355. 8. T. Erlebach, D. Vukadinovi´c, New results for path problems in generalized stars, complete graphs, and brick wall graphs. Proc. FCT’01, LNCS 2138 (2001), 483–494. 9. L.M. Favrholdt, M.N. Nielsen, On-line edge-coloring with a fixed number of colors. Algorithmica 35 (2003), 176–191. 10. S. Fiorini, R.J. Wilson: Edge-Colourings of Graphs, Pittman (1977), USA. 11. H.N. Gabow, Data structures for weighted matching and nearest common ancestors with linking. Proc. SODA’90 (1990), 434–443. 12. V. Guruswami et al, Near-optimal hardness results and approximation algorithms for edge-disjoint paths and related problems. J. Comput. Syst. Sci. 67 (2003), 473– 496. 13. P. Kolman, C. Scheideler, Improved bounds for the unsplittable flow problem. Proc. SODA’02 (2002), 184–193. 14. B. Ma, L. Wang, On the inapproximability of disjoint paths and minimum Steiner forest with bandwidth constraints, J. Comput. Syst. Sci. 60 (2000), 1–12. 15. A. Srinivasan, Improved approximations for edge-disjoint paths, unsplittable flow, and related routing problems, Proc. FOCS’97 (1997), 416–425. 16. W.T. Tutte, A short proof of the factor theorem for finite graphs. Canad. J. Math. 6 (1954), 347–352.
Short Labels by Traversal and Jumping⋆ Nicolas Bonichon, Cyril Gavoille, and Arnaud Labourel Laboratoire Bordelais de Recherche en Informatique, Universit´e Bordeaux 1 {bonichon, gavoille, labourel}@labri.fr
Abstract. In this paper, we propose an efficient implicit representation of caterpillars and binary trees with n vertices. Our schemes, called Traversal & Jumping, assign to vertices of the tree distinct labels of log2 n + O(1) bits, and support constant time adjacency queries between any two vertices by using only their labels. Moreover, all the labels can be constructed in O(n) time.
1
Introduction
The two basic ways of representing a graph are adjacency matrices and adjacency lists. The latter representation is space efficient for sparse graphs, but adjacency queries require searching in the list, whereas matrices allow fast queries to the price of a super-linear space. Another technique, called implicit representation or adjacency labeling scheme, consists in assigning labels to each vertex such that adjacency queries can be computed alone from the labels of the two involved vertices without any extra information source. The goal is to minimize the maximum length of a label associated with a vertex while keeping fast adjacency queries. Adjacency labeling schemes, introduced by [Bre66, BF67], have been investigated by [KNR88, KNR92]. They construct for several families of graphs adjacency labeling schemes with O(log n)-bit labels. In particular, for trees the scheme consists in: 1) choosing an arbitrary prelabeling of the n vertices, a permutation of {1, . . . , n}; 2) choosing a root; and 3) setting the label of a vertex to be the pair formed by its prelabel and the prelabel of its parent. The adjacency test checks whether the prelabel for one vertex equals the parent prelabel of the other vertex. Such labels are of 2 ⌈log n⌉ bits1 , whereas ⌈log n⌉ bits are clearly necessary since labels must be different. Improving the label length of this straightforward scheme is not an easy task. It has been however improved in a non trivial way by [AKM01] to 1.5 log n + O(log log n) bits, and more recently to log n + O(log∗ n) bits2 [AR02], leaving open the question of whether trees enjoy a labeling scheme with log n + O(1) bit labels. ⋆
1 2
The three authors are supported by the project ”GeoComp” of the ACI Masses de Donn´ees. All the logarithms are in base two. Log∗ n denotes the number of times log should be iterated to get a constant.
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 143–156, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
144
1.1
N. Bonichon, C. Gavoille, and A. Labourel
Related Work
Motivated by applications in XML search engines, and distributed applications as peer-to-peer networks or network routing, several other distributed datastructures with optimal O(log n)-bit labels, have been developed. For instance, routing in trees [FG01, TZ01], near-shortest path routing in specific networks [BG05, DL02, DL04], distance queries for interval, circulararc, and permutation graphs [BG05, GP03a], etc. have O(log n)-bit distributed data-structures. And, specifically for several queries on trees, we have: nearest common ancestor [AGKR04] with O(log n)-bit labels, ancestry [AAK+ 05] √ with log n + O( log n ) bit labels, and small distance queries and other related functions with log n + Θ(log log n) bit labels [KM01, ABR05]. Interestingly, it is shown in [ABR05] that for sibling queries in trees of maximum degree ∆, log n + Θ(log log ∆) bit labels are necessary and sufficient. A survey on labeling schemes can be founded in [GP03b]. All these schemes achieve labeling of length3 log n + ω(1). To our best knowledge, for reasonably large families of graphs, no distributed data-structure is known to have an optimal label size up to an additive constant. In particular, for adjacency queries in trees, the current lower bound is log n and the upper bound is log n + O(log∗ n) [AR02]. This latter scheme, based on a recursive decomposition of the tree in Θ(log∗ n) levels, has adjacency query time of Ω(log∗ n). 1.2
Our Contributions
In this paper we present adjacency labeling schemes for caterpillars (i.e., a tree whose nonleaf vertices induce a path), and binary trees with n vertices. Both schemes assign distinct labels of log n + O(1) bits, and support constant time adjacency queries. Moreover, all the labels can be constructed in O(n) time. We observe that the recursive scheme of [AR02] for general trees does not simplify for caterpillars or binary trees. The worst-case label length remains log n+O(log∗ n) and the adjacency query time Ω(log∗ n). As far as we know, this is the first log n+ O(1) bit adjacency labeling supporting constant query time for a family of trees including trees with an arbitrary numbers of arbitrary degree vertices (caterpillars). The technique, called Traversal & Jumping, is interesting on its own, and we believe that it might be extended to larger families of graphs, and to other queries. 1.3
Outline of Techniques
To introduce our labeling technique, let us consider an n-vertex caterpillar whose path is x1 , . . . , xk and where the j-th leaf of xi is denoted by yi,j . The first naive approach consists in labeling each vertex xi with the pair (i, 0) and yi,j with (i, 1) but this scheme does not respect the uniqueness condition for the labels. A correct scheme can be obtained by using labels (i, j) for yi,j . The 3
f (n) = ω(g(n)) if and only if g(n) = o(f (n)).
Short Labels by Traversal and Jumping
145
adjacency test is then trivial. This labeling, which is a variant of the tree labeling scheme presented above, is not efficient since every pair of nonnegative integers (i, j) with i + j n will be assigned by the scheme to some caterpillars. There are at least (n/2)2 such pairs, yielding some labels of at least 2 log n − O(1) bits. A second less trivial labeling (with distinct labels) assigns to each vertex yi,j the pair (ri , j) where ri is the rank of the number of leaves of xi , so that less bits are used for ri if xi has many leaves, leaving room for the index j. Because j n/ri , the label length reduced now to ⌈log ri ⌉ + ⌈log(n/ri )⌉ log n + O(1). However, the fields of the pair (ri , j) have variable length, so log log min {ri , j} + O(1) bits are required to code the position of the two values of the pair. Moreover, this scheme does not give adjacency for two nodes in the path. Anyway, as√all required an extra information of log log n possible pairs (ri , j) can occur, this √ bits (in the worst-case min {ri , j} n), yielding labels of length at least log n+ log log n − O(1). A third solution is to apply some recursive decomposition, as in [AR02]. However, any decomposition in a non-constant levels produces labels with a nonconstant number of fields, yielding a label length of log n + ω(1) bits, furthermore with ω(1) adjacency query time. Labelings with log n+O(1) bits require new ideas. Roughly speaking, the Traversal & Jumping technique consists in: 1. Selecting a suitable traversal of the tree (or of the graph); 2. Associating with each vertex x some information C(x); 3. Performing the traversal and assign the labels with increasing but non necessarily consecutive numbers to the vertices. Intuitively, the adjacency test between x and y is done on the basis of C(x) and C(y). Actually, the jumps achieved in Step 3 are done by selecting an interval associated with each vertex in which its label must be. It is important to note that the intervals are ordered in the same way as the corresponding vertices in the traversal. Moreover, all vertex intervals must be disjoint. The position of the label of x in its interval is tuned in order to encode C(x) in the label in a self-extracting way. In general, the information C(x) determines the intervals length of all the neighbours of x which are after in the traversal. The main difficulty is to design the minimal information C(x) and to tune the jumps, i.e., the interval length. The maximum label length is simply determined by the value of the last label assigned during the traversal. This technique fundamentally differs from previous schemes, in which a label is essentially viewed as a unique prelabel of ⌈log n⌉ bits plus some small extra fields, inevitably leading to labels of log n + ω(1) bits. On the contrary, Traversal & Jumping abandons this representation, and uses the full range of values [0, O(n)] to get labels of length log n + O(1). Section 2 presents the scheme for caterpillars, and Section 3 for binary trees. We propose further works in Section 4. 1.4
Preliminaries
We assume a RAM model of computation with Ω(log n)-bit words. In this model, standard arithmetic operations on words of O(log n) bits can be done in constant
146
N. Bonichon, C. Gavoille, and A. Labourel
time. These include additions, comparisons, binary masks, shifting, MSB and LSB (returning respectively the position of the most and least significant bit of a word). Given a binary string A, we denote by |A| its length, and for a binary string B, A ◦ B denotes the concatenation of A followed by B. Given an x ∈ N, we denote by lg x = log max {x, 1}, and by bin(x) its standard binary representation. We have |bin(x)| = ⌊lg x⌋ + 1. We denote by val(w) the integer x such that w = bin(x). When it is clear from the context, we confuse w and val(w). We also denote by ⌈x⌉2 = 2⌈lg x⌉ . A code is a set of words, and a code is suffix-free if no words of the code is the ending of another one. A basic property of suffix-free codes it that they can be composed, by the concatenation of a fixed number of fields, to form new suffixfree codes. A simple suffix-free code is defined by code0 (x) = 1 ◦ 0x , where 0x is the binary string composed of x zeros. This code extends to more succinct codes defined recursively by codei+1 (x) = bin(x)◦ codei (|bin(x)|− 1) for every i 0. It is easy to check that, for every i 0, codei is suffix-free. E.g., code0 (5) = 100000, code1 (5) = 101 100, and code2 (5) = 101 10 10. If a word w has codei (x) as suffix, then x can be extracted from w in O(i) time (in particular with the use of LSB to extract the length of code0 ). In the sequel, any integer sequence x1 , . . . , xk can be stored as a suffix codei (x1 )◦· · ·◦codei (xk ), and can be extracted in O(ik) time. In this paper, we will essentially use codei for i ∈ {0, 1, 2}. We check that for every x ∈ N, |code0 (x)| = x + 1, |code1 (x)| = 2 ⌊lg x⌋ + 2, and |code2 (x)| = ⌊lg x⌋ + 2 ⌊lg ⌊lg x⌋⌋ + 3. Claim. Let w be a word, and z an integer. One can compute in constant time an integer x ∈ [z, z + 2|w| ) such that w is a suffix of bin(x). Proof. Observe that, for all strings A and B, val(A ◦ B) = val(A) · 2|B| + val(B), |A| and that val(A) < 2 . Let u = z/2|w| and v = z mod 2|w| , so that z = u · 2|w| + v. Set b = 0 if val(w) v, and set b = 1 otherwise. The integer x is defined by bin(x) = bin(u + b) ◦ w, that clearly contains w as suffix. Note that x can be computed in constant time using shifts, masks and MSB (in particular MSB is used to compute |w| from w). It remains to check that x ∈ [z, z + 2|w| ). We have x = (u + b) · 2|w| + val(w) = z − v + b · 2|w| + val(w). If b = 0, then x = z − v + val(w) z + val(w) < z + 2|w|. For b = 0, val(w) v, thus x z. If b = 1, then x = z − v + 2|w| + val(w) > z + val(w) z since v < 2|w| . For b = 1, val(w) < v, thus z − v + 2|w| + val(w) < z + 2|w| .
2
Caterpillars
A leaf is a vertex of degree one, and an inner vertex is a nonleaf vertex. A tree is a caterpillar if the subgraph induced by its inner vertices is a path.
Short Labels by Traversal and Jumping
147
Theorem 1. The family of caterpillars with n vertices enjoys an adjacency labeling scheme with labels of length at most ⌈log n⌉ + 6 bits, supporting constant time adjacency query. Moreover, all the labels can be constructed in O(n) time. 2.1
Description of the Labeling Scheme
Consider a caterpillar G of n vertices. We denote by X = {x1 , . . . , xk } the inner vertices of G (ordered along the path). For every i, let Yi = {yi,1 , . . . , yi,di } be the set of leaves attached to xi , with di = 0 if Yi = ∅. The traversal used in our scheme is a prefix traversal of the caterpillar rooted at x1 where the vertices of Yi are traversed before the vertex xi+1 . According to this traversal, the inner vertex xi stores necessary information to determine the adjacency with the vertices of Yi ∪ {xi+1 }. The leaves do not store any specific information in their label. With each inner vertex xi , we associate an interval of length pi , for some suitable integer pi , in which its label ℓ(xi ) must be. For some technical reasons, impose that pi = 2ti +3 with ti is an integer 0. With the set of the labels of Yi we associate an interval of same length: (ℓ(xi ), ℓ(xi ) + pi ]. In this interval ℓ(yi,j ) = ℓ(xi ) + j. Finally, the interval associated with vertex xi+1 is (ℓ(xi ) + pi , ℓ(xi ) + pi + pi+1 ]. The information encoded by xi is the ordered pair (ti , ti+1 ). To encode this information, we propose the following suffix-free code: C(xi ) = code0 (ti + 3 − |code1 (ti+1 )|) ◦ code1 (ti+1 ) . Three conditions on pi (and so on ti ) have to be satisfied to ensure that the code is valid. The value pi must be large enough to encode the information, large enough so that all the labels of the vertices of Yi can be placed in the interval (ℓ(xi ), ℓ(xi ) + pi ], and pi 8. The following relation ensures such conditions: ti = max {|code1 (ti+1 )| − 3, ⌈lg di ⌉ − 3, 0} , with tk+1 = 0 . So, given ℓ(xi ), ℓ(xi+1 ) is computed applying Claim 1.4 with w = C(xi+1 ) and z = ℓ(xi ) + pi . One can remark that the value of ti depends on the value of ti+1 . The computation of the labels can be done with two traversals of the caterpillar. The value of the ti is computed from a traversal of the path from xk to x1 . A second traversal (a prefix one starting from x1 ) computes the labels of the vertices. Each traversal takes O(n) time. Finally, an additional bit is added to the labels to determine if the vertex is an inner vertex: ℓ′ (xi ) = 1 ◦ ℓ(xi ) and ℓ′ (yi,j ) = 0 ◦ ℓ(yi,j ). 2.2
Adjacency Test
Lemma 1. For every pair of vertices u and v, the adjacency between u and v can be computed in constant time from ℓ′ (u) and ℓ′ (v).
148
N. Bonichon, C. Gavoille, and A. Labourel
Proof. Looking at the first bit of ℓ′ (u) and ℓ′ (v) one can check whether u and v i=k belongs to X or to Y = i=1 Yi . Because two leaves cannot be adjacent, let us assume that u ∈ X with u = xi .
In constant time, we can compute ℓ(xi ), ti and ti+1 from ℓ′ (xi ), decoding C(xi ). Recall that pi and pi+1 can be directly deduced from ti and ti+1 . There are two cases to consider: – Case 1: v ∈ Y (the first bit of the label is 0). By construction, the labels of vertices of Yi and only these belong to the interval (ℓ(xi ), ℓ(xi ) + pi ]. Since the length of the labels is O(log n) (see Lemma 2), this test can be performed in constant time. – Case 2: v ∈ X (the first bit of the label is 1). Let v = xj , and w.l.o.g. assume that j > i (we simply check whether ℓ′ (v) > ℓ′ (u)). By construction if j = i + 1, then ℓ(xi ) + pi < ℓ(xj ) ℓ(xi ) + pi + pi+1 . This interval may contain other labels (labels of vertices of Yi+1 ), but the only label of inner vertex if ℓ(xi+1 ). This test can also be performed in constant time.
2.3
Label Length
Lemma 2. The length of the labels is at most ⌈log n⌉ + 6. Proof. First, let us show by induction the following property (Pm ): k k (Pm ) : pi 8 ⌈di + 1⌉2 − pm . i=m
i=m
i=k
(Pk ) is true since dk > 0 and i=k pi = pk = max {8, ⌈dk + 1⌉2 } k 8 i=k ⌈di + 1⌉2 − pk . Assume that (Pm ) is true for some m ∈ [2, k], and let us show (Pm−1 ): Applying the induction hypothesis: k k ⌈di + 1⌉2 − pm + pm−1 . pi 8 i=m
i=m−1
There are three cases to consider: – Case 1: ⌈dm−1 ⌉2 8 and 2|code1 (tm )| 8 ⇒ pm−1 = 8. k
pi 8
i=m−1
k
i=m
⌈di + 1⌉2
− pm + 8
Since ⌈dm−1 + 1⌉2 1: k
i=m−1
pi 8
k
i=m−1
⌈di + 1⌉2
− pm
Short Labels by Traversal and Jumping
149
Since pm pm−1 : k
pi 8
k
i=m−1
i=m−1
⌈di + 1⌉2
− pm−1
– Case 2: ⌈dm−1 ⌉2 2|code1 (tm )| ⇒ pm−1 = ⌈dm−1 ⌉2 . k
pi 8
k
i=m
i=m−1
8
⌈di + 1⌉2
k
i=m−1
8
k
i=m−1
− pk + ⌈dm−1 ⌉2
⌈di + 1⌉2
− pk − 7 ⌈dm−1 + 1⌉2
⌈di + 1⌉2
− pm−1
– Case 3: ⌈dm−1 ⌉2 < 2|code1 (tm )| and 8 < 2|code1 (tm )| ⇒ pm−1 = 2|code1 (tm )| . k
pi 8
i=m−1
k
i=m
⌈di + 1⌉2
− pm + 2|code1 (tm )| .
Since pm−1 = 2|code1 (tm )| = 22⌈log((log(pm )−3)+1)⌉ 21 pm : k
pi 8
8
k
i=m−1
i=m−1
k
i=m−1
⌈di + 1⌉2
1 − pm 2
⌈di + 1⌉2
− pm−1 .
So (Pm ) is true for any positive m k. Hence: k k ⌈di + 1⌉2 . pi 8 i=1
i=1
The maximum label length is determined by the label of the last leaf of xk , say yk,j . We can bound ℓ(yk,j ) by: ℓ(yk,j ) 2
k i=1
pi 2 4
k i=1
⌈di + 1⌉2 25
k
(di + 1) 25 n .
i=1
The length labels ℓ(yk,j ) is at most ⌈log n⌉ + 5. The effective labels, ℓ′ (v), use one more bit. So the label length is at most ⌈log n⌉ + 6.
150
3
N. Bonichon, C. Gavoille, and A. Labourel
Binary Trees
Theorem 2. The family of binary trees with n vertices enjoys an adjacency labeling scheme with labels of length at most log n+O(1) bits, supporting constant time adjacency query. Moreover, all the labels can be constructed in O(n) time. 3.1
Description of the Labeling Scheme
Let T be a rooted binary tree with n vertices. For any vertex v, let Tv denote the subtree of T rooted at v. Let rT be the root of T . We denote by v − and v + respectively the left and the right child of v (if exist). We assume that the children of every inner vertex v are ordered such that the weight of v − is at most the weight of v + , i.e., |V (Tv− )| |V (Tv+ )|. For the shake of the proof, we assume that v − exists for every inner vertex v, possibly by completing the tree with some extra vertices. Note that this at most double the size of the tree. The traversal considered in our scheme is a prefix traversal of T in which v − is visited before v + , for every inner vertex v. Let s(v) be the length of the interval assigned to v, and let p(v) be the length of the interval of values assigned to the labels of vertices of Tv (see Fig. 1). In the scheme, the interval associate with v is at the beginning of the interval of Tv (on Fig. 2 arrows s(v) and p(v) are aligned on the left). The interval of Tv− is at distance s(v) from ℓ(v) (i.e., the difference of the left boundaries of the intervals is s(v)). The interval of Tv+ begins at distance s(v) + q(v − ) from ℓ(v) (cf. Fig. 2), for a suitable length q(v − ). In addition, our scheme imposes that s(v) is a power of 2, and that q(v − ) is a square. More precisely, s(v) = 2m(v) for some integer m(v) 0, and q(v − ) = 2 ⌈ p(v − ) ⌉ . Observe that for every v, q(v) = p(v) + O( p(v) ), and that q(v) can be encoded with half many bits than for p(v). ℓ(v)
ℓ(v− )
ℓ(v+ )
q(v− )
p(v+ )
p(v)
Fig. 1. Traversal of the tree
Short Labels by Traversal and Jumping
151
p(v) p(v+ )
q(v− ) p(v− ) ℓ(v) s(v) s(v)
ℓ(v+ )
ℓ(v− ) s(v− ) s(v− )
s(v+ ) s(v+ )
Fig. 2. Description of the labeling
To compute the adjacency with its children, vertex v stores a single bit 0 if it is a leaf, and the quadruple (s(v − ), s(v + ), q(v − ), 1) if it is inner. To encode this information, we propose the following suffix-free code:
0 if v is a leaf C(v) = code1 (m(v − )) ◦ code1 (m(v + )) ◦ code2 ( q(v − ) ) ◦ 1 otherwise
We set s(v) = 2|C(v)|−1 , i.e., m(v) = |C(v)| − 1. To compute the labels we need first to compute s(v) and p(v) for each vertex v of T . This is done in linear time with a postfix traversal considering the recursive relation:
2 if v is a leaf p(v) = q(v − ) + p(v + ) + 2s(v) otherwise Then, the labels can be computed in linear time with a traversal of T , and applying Claim 1.4 with w = C(v). 3.2
Adjacency Test
Lemma 3. Let any pair of vertices v and u, the adjacency of v and u can be computed in constant time from ℓ(v) and ℓ(u). Proof. W.l.o.g., we can consider that ℓ(v) < ℓ(u). To test adjacency between v and u, we use the following conditions: v and u are adjacent if and only if y is inner and: – either ℓ(u) ∈ [ℓ(v) + s(v), ℓ(v) + s(v) + s(v − )) (in this case u = v − ); – or ℓ(u) ∈ [ℓ(v) + s(v) + q(v − ), ℓ(v) + s(v) + q(v − ) + s(v + )) (in this case u = v+ ) We can remark that this test can be computed in constant time from the labels of the vertices. Indeed, s(v), s(v − ), s(v + ), and q(v − ) can be extracted in constant time from ℓ(u). It remains to prove the validity of this test. If v is a leaf (and ℓ(v) < ℓ(u)), v and u cannot be adjacent. To check it, it suffices to extract the last bit of
152
N. Bonichon, C. Gavoille, and A. Labourel
ℓ(v). Now assume v is inner. By construction, if u = v − then ℓ(u) ∈ [ℓ(v) + s(v), ℓ(v) + s(v) + s(v − )). In the same way, if u = v + then ℓ(u) ∈ [ℓ(v) + s(v) + q(v − ), ℓ(v) + s(v) + q(v − ) + s(v + )). Moreover, ℓ(v − ) is the only label in [ℓ(v) + s(v), ℓ(v) + s(v) + s(v − )) because, in the construction we make a jump from ℓ(v) to ℓ(v − ) of length s(v) and we make another jump from ℓ(v − ) to ℓ(v −− ) (if exists) of length at least s(v − ). With the same argument, we prove that ℓ(v + ) is the only label in [ℓ(v) + s(v) + q(v − ), ℓ(v) + s(v) + q(v − ) + s(v + )). 3.3
Label Length
Lemma 4. The length of the labels is at most log n + O(1). Proof. Let Bn be the family of all binary trees of at most n vertices such that every leaf has a sibling (i.e., v − and v + exist for every inner vertex v). For every tree T ∈ Bn with n 3: p(rT ) = q(rT − ) + p(rT + ) + 2s(rT ) where log s(rT ) = |C(rT )| − 1 = |code1 (m(rT − ))| + |code1 (m(rT + ))| + |code2 (⌈ p(rT − )⌉)| = |code1 (log s(rT − ))| + |code1 (log s(rT + ))| + |code2 (⌈ p(rT − )⌉)|
Let P (n) = maxT ∈Bn p(rT ), and S(n) = maxT ∈Bn s(rT ). Because every label assigned to T ranges in [0, P (n)), our goal is to upper bound P (n) by O(n). Let i = |V (TrT − )| be the weight of the left subtree. We have p(rT − ) P (i) and p(rT + ) P (n − 1 − i). Similarly, s(rT − ) S(i) and s(rT + ) S(n − 1 − i). By the ordering of the children, observe that i n − 1 − i, i.e., i can only range in I = {1, . . . , ⌊(n − 1)/2⌋}. 2 From previous equations we derive (recall that q(v − ) = ⌈ p(v − ) ⌉ ):
2 P (n) = max where P (i) + P (n − i − 1) + 2S i∈I log S = |code1 (log S(i))| + |code1 (log S(n − i − 1))| + |code2 (⌈ P (i)⌉)| with P (1) = 2 and S(1) = 1. Note that for x ∈ N, 2lg x x + 1. The two first terms of log S can be bounded by: |code1 (log S(i))| = 2 ⌊lg log S(i)⌋ + 2, and thus
2|code1 (log S(i))| 4 log2 S(i) + 4, and similarly 2|code1 (log S(n−i−1))| 4 log2 S(n − i − 1) + 4 . By construction, p(v) 2s(v) for every v, thus S(n) P (n)/2 for every n. So, bounding (x − 1)2 x2 − 1, we obtain: 2|code1 (log S(i))| 4 log2 P (i) and 2|code1 (log S(n−i−1))| 4 log2 P (n − i − 1).
Short Labels by Traversal and Jumping
Let u =
153
P (i). We have u 1. The third term of log S can be bounded by:
|code2 (⌈u⌉)| = ⌊lg ⌈u⌉⌋ + 2 ⌊lg ⌊lg ⌈u⌉⌋⌋ + 3, and thus 2
2|code2 (⌈u⌉)| 8 · (⌈u⌉ + 1) · (⌊lg ⌈u⌉⌋ + 1) 16u(log2 u + 2) .
Therefore, S 4 · log2 P (i) · log2 P (n − i − 1)) · 16 P (i) · (log2 P (i) + 2) 16 P (i) · (log2 P (i) + 8) · log2 P (i) · log2 P (n − i − 1) √ √ 2 One can check that for x 1, ⌈ x ⌉ x + 2 x. Hence: P (n) max P (i) + 2 P (i) + P (n − i − 1) + 2S i∈I max P (i) + P (n − i − 1) + 34 P (i) log4 P (i) log2 P (n − i − 1) i∈I
In particular, we deduce that ∃α, β, γ, δ ∈ R + , δ < 1/2 < γ < 1 and δ + γ < 1 such that: P (n) max P (i) + P (n − i − 1) + αP (i)γ P (n − i − 1)δ + β . i∈I
The following claim shows that P (n) = O(n), and so the label length is log n + O(1). Claim. Let P (n) be a sequence. If there are α, β, γ, δ ∈ R + , δ < γ < 1, δ + γ 0, then P (n) = O(n). Proof. Let a and b be two positive constants we will determine later. Let us prove by induction the property (Qn ): (Qn ) :
P (n) an − bnγ+δ .
Q1 is true if and only if a and b satisfy P (1) a − b. Assume that Qi is true for i < n. P (n) max an − biγ+δ − b(n − i − 1)γ+δ + α(an)γ (a(n − i − 1))δ − (a − β) i∈I
an − (a − β) + max {h(n, i) + f (n, i)} i∈I
γ+δ
with h(n, i) = −bi − b(n − i − 1)γ+δ and f (n, i) = aγ+δ nγ (n − i − 1)δ . In order to bound maxi∈I h(n, i), we compute: 1−γ−δ ∂ i − (n − i − 1)1−γ−δ γ+δ γ+δ h(n, i) = bi (n − i − 1) ∂i i(n − i − 1) For i ∈ I,
∂ ∂i h(n, i)
0 because i n − i − 1 and γ > δ. So, we obtain:
max h(n, i) − bnγ+δ − 2γ+δ b i∈I
n γ+δ 2
154
N. Bonichon, C. Gavoille, and A. Labourel
In order to bound maxi∈I f (n, i), we compute: ∂ f (n, i) = aγ+δ iγ (n − i − 1)δ ∂i For i ∈ I,
∂ ∂i f (n, i)
γ(n − i − 1) − δi i(n − i − 1)
.
0 because i n − i − 1 and γ > δ. So: max f (n, i) aγ+δ i∈I
n γ+δ 2
and thus, P (n) an − 2γ+δ b − aγ+δ nγ+δ − (a − β).
The two constants must fulfill the following equalities: ⎧ ⎨ P (1) a − b 2γ+δ b − aγ+δ α b ⎩ a−β 0 For instance, it suffices to choose b such that:
a − P (1) b aγ+δ α with a β which is possible for a large enough since γ + δ < 1. This completes the proof of Lemma 4.
4
Conclusion
The unsolved implicit graph representation conjecture of [KNR88, KNR92] asks whether every hereditary4 family of graphs with 2O(n log n) labeled graphs of n vertices enjoys a O(log n)-bit adjacency labeling scheme. This is motivated by the fact that every family with at least 2cn log n labeled graphs of n vertices requires adjacency labels of at least c log n bits. Our schemes suggest that, at least for trees, labels of log n + O(1) bits may be possible. Therefore, we propose to prove or to disprove the following: Every hereditary family of graphs with at most n!2O(n) = 2n log n+O(n) labeled graphs of n vertices enjoys an adjacency labeling scheme with labels of log n+O(1) bits. We observe that several well-known families of graphs are concerned by this proposition: trees, planar graphs, bounded treewidth graphs, graphs of bounded genus, graphs excluding a fixed minor (cf. [NRTW05] for counting such graphs). Proving the latter conjecture appears to be hard, e.g., the best upper bound for planar graphs is only 3 log n + O(log∗ n). 4
That is a family of graphs closed under induced subgraph taking.
Short Labels by Traversal and Jumping
155
References [AAK+ 05]
[ABR05]
[AGKR04]
[AKM01]
[AR02]
[BF67]
[BG05]
[Bre66] [DL02]
[DL04]
[FG01]
[GP03a]
[GP03b]
[KM01]
Serge Abiteboul, Stephen Alstrup, Haim Kaplan, Tova Milo, and Theis Rauhe. Compact labeling schemes for ancestor queries. SIAM Journal on Computing, 2005. Stephen Alstrup, Philip Bille, and Theis Rauhe. Labeling schemes for small distances in trees. SIAM Journal on Discrete Mathematics, 19(2):448–462, 2005. Stephen Alstrup, Cyril Gavoille, Haim Kaplan, and Theis Rauhe. Nearest common ancestors: A survey and a new algorithm for a distributed environment. Theory of Computing Systems, 37:441–456, 2004. Serge Abiteboul, Haim Kaplan, and Tova Milo. Compact labeling schemes for ancestor queries. In 12th Symposium on Discrete Algorithms (SODA), pages 547–556. ACM-SIAM, January 2001. Stephen Alstrup and Theis Rauhe. Small induced-universal graphs and compact implicit graph representations. In 43rd Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 53–62. IEEE Computer Society Press, November 2002. Melvin A. Breuer and Jon Folkman. An unexpected result on coding the vertices of a graph. Journal of Mathematical Analysis and Applications, 20:583–600, 1967. Fabrice Bazzaro and Cyril Gavoille. Localized and compact data-structure for comparability graphs. In 16th Annual International Symposium on Algorithms and Computation (ISAAC), volume 3827 of Lecture Notes in Computer Science, pages 1122–1131. Springer, December 2005. Melvin A. Breuer. Coding the vertexes of a graph. IEEE Transactions on Information Theory, IT-12:148–153, 1966. Feodor F. Dragan and Irina Lomonosov. New routing schemes for interval graphs, circular-arc graphs, and permutation graphs. In 14th IASTED International Conference on Parallel and Distributed Computing and Systems (PDCS), pages 78–83, November 2002. Feodor F. Dragan and Irina Lomonosov. On compact and efficient routing in certain graph classes. In 15th Annual International Symposium on Algorithms and Computation (ISAAC), volume 3341 of Lecture Notes in Computer Science, pages 402–414. Springer, December 2004. Pierre Fraigniaud and Cyril Gavoille. Routing in trees. In Fernando Orejas, Paul G. Spirakis, and Jan van Leeuwen, editors, 28th International Colloquium on Automata, Languages and Programming (ICALP), volume 2076 of Lecture Notes in Computer Science, pages 757–772. Springer, July 2001. Cyril Gavoille and Christophe Paul. Optimal distance labeling schemes for interval and circular-arc graphs. In G. Di Battista and U. Zwick, editors, 11th Annual European Symposium on Algorithms (ESA), volume 2832 of Lecture Notes in Computer Science, pages 254–265. Springer, September 2003. Cyril Gavoille and David Peleg. Compact and localized distributed data structures. Journal of Distributed Computing, 16:111–120, May 2003. PODC 20-Year Special Issue. Haim Kaplan and Tova Milo. Short and simple labels for small distances and other functions. In 7th International Workshop on Algorithms and Data Structures (WADS), volume 2125 of Lecture Notes in Computer Science, pages 32–40. Springer, August 2001.
156
N. Bonichon, C. Gavoille, and A. Labourel
[KNR88]
Sampath Kannan, Moni Naor, and Steven Rudich. Implicit representation of graphs. In 20th Annual ACM Symposium on Theory of Computing (STOC), pages 334–343. ACM Press, May 1988. [KNR92] Sampath Kannan, Moni Naor, and Steven Rudich. Implicit representation of graphs. SIAM Journal on Discrete Mathematics, 5:596–603, 1992. [NRTW05] Serguei Norine, Neil Robertson, Robin Thomas, and Paul Wollan. Proper minor-closed families are small. Journal of Combinatorial Theory, Series B, 2005. To appear. [TZ01] Mikkel Thorup and Uri Zwick. Compact routing schemes. In 13th Annual ACM Symposium on Parallel Algorithms and Architectures (SPAA), pages 1–10. ACM Press, July 2001.
An Optimal Rebuilding Strategy for a Decremental Tree Problem Nicolas Thibault and Christian Laforest Tour Evry 2, LaMI/IBISC, Universit´e d’Evry, 523 place des terrasses, 91000 EVRY France {nthibaul, laforest}@lami.univ-evry.fr
Abstract. This paper is devoted to the following decremental problem. Initially, a graph and a distinguished subset of vertices, called initial group, are given. This group is connected by an initial tree. The decremental part of the input is given by an on-line sequence of withdrawals of vertices of the initial group, removed on-line one after one. The goal is to keep connected each successive group by a tree, satisfying a quality constraint: The maximum distance (called diameter) in each constructed tree must be kept in a given range compared to the best possible one. Under this quality constraint, our objective is to minimize the number of critical stages of the sequence of constructed trees. We call “critical” a stage where the current tree is rebuilt. We propose a strategy leading to at most O(log i) critical stages (i is the number of removed members). We also prove that there exist situations where Ω(log i) critical stages are necessary to any algorithm to maintain the quality constraint. Our strategy is then worst case optimal in order of magnitude.
A lot of works have been devoted to the construction of trees spanning a given set of vertices in a graph. For example the Steiner tree problem, where the goal is to span a set (called group) of distinguished vertices (called members) with a minimum weight tree, has been extensively studied. As the problem is NPcomplete, numerous approximation algorithms have been designed (see [1, 3] for example). In [8], Waxman was the first author to present the on-line version of this problem in which vertices to add in, or to remove from, the current group revealed one by one (see [2] references on on-line problems). In this first paper, he divides the problem into two categories: A model in which “heavy” changes of the current tree are not allowed and a model in which changes are allowed. Then, Imase and Waxman proposed in [4] two different strategies corresponding to the two models above. In the first one the tree is just incremented or decremented and the degradation of weight is evaluated, whereas in the second one they allow changes in the current tree to maintain a guaranty on the weight. At each stage, they prove that they construct with the first strategy a tree whose weight is at a logarithmic ratio compared to the optimal one (i.e. the weight of a Steiner tree of the current group), and that they construct with the second strategy a tree whose weight is at a constant ratio compared √ to the optimal one. They give for the second strategy an upper bound of O( i) on the number of elementary P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 157–170, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
158
N. Thibault and C. Laforest
changes per stage (where i is the number of new members). However, the tree can potentially be changed at each stage; this means that each stage is potentially what we call later a critical stage. In [6], a very similar on-line Steiner tree problem with a delay constraint from one node to the others is studied. But the authors only evaluate their method with simulations, and they give no upper bound for the different competitive ratios. Note that in [4, 6], only the number of elementary changes is taken into account to measure the level of damage due to the allowed changes in the current tree. In this paper we are concerned with a decremental group problem where the members to remove are revealed on-line one by one. However, we do not focus on the same objective function (the weight of the tree) but on a different measure: The diameter of the current group induced by the current tree. Note that we consider here a model in which changes are allowed because it can easily be shown that any on-line algorithm without critical stage cannot guarantee a constant competitive ratio (for the diameter objective function we consider in this paper). That is why we fix here a “relative budget”, called quality constraint, on the diameter and we propose an algorithm minimizing the number of critical stages necessary to guarantee this budget constraint at each stage. Note also that we have proved that our algorithm leads to a constant number of elementary changes per stage in average (but we do not give in this paper the definitions and the proof associated to this problem because of the limitation on the number of pages). A motivation for such model and objective function is the construction of connection structures for groups of members in networks. An important QoS parameter is latency that is expressed here in terms of maximum distance between users. This maximum distance must be guaranteed (our quality constraint ). However, this must be done by minimizing the number of critical stages since they induce perturbations in communications in the current group (implying many re-routing operations between members in the current tree). In Section 1 we describe more formally our problem. More precisely, in Subsection 1.1 we describe and motivate the constraints (namely the tree and quality constraints) that must be satisfied at each stage. In Subsection 1.2 we give the definitions of a critical stage. In Subsection 2.1 we propose an algorithm satisfying the construction constraints (in Section 2.2). In Subsection 2.3 we prove that our algorithm leads to at most O(log i) critical stages (where i is the number of removed members). We prove in Section 3 that our strategy is worst case optimal in order of magnitude for the number of critical stages criterion by constructing a scenario in which at least Ω(log i) critical stages are necessary for any algorithm to satisfy the quality constraint. These results show that our algorithm is worst case optimal for the number of critical stages.
1
Definitions and Notations
Let G = (V, E, w) be any connected weighted graph representing a network. V is the set of vertices (modeling the nodes of the network), E the set of edges
An Optimal Rebuilding Strategy for a Decremental Tree Problem
159
(modeling the set of physical links) and w a positive weight function of the edges (modeling the length of the edges). We denote by dG (u, v) the distance between u and v in G, i.e. the sum of the weights of the edges of a minimum weight path between u and v in G. Definition 1 (Diameter of a group M ). Let G = (V, E, w) be a graph and let M ⊆ V be a group. We denote the diameter of M in G by DG (M ) = max{dG (u, v) : u, v ∈ M }. 1.1
Construction Constraints
In our problem, the graph G = (V, E, w) and an initial group M0 ⊆ V are given (with M0 = ∅). For example, in a meeting on network (called net-meeting) this initial group M0 represents the set of members present at the beginning of the meeting. A structure, noted T0 = (V0 , E0 ), must be created to connect the members of M0 (T0 spans M0 in G : M0 ⊆ V0 ⊆ V , E0 ⊆ E). However, members may leave the meeting. These members must be removed from the current group (we underline that they are not removed from the underlying graph G). Let m0 = |M0 | be the size of the initial group. Let u1 , u2 , . . . , ui , . . . (i ≤ m0 − 1) be the sequence of members to remove. For every i, 1 ≤ i ≤ m0 − 1, we denote by Mi = Mi−1 \{ui } the ith group, and by mi = |Mi | its size. Thus, starting from the initial connection structure T0 for M0 , at each stage of withdrawal i, the member ui is removed by updating the current structure Ti−1 (spanning Mi−1 ) to obtain Ti spanning Mi . Note that as the members to remove are revealed one by one, we are in an on-line model. It means that we do not know the future: Neither in which order the members are removed, nor what is the set of members to remove. Hence, each stage can potentially be the last one; this explains why we are interested by giving guarantees at each stage. We need the following definition that presents the best possible connection tree for the group Mk , minimizing the diameter parameter. Definition 2 (Optimal tree). Let G = (V, E, w) be a graph. For every i, 0 ≤ i ≤ m0 − 1, we denote by Ti∗ a tree satisfying DTi∗ (Mi ) = min{DT (Mi ) : T tree spanning Mi }. We are now ready to give the two constraints that each current structure Ti must satisfy. – The tree constraint: For every i, 0 ≤ i ≤ m0 − 1, Ti must be a tree, spanning Mi , in which all leaves are in Mi (we call that a pruned tree). – The quality constraint: Let c ≥ 1 be any fixed constant representing the required level of quality. For every i, 0 ≤ i ≤ m0 − 1, we must have DTi (Mi ) ≤ c · DTi∗ (Mi ).
160
N. Thibault and C. Laforest
As in a net-meeting the current structure Ti is used to support the communications between members of Mi , the tree constraint is set in order to simplify the mechanisms of routing and duplication of information in Ti . Indeed, there is only one route between any pair of members in a tree; moreover as there is no cycle, a simple flooding process can be used to broadcast information from any member. This flooding naturally ends at the leaves that are members (because trees are pruned); there is no need of costly process to control it. The quality constraint of level c is set to guarantee that the induced diameter of the current group in Ti is not too large compared to the best possible diameter in Ti∗ (at most c times the best possible diameter). In the rest of the paper we say that an algorithm solves our problem if, for any on-line sequence of successive groups M0 ⊃ · · · ⊃ Mi , it returns a sequence of trees T0 , . . . , Ti (Ti spanning Mi ) satisfying the tree and quality constraints. 1.2
The Criterion to Minimize
In this subsection we present the cost associated with any algorithm satisfying the tree and quality constraints. We first need the following definitions. Definition 3 (Critical stage). Let A be an algorithm solving our problem. At stage i, 1 ≤ i ≤ m0 − 1, Algorithm A builds Ti = (Vi , Ei ) from Ti−1 = (Vi−1 , Ei−1 ). Stage i is a critical stage if Ei Ei−1 . We distinguish critical stages from other stages since they generate a lot of perturbations. Indeed, if i is a critical stage, the communication routes in Ti−1 between members already in the current group Mi−1 have to be changed in Ti . Potentially all the routing tables of the connecting nodes must be modified. This generates a heavy traffic to update them. Moreover the current communications between members of Mi−1 initiated before the changes may be interrupted. That is why the number of critical stages must be minimized. On the other hand, the withdrawal of a member by just removing useless branches in the tree generates only local changes and is not considered as a critical stage (since in this case Ei ⊆ Ei−1 ). The update of the routing can just be done by broadcasting the information of the departure of the leaving member in the new tree Ti . This does not create any re-routing between the other members. The aim of this paper is to minimize the total number ♯CS(T0 , . . . , Ti ) of critical stages while respecting the tree and the quality constraints.
2 2.1
Our Algorithm CS Definition of Algorithm CS (Critical Stages)
To define Algorithm CS, we need the following algorithm, called MD for Minimum Distance. We denote by MD(M ) Algorithm applied to group M of MD size m to find a particular group M (r∗ ) of size m 2 + 1 and what we call its associated root.
An Optimal Rebuilding Strategy for a Decremental Tree Problem
161
Algorithm MD(M ) 1. For each r ∈ M , sort the m vertices of M by non decreasing value of their distance to r: r r r r, ur1 , . . . , urm−1 G (r, u2 ) ≤ · · · ≤ dG (r, um−1 )). (dG (r, u1 ) ≤ d
r, ur1 , . . . , ur m . ⌊2⌋ and its associated group M (r∗ ) such that ∗ dG r∗ , ur⌊ m ⌋ = min dG r, ur⌊ m ⌋ : r ∈ M
Let M (r) =
2. Return r∗
2
2
Note that for all r ∈ M , the vertices ur1 , . . . , urm−1 can be sorted by non decreasing value of dG (r, urk ) and the associated group M (r) can be constructed in polynomial time by using Dijkstra’s algorithm. Thus, Algorithm MD(M ) finds M (r∗ ) and its associated root r∗ in polynomial time. The main idea of Algorithm CS is to define particular stages numbers, called rebuilding stages during which we (totally) reconstruct the current tree (to match the quality constraint). Between two successive rebuilding stages, a member is leaving by just removing the dead branches of the current tree (in order to maintain at each stage a pruned tree to satisfy the tree constraint). The following sequence (ak ) defines the rebuilding stages of our algorithm: ma0 = m0 is the size of the initial group M0 and for every ak (k ≥ 1), mak−1 is the size of the group Mak . mak = 2 Algorithm CS – Initially, at stage a0 = 0: CS builds a shortest path tree spanning the first group M0 , rooted in r0 ∈ M0 , where r0 ∈ M0 is the root found by MD(M0 ). – After the last rebuilding stage ak : Let Mak +j be the current group and let uak +j be the j th member revealed to be removed since the last rebuilding stage ak . m m • If mak +j > 2ak (corresponding to j < mak − 2ak ): Update the tree Tak +j−1 = (Vak +j−1 , Eak +j−1 ) by pruning potential useless branches. We obtain the pruned tree Tak +j = (Vak +j , Eak +j ) spanning Mak +j satisfying Eak +j ⊆ Eak +j−1. m • Otherwise, we have mak +j = 2ak mak (corresponding to j = mak − 2 ): m This is a rebuilding stage and we have mak +j = 2ak = mak+1. Break the current tree and construct Tak+1 , a shortest path tree spanning Mak+1 , rooted in rak+1 (where rak+1 ∈ Mak+1 is the root found by MD(Mak+1 )). Thus, ak+1 is the new last rebuilding stage. The rebuilding stages of CS can be critical stages (because the current tree is broken and rebuilt). The other stages are non critical because the algorithm only removes from the current tree useless branches to obtain the new tree.
162
N. Thibault and C. Laforest
Note that this algorithm is polynomial because it uses Algorithm MD (MD is polynomial) and because updating a tree by removing useless branches can be done in polynomial time. Note also that by construction, at each stage, the tree constraint is satisfied. Section 2.2 shows that it also respects the quality constraint for a level of quality c = 4. 2.2
CS Respects the Quality Constraint
Theorem 1 shows that CS respects the quality constraint with a level of quality c = 4. Theorem 1. Let G = (V, E, w) be a graph. For any sequence of withdrawals, at every stage i, 0 ≤ i ≤ m0 − 1 (i is the number of removed members), let Ti∗ be an optimal (off-line) tree spanning Mi for the diameter. CS respects the quality constraint with a level of quality c = 4, i.e. for every i, 0 ≤ i ≤ m0 − 1, we have Proof.
DTi (Mi ) ≤ 4DTi∗ (Mi ).
– If i is a stage of rebuilding. In this case, i = ak . Let u0 , v0 ∈ Mak be such that dTak (u0 , v0 ) = DTak (Mak ) (where Tak is the tree spanning Mak rooted in r∗ built by CS at stage ak ). We have DTak (Mak ) = dTak (u0 , v0 ) ≤ dTak (u0 , r∗ ) + dTak (r∗ , v0 ) (by triangular inequality) = dG (u0 , r∗ ) + dG (r∗ , v0 ) ≤ 2DG (Mak ) (because Tak is a shortest path tree rooted in r∗ and because u0 , v0 , r∗ ∈ Mak ) ≤ 2DTa∗ (Mak ) ≤ 4DTa∗ (Mak ) k
k
(because for every tree T spanning a group M , DG (M ) ≤ DT (M )) m – Otherwise ak is not a stage of rebuilding. Let j, 1 ≤ j < mak − 2ak be the number of removed vertices after the last rebuilding, happening at stage ak ∗ ∗ m (i.e. j is such that mak +j ≥ 2ak + 1). Let M (r∗ ) = {r∗ , u1r , . . . , ur mak } ⌊ 2 ⌋ be the set returned by MD(Mak ). As Mak +j ⊂ Mak (by definition ma of the k sequence of withdrawals) and M (r∗ ) ⊆ Mak with mak +j ≥ + 1 and 2 ma ∗ ∗ k ∩ M (r ) = ∅. Thus, there exists |M (r )| = + 1, we have M a +j k 2 m ∗ v ∈ Mak +j ∩ M (r∗ ). As v ∈ M (r∗ ), v = r∗ or v = url , with l ≤ 2ak . As ∗ ∗ r∗ , ur1 , . . . , ur mak are sorted by non decreasing value of their distance to ⌊ 2 ⌋ r∗ (see definition of Algorithm MD), we have
∗ r∗ ∗ (1) dG (r , v) ≤ dG r , u mak ⌊ 2 ⌋
An Optimal Rebuilding Strategy for a Decremental Tree Problem
163
Moreover, as Algorithm MD(M ) finds r∗ and M (r∗ ) such that k a ∗ dG r∗ , ur mak = min dG r, ur mak : r ∈ Mak , for every ⌊ 2 ⌋ ⌊ 2 ⌋ r0 ∈ Mak +j ⊂ Mak we have
0 ∗ dG r∗ , ur mak ≤ dG r0 , ur mak ⌊ 2 ⌋ ⌊ 2 ⌋ As mak +j ≥
ma k
2
0
0
+ 1 and as r0 , ur1 , . . . , urma
−1 are sorted by 0 url ∈ Mak +j with k
ing value of their distance to r0 , there exists mak +j − 1 such that
(2) non decreas mak ≤l≤ 2
0 0 dG r0 , ur mak ≤ dG r0 , url ⌊ 2 ⌋
(3)
0
By (1), (2), (3) and as r0 and url are in Mak +j , by definition of the diameter, we obtain ∃v ∈ Mak +j ∩ M (r∗ ) : dG (r∗ , v) ≤ DG (Mak +j )
(4)
Let u0 ∈ Mak +j and v 0 ∈ Mak +j be such that dTak +j (u0 , v 0 ) = DTak +j (Mak +j ) (where Tak +j is the tree spanning Mak +j built by CS at stage ak + j). We have DTak +j (Mak +j ) = dTak +j (u0 , v 0 ) = dTak (u0 , v 0 ) (since, by definition of Algorithm CS, we have Tak +j ⊆ Tak ) ≤ dTak (u0 , r∗ ) + dTak (r∗ , v 0 ) (by triangular inequality) = dG (u0 , r∗ ) + dG (r∗ , v 0 ) (because Tak is a shortest path tree rooted in r∗ ) ≤ dG (u0 , v) + dG (v, r∗ ) + dG (r∗ , v) + dG (v, v 0 ) (by triangular inequality, using vertex v of (4)) ≤ 4DG (Mak +j ) (because v ∈ Mak +j , u0 ∈ Mak +j , v 0 ∈ Mak +j and by (4)) ≤ 4DTa∗ +j (Mak +j ) k
(because for every tree T spanning a group M , DG (M ) ≤ DT (M )) ⊔ In conclusion, for every i, 0 ≤ i ≤ m0 − 1, we obtain DTi (Mi ) ≤ 4DTi∗ (Mi ). ⊓
164
2.3
N. Thibault and C. Laforest
CS Leads to O(log i) Critical Stages
Theorem 2. Let G = (V, E, w) be a graph. For any sequence of withdrawals, let T0 , . . . , Ti (0 ≤ i ≤ m0 − 1) be the sequence of trees constructed by CS. We have ♯CS(T0 , . . . , Ti ) ≤ ⌊log2 (2i)⌋ = O(log i) Proof. Two cases may occur: – If i < m0 − m20 , by definition of CS, there is no rebuilding stage. Thus, CS(T0 , . . . , Ti ) = 0. – Otherwise, i ≥ m0 − m20 ≥ m20 and we obtain m0 ≤ 2i
(5)
Moreover, by definition of the sequence (ak ) and CS, if there are p rebuildings (that are critical stages), then p is such that map+1 < m0 − i ≤ map ⇒ m0 − i ≤ ⇒ m0 − i ≤ ⇒1≤
m0 2p
(by definiton of sequence (ak ), 0 ) ∀k, mak ≤ m 2k
2i 2p
(by (5))
2i 2p
(by definition, i ≤ m0 − 1)
⇒ p ≤ ⌊log2 (2i)⌋ (because p is an integer) ⇒ p ≤ O(log i)
3
⊓ ⊔
Lower Bound for the Number of Critical Stages of Any Algorithm
In this section, we prove that for any algorithm respecting the tree constraint and the quality constraint, for any sufficiently large i, there exists a particular sequence of withdrawals leading to at least Ω(log i) critical stages. To prove that, we describe the graph G in Section 3.1. Then, we define the particular on-line sequence of withdrawals in Section 3.2 and prove the main result in Section 3.3. 3.1
Description of the Graph G
Let k, d, 0 ≤ k ≤ d and 3 ≤ p be any integer. We define graphs Gpk = (Vkp , Ekp , wkp ) recursively on k as follows: – Gp0 = (V0p , E0p , w0p ) is the cycle of length p such that ∀e ∈ E0p , w0p (e) = 2d . p – ∀k, 1 ≤ k ≤ d, we define Gpk = (Vkp , Ekp , wkp ) as follows. ∀v ∈ Vk−1 , let Cv = p (VvC , EvC , wvC ) be a cycle of length p such that v ∈ VvC , VvC \{v} ∩ Vk−1 =∅ and wvC (e) =
2d−k . pk
An Optimal Rebuilding Strategy for a Decremental Tree Problem
165
cycle of level 2 G0 (v)
v
edge of weight 2d = 4 edge of weight
2d−1 p
=
1 2
edge of weight
2d−2 p2
=
1 16
Fig. 1. The graph G42
Gpk = (Vkp , Ekp , wkp ) is the graph such that: p • Vkp = Vk−1 ∪ v∈V p VvC k−1 p • Ekp = Ek−1 ∪ v∈V p EvC k−1
p p • ∀e ∈ Ek−1 , wkp (e) = wk−1 (e) and ∀e ∈
p v∈Vk−1
EvC , wkp (e) = wvC (e).
See Figure 1 for an illustration of Gpk (with k = 2 and p = 4). We can now define the graph G = (V, E, w). Let c ≥ 1 be the constant corresponding to the required level of quality and let d be a positive integer sufficiently large such that ⌈6c+2⌉ ⌈6c+2⌉ i ≤ Vd = M0 − 1 (where i is the number of removed vertices and Vd ⌈6c+2⌉
is the initial group). We set G = Gd
.
Definition of a Cycle of Level k We say that a cycle C = (V C , E C , w) (subgraph of G) is of level k (0 ≤ k ≤ d) d−k if each edge e ∈ E C has weight w(e) = 2 pk . See Figure 1 for an illustration of ⌈6c+2⌉
such cycle (Note that G42 is too small to be a possible graph of the form Gd but this is just an illustration).
,
Definition of the Subgraphs Gk (v) Let v be any vertex of the graph G (v ∈ V ). Let k be the smallest index such that Ck = (VkC , EkC , w) is the cycle of level k containing v (v ∈ VkC ). We define Gk (v) = (Vk (v), Ek (v), w) the subgraph induced by every vertices and edges which can be reached from vertex v by going through edges of weight strictly d−k less than 2 pk (i.e. by going through edges of cycles of level strictly more than k). See Figure 1 for an illustration of such subgraph. 3.2
Definition of the Sequence of Withdrawals M0 ⊃ · · · ⊃ Mi
Let A be any online algorithm respecting the tree and quality of level c constraints. We use an adaptive adversary to define the sequence of withdrawals in the graph G = (V, E, w) defined above.
166
N. Thibault and C. Laforest
We first define a generic sequence of withdrawals of vertices. Note that we do not specify each elementary stage of withdrawal, but only the “main” stages interesting for our analysis (stages of the form i = α(k, b)). For every k ≥ 0, for every b ∈ {0, 1}, for every i = α(k, b) (0 ≤ α(k, b) ≤ m0 − 1), let Ti be the tree spanning Mi constructed by Algorithm A at stage i. Note that at each stage, we have α(k, b) = |M0 | − |Mα(k,b) | (0 ≤ α(k, b) ≤ m0 − 1). The sequence of withdrawals is defined as follows. We set p = ⌈6c + 2⌉. Basic Cases – At stage α(0, 0) = 0, we have Mα(0,0) = V As Tα(0,0) is a tree spanning Mα(0,0) , it is necessarily made up of, amongst other things, all the edges of the cycle C0 = (V0C , E0C , w), except one edge e0 . Let v01 and v02 be the two vertices connected by e0 . The adaptive adversary now removes (one by one) from Mα(0,0) all the vertices in v∈V C \{v 1 ,v 2 } V1 (v) in order to obtain Mα(0,1) . 0
0
0
– At stage α(0, 1), we have Mα(0,1) = V1 (v01 ) ∪ V1 (v02 ) The adaptive adversary now removes (one by one) from Mα(0,1) all the vertices in V1 (v01 ) in order to obtain Mα(1,0) (note that the adversary chooses arbitrarily to remove all the vertices in V1 (v01 ) rather than in V1 (v02 )). Main Cases – At stage α(k, 0). Let Ck = (VkC , EkC , w) be the cycle of level k such that VkC ⊂ Mα(k−1,1) . We have Mα(k,0) = Vk+1 (v) v∈VkC
As Tα(k,0) is a tree spanning Mα(k,0) , it is necessarily made up of, amongst other things, all the edges of the cycle Ck , except one edge ek . Let vk1 and vk2 be the two vertices connected by ek . The adaptive adversary now removes (one by one) from Mα(k,0) all the vertices in v∈V C \{v1 ,v2 } Vk+1 (v) k k k in order to obtain Mα(k,1) . – At stage α(k, 1), we have Mα(k,1) = Vk+1 (vk1 ) ∪ Vk+1 (vk2 ) The adaptive adversary now removes (one by one) from Mα(k,1) all the vertices in Vk+1 (vk1 ) in order to obtain Mα(k+1,0) (note that the adversary chooses arbitrarily to remove all the vertices in Vk+1 (vk1 ) rather than in Vk+1 (vk2 )).
An Optimal Rebuilding Strategy for a Decremental Tree Problem
167
We specify with α(k, b) only the “main” stages of the sequence of withdrawals, corresponding to the stages where the adaptive adversary has to make a choice. Indeed, between two successive “main” stages α(k, 0) and α(k, 1) (resp. α(k, 1) and α(k + 1, 0)), the vertices are removed one by one in any order. Note that we stop removing vertices after the last “main” stage, when exactly i vertices have been removed. See Figure 2 for an illustration of the six first “main” stages α(0, 0), α(0, 1), α(1, 0), α(1, 1), α(2, 0) and α(2, 1), where the successive trees are built by an arbitrary algorithm (Note that G42 is too small to be a possible ⌈6c+2⌉ graph of the form Gd , but this figure is just an illustration of a sequence of withdrawals). α(1, 0)
α(0, 1)
α(0, 0)
v01
v01
v02
v02
α(2, 0)
α(1, 1)
v11 v12
v11 v12
α(2, 1)
v21 v22
v21 v22
Fig. 2. Illustration of the sequence of withdrawals on graph G42
3.3
Any Algorithm Leads to Ω(log i) Critical Stages
Lemmas 1 and 2 are preliminary technical results (Lemma 1 is trivial. A proof can be found in [5]). Lemma 1. Let G = (V, E, w) be any graph. For every M ⊆ V , there exists a tree T off spanning M such that DT off (M ) ≤ 2DG (M ) The following Lemma is central in our analysis. It describes sub-sequences of withdrawals where at least one rebuilding/critical stage occurs. Lemma 2. Let c ≥ 1 be any constant (representing the required level of quality). ∗ ∗ ∗ , Tα(k,0)+1 , . . . , Tα(k,1) be the trees respectively spanFor every k ≥ 0, let Tα(k,0) ning Mα(k,0) , Mα(k,0)+1 , . . . , Mα(k,1) optimal for the diameter and let Tα(k,0) ,
168
N. Thibault and C. Laforest
Tα(k,0)+1 , . . . , Tα(k,1) be any trees respectively spanning Mα(k,0) , Mα(k,0)+1 , . . . , Mα(k,1) . If for every i, α(k, 0) ≤ i ≤ α(k, 1), we have DTi (Mi ) ≤ c · DTi∗ (Mi ), then ♯CS(Tα(k,0) , Tα(k,0)+1 , . . . , Tα(k,1) ) ≥ 1. Proof. We prove Lemma 2 by contradiction. Suppose that there exists k ≥ 0 such that for every i, α(k, 0) ≤ i ≤ α(k, 1), the quality constraint is satisfied and there is no critical stage, i.e. there exists k ≥ 0 such that for every i, α(k, 0) ≤ i ≤ α(k, 1), we have DTi (Mi ) ≤ c · DTi∗ (Mi ) and Tα(k,0) ⊇ Tα(k,0)+1 ⊇ · · · ⊇ Tα(k,1) . These trees are made up of, amongst other things, all edges of the cycle Ck ⊂ G, except one edge, noted ek . We insist on the fact that, because there is no critical stage, this edge ek is always the same in all trees Tα(k,0) , Tα(k,0)+1 , . . . , Tα(k,1) . 1 2 Let us focus now on (vk ) ∪Vk+1 (vk ). We stage α(k, 1), where Mα(k,1) = Vk+1 ∗ lower bound DTα(k,1) Mα(k,1) and upper bound DTα(k,1) Mα(k,1) to show that at this particular stage, the quality constraint is not satisfied. This leads to the wanted contradiction and proves the Lemma. – Lower bound of DTα(k,1) Mα(k,1) As the two extremities vk1 and vk2 of the edge ek are separated by a path d−k made of p − 1 = ⌈6c + 1⌉ edges of weight 2 pk in Tα(k,1) we have 2d−k 2d−k DTα(k,1) Mα(k,1) ≥ (p − 1) k ≥ (6c + 1) k (6) p p ∗ – Upper bound of DTα(k,1) Mα(k,1) ∗ Mα(k,1) , we first upper bound DG Mα(k,1) . In order to upper bound DTα(k,1) By construction of the graph G, two cases may occur: 1. If k = d, there is no cycle of level k + 1 in G. Thus, we have 2d−k 2d−k ≤ 3 DG Mα(k,1) = w(ek ) = pk pk 2. If k ≤ d − 1, we have DG Mα(k,1) ≤ DG Vk+1 (vk1 ) + dG (vk1 , vk2 ) + DG Vk+1 (vk2 ) w(e) + w(ek ) + w(e) ≤ 1) e∈Ek+1 (vk
2) e∈Ek+1 (vk
(because for every graph or subgraph G = (V, E, w), DG (V ) ≤ w(e)) e∈E
d d 2d−l l−k 2d−l l−k 2d−k p + + p = pl pk pl l=k+1
l=k+1
d 2 d−l 2d−k 2d−k 2d−k 2d−k 2 + k ≤ 2 k + k = 3 k ≤ k p p p p p l=k+1
An Optimal Rebuilding Strategy for a Decremental Tree Problem
169
off Moreover, by Lemma 1, there exists a tree Tα(k,1) spanning Mα(k,1) such that ∗ DT off (Mα(k,1) ) ≤ 2DG (Mα(k,1) ). Thus, as Tα(k,1) is a tree spanning Mα(k,1) α(k,1) optimal for the diameter, we have ∗ (Mα(k,1) ) ≤ DT off DTα(k,1)
α(k,1)
(Mα(k,1) ) ≤ 2DG (Mα(k,1) ) ≤ 6
2d−k pk
(7)
By (6) and (7), we obtain d−k (6c + 1) 2 pk DTα(k,1) Mα(k,1) 1 ≥ > c ≥ c+ d−k 2 ∗ 6 DTα(k,1) Mα(k,1) 6 pk
This result contradicts the assumption that the quality constraint is satisfied. Thus, Lemma 2 is proved by contradiction. ⊓ ⊔ The following Theorem shows that if the tree constraint and the quality constraint are satisfied, any algorithm leads to Ω(log i) critical stages, where i is the number of removed vertices. Theorem 3. Let c ≥ 1 be any constant. For any algorithm A, for every sufficiently large i, there exists a graph G0 , there exists M0 ⊃ · · · ⊃ Mi , such that if Algorithm A returns a sequence of trees T0 , . . . , Ti respectively spanning M0 ⊃ · · · ⊃ Mi respecting the quality constraint of level c, then ♯CS(T0 , . . . , Ti ) = Ω(log i) Proof. Let c ≥ 1 be any constant. We set p = ⌈6c + 2⌉. Let i be the number of removed vertices. There exists d and G0 (where G0 is graph G, defined in Section 3.1), there exists M0 ⊃ · · · ⊃ Mi (the sequence defined in Section 3.2) such that α(d − 1, 1) ≤ i ≤ α(d, 1) ≤ |V | = pd Thus, we have i ≤ pd ⇒ logp i ≤ d ⇒ logp i ≤ d. And as p = ⌈6c + 2⌉ is a constant, we have d ≥ Ω(log i). Moreover, by Lemma 2, we have ⎧ ♯CS(Tα(0,0) , Tα(0,0)+1 , . . . , Tα(0,1) ) ≥ 1 ⎪ ⎪ ⎪ ⎨ ♯CS(Tα(1,0) , Tα(1,0)+1 , . . . , Tα(1,1) ) ≥ 1 .. ⎪ . ⎪ ⎪ ⎩ ♯CS(Tα(d−1,0) , Tα(d−1,0)+1 , . . . , Tα(d−1,1) ) ≥ 1 ⇒ ♯CS(Tα(0,0) , . . . , Tα(d−1,1)) ≥ d ⇒ ♯CS(T0 , . . . , Ti ) ≥ d
(because i ≥ α(d − 1, 1))
⇒ ♯CS(T0 , . . . , Ti ) ≥ Ω(log i)
(because d ≥ Ω(log i))
⊓ ⊔
Theorem 2 and Theorem 3 show that Algorithm CS is worst case optimal in order of magnitude for the number of critical stages criterion.
170
4
N. Thibault and C. Laforest
Conclusion
We have proposed an algorithm, called CS, solving an on-line covering problem of members by respecting the following quality constraint: For each stage of withdrawal, the diameter between members induced by the built tree is at most a constant time the best possible value. Moreover, our algorithm is easy to use. Indeed, for a stage of withdrawal, either it breaks the tree and rebuilds a new one which is a tree of shortest paths (only O(log i) times, where i is the number of removed members), or it just updates the current tree by removing useless branches (in all the other cases). Moreover, our algorithm is worst case optimal in order of magnitude for the number of critical stages: It leads to O(log i) critical stages and we showed that any algorithm leads to Ω(log i) critical stages in the worst case. We also have proved that the number of elementary changes per stage (see equivalent definition in [4]) is constant in average. Due to space limitation, we do not include these results. Note that we only consider the decremental problem because the incremental problem (adding new members in the current tree) considering the diameter as quality constraint is trivial. Indeed, plugging each new member with a shortest path to the initial member leads to 0 critical stage with a level of quality c = 2. We also have results with another objective function than the diameter. Indeed, concerning the average distance between members of the groups, we proved similar results in [7] for the incremental version of the problem. We are now currently working on mixing additions and withdrawals.
Acknowledgments The authors wish to thank the anonymous referees for their very useful comments.
References 1. G. Ausiello, P. Crescenzi, G. Gambosi, V. Kann, A. Marchetti Spaccamela, and M. Protasi, Complexity and approximation, Springer, 1999. 2. A. Borodin and R. El-Yaniv, Online computation and competitive analysis, Cambridge University press, 1998. 3. D. Hochbaum, Approximation algorithms for NP-hard problems, PWS publishing compagny, 1997. 4. M. Imase and B. Waxman, Dynamic steiner tree problem, SIAM J. Discr. Math., 4 (1991), pp. 369–384. 5. C. Laforest, A good balance between weight and distances for multipoint trees, in International Conference On Principles Of DIstributed Systems 2002, pp. 195–204. 6. S. Raghavan, G. Manimaran, and C. S. R. Murthy, A rearrangeable algorithm for the construction of delay-constrained dynamic multicast trees, IEEE/ACM (SIGCOMM), ACM Press, 7 (1999). 7. N. Thibault and C. Laforest, An optimal rebuilding strategy for an incremental tree problem, submitted in 2004 to journal of interconnection networks. 8. B. Waxman, Routing of multipoint connections, IEEE Journal on Selected Areas in Communications, 6 (1988), pp. 1617–1622.
Optimal Delay for Media-on-Demand with Pre-loading and Pre-buffering Amotz Bar-Noy1, Richard E. Ladner2,⋆ , and Tami Tamir3 1
Computer and Information Science Department, Brooklyn College, 2900 Bedford Avenue Brooklyn, NY 11210 [email protected] 2 Department of Computer Science and Engineering, Box 352350, University of Washington, Seattle, WA 98195 [email protected] 3 School of Computer Science, The Interdisciplinary Center, P.O.Box 167, Herzliya 46150, Israel [email protected]
Abstract. Broadcasting popular media to clients is the ultimate scalable solution for media-on-demand. The simple solution of downloading and viewing the media from one channel cannot guarantee a reasonable startup delay for viewing with no interruptions. Two known techniques to reduce the delay are pre-loading and pre-buffering. In the former an initial segment of the media is already in the client buffer, and in the latter segments of the media are not transmitted in sequence and clients may pre-buffer later segments of the media before viewing them. In both techniques, the client should be capable to receive streams from channels at the same time of handling its own buffer and view the media from either one of the channels or the buffer. In this paper we consider broadcasting schemes that combine preloading and pre-buffering. We present a complete tradeoff between (i) the size of the pre-loading; (ii) the maximal possible delay for an uninterrupted playback; (iii) the number of media; and (iv) the number of channels allocated per one media. For a given B the size of the preloading as a fraction of the media length, for m media, and for h channels per media, we first establish a lower bound for the minimal maximum delay, D, as a fraction of the movie length, for an uninterrupted playback of any media out of the m media. We then present an upper bound that approaches this lower bound when each media can be fragmented into many segments.
1
Introduction
Media-on-demand (MoD) is the demand by clients to read, listen, or view various types of media. In its simplest function, the clients would like to have an uninterrupted playback with as minimal as possible start-up delay. The subject of this paper is to reduce the maximal start-up delay for MoD systems that support ⋆
The research was partially funded by NSF Grant No. CCF-0223578.
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 171–181, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
172
A. Bar-Noy, R.E. Ladner, and T. Tamir
uninterrupted service. Our main objective is to achieve the smallest maximal start-up delay for given amount of two resources: the bandwidth of the system, and the client local memory. There are two main types of systems that support MoD: unicast systems and broadcast systems. The former guarantees an immediate service as long as there are not too many clients. The latter can support many clients but cannot guarantee immediate service. For popular media, broadcasting is the ultimate scalable solution. In various broadcasting schemes, different parts of the media are transmitted on channels viewable to the clients. This paper considers the potential benefit of broadcasting schemes from using some of the client memory for storing in advance (pre-loading) parts of the media. In the simplest implementation of MoD systems, clients who wish to view a movie1 , select the channel that would start broadcasting this movie the earliest after their request time. Movies are broadcast on one channel or several channels. Thus if h channels are allocated to a movie of length L time units, the maximal start-up delay is L/h units by starting a new transmission every L/h time units. In recent years, more efficient broadcasting schemes that are based on prebuffering were suggested. In these schemes, each movie is partitioned into segments, and the segments are transmitted on the channels in some order, not necessarily their order in the movie. The client is reading all the channels simultaneously, ’collecting’ segments to its local memory, and is watching the segments of the movie in order - some directly from the channels and some from its own memory. The above broadcasting schemes require customers to get the service through a set-top-box (STB) capable of storing locally the transmitted data. This requires that the STB is equipped with a local memory (disk). In fact, this technology is already available: digital VCRs offered by ReplayTV [19], TiVo [22], and UltimateTV [23], have capacities of at least 300 gigabytes, enabling the client to store hours of movies in perfect quality. The disk capacity can be used to store entire movies and also pre-buffered segments and pre-loaded segments of other movies. Usually the former type of movies will be non-popular movies where the latter type will be popular movies for which the broadcasting solution is more beneficial. In this paper, we consider broadcasting schemes that combine pre-loading and pre-buffering. That is, we assume that some prefix of the movie is stored at the client’s machine, and therefore he or she should only receive the remainder of the movie. We present a complete tradeoff between (i) the size of the pre-loading; (ii) the maximal possible delay for an uninterrupted playback; (iii) the number of movies; and (iv) the number of channels allocated per movie. For a given B the size of the pre-loading as a fraction of the movie length, for m movies, and for h channels per movie, we first establish a lower bound for the minimal maximum delay, D, as a fraction of the movie length, for an uninterrupted playback of any movie out of the m movies. We then present an upper bound that approaches this lower bound when each movie can be fragmented to many segments. 1
For convenience, we use the terminology of movies in Video-on-Demand (VoD).
Optimal Delay for Media-on-Demand with Pre-loading and Pre-buffering
1.1
173
Model and Preliminaries
The system broadcasts m movies on h channels. Unless specified otherwise, assume that all m movies have the same length, L, normalized to be one time unit (L = 1). Each movie is partitioned into s segments of equal length. Segment size may range from a single bit (which is theoretically interesting) to the whole movie (in case of a single segment). The segments are indexed 1 to s in the order they should be viewed. The segments of the movies may be broadcast in any order on any channel. Assume that it takes one time slot to transmit or view a segment and thus, the length of the time slot is 1/s. Assume further that all the channels are synchronized in the sense that the starting points for the time slots coincide in all of them. Clients may buffer or view segments from any channel since they may receive data from all of them. In other words, the receiving bandwidth of each client is h. This implies that a client buffers or views segment i the first time he or she can do so after the arrival time. Clients may buffer any number of segments before the viewing process begins. The maximal possible delay of a client is denoted by D and is given as a fraction of the movie length. That is, if for example D = 1/4, no client will wait more than 1/4 of a movie length till it can start an uninterrupted playback of the movie. Let d = Ds denote the maximal delay measured as number of segments (time-slots). In the broadcasting schemes we present, the maximum delay is given in units of time-slots, thus we assume that D is a multiple of 1/s. The basic principle in all the schemes that use pre-buffering is that early segments should be broadcast more frequently than later segments. Intuitively, a client needs to watch the z th segment only z − 1 time-slots after it starts watching the movie, therefore, the z th segment, can be transmitted less often than earlier segments. Formally, in [2], optimal schemes that are based on prebuffering are developed using the windows scheduling problem and the following is shown: Theorem 1. Let S be a schedule that broadcasts s ≥ 1 segments for a movie on h ≥ 1 channels. Then S guarantees a maximum start-up delay of d > 0 timeslots if and only if segment z is transmitted once in any window of d + z − 1 segments for each 1 ≤ z ≤ s. Assume now that out of the s segments composing the movie, the first b are preloaded and are stored at the client’s local machine (set top box), the other s − b segments are transmitted on channels. Clearly, the client can always watch the first b segments with no delay. Consider the remainder of the movie as a complete (shorter) movie. Assume there exists a broadcasting scheme that enables any client to view this movie with delay at most d′ (in number of segments units). The idea is to overlap the time the client watches the first b segments with the time it is waiting to the rest of the data. This would result in a delay max(0, d′ − b). The challenge is to schedule the remaining s − b segments on the broadcasting channels in a way that minimizes this term.
174
A. Bar-Noy, R.E. Ladner, and T. Tamir
Example: Consider a single movie transmitted on a single channel. Assume that the client has at his local machine all but the last 5 segments, which are not preloaded, and are transmitted on the channel in the following (repeated) order: [1, 3, 2, 4, 1, 5, 2, 3, 1, 4, 2, 5] In this order, the segments 1, 2 are transmitted every 4 slots and the segments 3, 4, 5 are transmitted every 6 slots. Recall that the movie is partitioned into s segments, thus, these 5 segments are segments s − 4, . . . , s of the movie. The first b = s − 5 segments are pre-loaded and available to the client at any time (thus, B = (s − 5)/s). By Theorem 1 the above transmission of the last 5 segments guarantees a delay of at most d′ = 4 slots for viewing with no interruptions the last 5 segments. Thus, if s ≥ 9, or equivalently, b ≥ 4 meaning that the client has at least the first 4 segments of the movie, then there is no delay at all. If s < 9, the delay with pre-loading is 4 − b slots which is D = (4 − b)/(b + 5) = (9 − s)/s of the whole movie. We get the following tradeoff between B and D: s 5 6 7 8 9 >9
B 0 1/6 2/7 3/8 4/9 (s − 5)/s
D 4/5 3/6 2/7 1/8 0 0
In particular, this means that in order to guarantee no delay the pre-loading size should be 4/9 of the movie length, and with no pre-loading the maximal delay is 4/5 of the movie length. Table 1 provides a glossary of the notation used in the paper. The lower bound and the matching broadcasting scheme we present assume that the client’s memory stores only prefixes of movies. One might doubt that this is optimal, and suggest it might be better to store late parts of the movie Table 1. Glossary of notations notation h m ρ = h/m s B b = Bs D d = Ds d′
meaning number of channels number of different movies the ratio between number of channels and number of movies. number of segments per each movie. the size of the pre-loading buffer as a fraction of the movie length. the size of the pre-loading buffer as a number of segments the maximal delay for an uninterrupted playback as a fraction of the movie length. the maximal delay as a number of segments the maximal delay for the non pre-loaded part, as a number of segments
Optimal Delay for Media-on-Demand with Pre-loading and Pre-buffering
175
and broadcast earlier ones. The following Theorem should remove such doubts it states that the best way to use an allocated amount B of memory to a movie is by storing (pre-loading) a prefix of size B of this movie. Theorem 2. For any broadcasting scheme that combines pre-loading and broadcasting, if memory of size B is allocated to a movie, then it is optimal to store from this movie a prefix of size B. Proof. The idea is similar to the optimality proof of the offline algorithm for caching - that evicts from the cache the page that will be requested last among the pages that are currently in the cache. Consider any broadcasting scheme S in which for some movie there exists a bit i that is not pre-loaded, while some bit j > i is. Since j is pre-loaded, it is never transmitted by the scheme. Consider the scheme S ′ in which bit i is pre-loaded and bit j is transmitted whenever bit i was transmitted in S. Clearly, the user will have bit i on time (from its memory) and bit j will be available at the time bit i was available in S. Since we assume that all clients read the movie in order, bit i is requested before bit j, therefore, by having bit j available in S ′ at the time i was available in S, the client’s delay can only decrease. 1.2
Related Work
MoD systems, and in particular the solution of broadcasting, have been studied extensively in recent years. The paper [3] surveys broadcasting protocols and describes the development of these protocols, starting with Staggered broadcasting protocols, in which the movies are simply transmitted repeatedly on the channels (e.g., [4]), through Pyramid-based broadcasting protocols, in which movies are partitioned into segments and different segments are broadcast on different channels [24], and finally Harmonic broadcasting protocols in which segment i is allocated bandwidth proportional to 1/i (e.g., [8]). The case when there is no pre-loading and pre-buffering may start only when clients start viewing the movie received much attention in the recent decade. The papers [7, 9] present a simple schedule of one movie on h channels by partitioning the movie into 2h − 1 segments. Their schedule implies a maximal start-up delay of 1/(2h − 1) for a movie of length 1. This scheme is improved in the Pagoda scheme ([15]), the new Pagoda scheme ([11]), the Recursive Frequency-Splitting scheme ([21]), the Harmonic broadcasting scheme ([1]), and the Polyharmonic broadcasting scheme ([14]. In these schemes, the worst-case maximal delay asymptotically approaches 1/(eb − 1) for total bandwidth b. Several papers, e.g., [6] have shown this bound on delay to be optimal. Harmonic broadcasting is implemented in [1] by a reduction from the windowscheduling problem. Specifically, the movie is partitioned into s equal-sized segments that are scheduled on the channels such that the gap between any two consecutive appearances of segment i is at most i. For a given number of channels, the goal is to maximize s, and as a result, minimize the start-up delay (which is at most 1/s). A schedule based on this principle is shown to approach the lower bound as h → ∞. The papers [12, 13] also allow clients to start buffering
176
A. Bar-Noy, R.E. Ladner, and T. Tamir
segments before they start viewing the movie to achieve better results. However, they demonstrate the usefulness of this observation only for small examples. The paper [2] gives asymptotic matching upper and lower bounds on the maximal delay of a broadcasting scheme that uses pre-buffering. The papers [18, 16] consider pre-loading, but only for the case of zero delay. The paper [18] does not allow pre-buffering before the clients start watching the movie whereas the paper [16] improves the results by allowing this feature. In another work on pre-loading [10], it is assumed that each client pre-loads segments of a different set of movies, according to the client’s choice. Earlier works on pre-loading assume that the preloaded data is stored at a proxy server and not at the client’s local machine [5, 20]. 1.3
Contribution
We consider broadcasting schemes that combine pre-loading and pre-buffering. We present a complete tradeoff between (i) the size of the pre-loading; (ii) the maximal possible delay for an uninterrupted playback; (iii) the number of media; and (iv) the number of channels allocated per one media. For a given B the size of the pre-loading as a fraction of the media length, for m media, and for h channels per media, we first establish a lower bound for the minimal maximum delay, D, as a fraction of the movie length, for an uninterrupted playback of any media out of the m media. We then present an upper bound that approaches this lower bound when each media can be fragmented to many segments.
2
A Lower Bound for the Maximal Delay
We first compute a lower bound for the maximal delay for a fixed s ≥ 1 number of segments per movie. Then we calculate the general lower bound by letting s tend to infinity. For ease of presentation we assume that both b = Bs and d = Ds are integers. Each client has the first b = Bs segments of each movie in its buffer. Therefore, the channels need to broadcast only segments b + 1, . . . , s. Since the maximal delay is d, segment i of each movie should be broadcast at least once in any window of size d + i for b + 1 ≤ i ≤ s. That is, segment i consumes at least 1/(d + i) of a channel. Since the total number of channels is h and since there are m movies, it follows that m
s
i=b+1
1 ≤h. i+d
This is equivalent to s+d
i=b+d+1
1 ≤ρ. i
Optimal Delay for Media-on-Demand with Pre-loading and Pre-buffering
Using the known bound on the harmonic number Hn = s+d ln ≤ρ. b+d
n
i=1 (1/i)
177
implies
Since b = Bs and d = Ds, this is equivalent to 1+D ≤ eρ . B+D By manipulating the above inequality we get the lower bound for D given B D≥
1 − Beρ . eρ − 1
Equivalently, the lower bound for B given D is 1 − D(eρ − 1) . eρ In particular, when B = 0 the lower bound matches the known lower bound [6] B≥
D≥
1 . eρ − 1
When D = 0 the lower bound for B is 1 . eρ For example, in order to guarantee no delay for a single movie transmitted on a single channel the client must pre-load at least 1/e ≈ 0.368 of the movie. B≥
3
Optimal Schedules
In this section we present an upper bound that approaches the lower bound from Section 2 when each movie can be fragmented into many segments. In the optimal schedule the last segments of each movie are transmitted in such a way that earlier segments are transmitted more often. Assume first a transition of a single movie, that is, m = 1. Consider a schedule of the numbers [x..y] on h channels such that for any x ≤ i ≤ y, in each window of i consecutive slots, the number i appears at least once in one of the channels. For example [4, 6, 5, 7, 4, 8, 5, 6, 4, 7, 5, 8] is such a schedule for h = 1, x = 4, and y = 8. Suppose we interpret the numbers x, . . . , y as segments s − y + x, . . . , s of the movie. This reflects a partition of the movie into s segments each of length 1/s of the movie length. The segments that are not transmitted should be stored at the client memory, thus, the pre-loading size is b = s − y + x − 1 which implies B = (s − y + x − 1)/s. Furthermore, the delay with pre-buffering is D = (y + 1 − s)/s. It follows that a viable range for s is from y − x + 1 to y + 1 (it might be that s > y + 1 but the delay never reduces below 0), and we get the following tradeoff between B and Dg:
178
A. Bar-Noy, R.E. Ladner, and T. Tamir
s y−x+1 y−x+2 y−x+i y y+1 >y+1
B D 0 x/(y − x + 1) 1/(y − x + 2) (x − 1)/(y − x + 2) (i − 1)/(y − x + i) (x − i + 1)/(y − x + i) (x − 1)/y 1/y x/(y + 1) 0 (s + x − y − 1)/s 0
In particular, this means that in order to guarantee no delay with this schedule the pre-loading size should be x/(y + 1) of the movie length and with no preloading the maximal delay is x/(y − x + 1) of the movie length. The upper bound is achieved for such a schedule of the last segments, that is, for some range [x..y], any x ≤ i ≤ y, is transmitted at least once in each window of i consecutive slots. This is a special instance of the windows scheduling problem studied in [2]. Consider the general case s = y−x+i in which B = (i−1)/(y−x+i) and D = (x − i + 1)/(y − x + i). Assign z = y + 1 and j = x − i + 1. With these variables, j x−j D= . B= z−j z−j Further, assign w = z/j. It follows that B=
x/j − 1 w−1
D=
1 . w−1
As shown in [2], in the limit, for large values of s (and consequently large values of x, y), there exists a valid schedule of [x..y] such that x 1 ≈ h . y−x+1 e −1 This implies that
y+1 z ≈ h . h e e Furthermore, the values of B and D as a function of w are x=
B=
w/eh − 1 w−1
D=
1 . w−1
Plugging w = 1 + 1/D in the equality for B yields 1 + 1/D D+1 1 1 B=D −1 = −D = h − 1− h D . eh eh e e Equivalently, D=
1/eh − B 1 − eh B . = 1 − 1/eh eh − 1
Optimal Delay for Media-on-Demand with Pre-loading and Pre-buffering
179
For the special case of D = 0 we have (1 − eh B) = 0 or equivalently B=
1 . eh
For the special case of B = 0 we have 1/eh = (1 − 1/eh)D or equivalently D=
eh
1 . −1
The calculation for the general case of m > 1 is identical. For each of the m movies, segments s − y + x, . . . , s are transmitted with windows x, . . . , y, respectively. Along the whole calculation it is possible to replace h by ρ = h/m. Note that all the above upper bounds match the lower bounds from Section 2.
4
Discussion
In this paper we showed a tradeoff between the size of the pre-loaded buffer and the guaranteed delay for an uninterrupted playback of movies. We first proved the optimal possible tradeoff and then demonstrated how to achieve it when a movie may be partitioned to many segments. In what follows we discuss several possible extensions. Limiting the receiving bandwidth. In this paper we assumed that a client can buffer segments of the movie from all the channels. This means that the receiving bandwidth of a client is h times more than the playback bandwidth. Several papers explored the case where the receiving bandwidth is only r times the playback bandwidth for some 1 < r < h (e.g. [17]). However, no paper consider this case with the pre-loading capability. Limited size buffers. Early works on this model assumed that the buffer size for the pre-buffered segments is bounded as a fraction of the movie length (see the survey [3]). Although it seems that the sky is the limit for cheap and large memory, this might not be the case for hand-held set top boxes. It is interesting therefore to investigate the tradeoff between the pre-loaded buffer size and the pre-buffered buffer size when their sum is bounded. Movies with different popularity. The solution of broadcasting (in contrast to unicast) is suitable for popular media. However, even among popular media there are different levels of popularity. In particular, only a small number of movies is very popular at a specific time. It is very intriguing to see how the combination of pre-loading and pre-buffering can be used to provide smaller delay to the highly requested movies while increasing the maximal possible delay for less popular movies. The problem can be modelled as follows. Consider a system with m movies with different m popularity. The popularity parameter of movie i is denoted by pi such that i=1 p1i = 1. The parameter pi can be viewed as the probability that the next client’s request is to watch movie i. Let Di denote the maximal
180
A. Bar-Noy, R.E. Ladner, and T. Tamir
possible delay ambroadcasting scheme guarantees for a movie i, then the goal is to minimize i=1 pi Di . That is, the weighted maximal possible delay (also the expected maximal delay) of the whole system. In practice, especially since the popularity parameter varies drastically over time, it is not practical to assume that each movie has a specific popularity parameter and instead a simpler model may be addressed. The system distinguishes between the hot movies and the rest of the popular movies. There are various ways to ensure smaller delay to the hot movies, they can be transmitted more often, or a larger portion of these movies might be pre-loaded.
References 1. A. Bar-Noy and R. E. Ladner. Windows Scheduling Problems for Broadcast Systems. SIAM Journal on Computing (SICOMP), 32(4):1091–1113, 2003. 2. A. Bar-Noy, R. E. Ladner, and T. Tamir. Scheduling techniques for media-ondemand. Proc. of the 14-th Annual ACM-SIAM Symposium on Discrete Algorithms, 791-800, 2003. 3. S. W. Carter, D. D. E. Long, and J. Pˆ aris. Video-on-Demand Broadcasting Protocols. In Multimedia Communications: Directions and Innovations (J. D. Gibson, Editors), Academic Press, San Diego, 179–189, 2000. 4. A. Dan, D. Sitaram, and P. Shahabuddin. Dynamic Batching Policies for an OnDemand Video Server. ACM Multimedia Systems Journal, 4(3):112–121, 1996. 5. D. Eager, M. Ferris and M. Vernon. Optimized regional caching for on-demand data delivery. In Proc. 1999 Multimedia Computing and Networking Conference (MMCN’99), 1999. 6. L. Engebretsen and M. Sudan. Harmonic Broadcasting is Optimal. In Proceedings of the 13th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), 431 – 432, 2002. 7. K. A. Hua, Y. Cai, and S. Sheu Exploiting Client Bandwidth for More Efficient Video Broadcast. In Proceedings of the 7th International Conference on Computer Communication and Networks (ICCCN), 848–856, 1998. 8. L. Juhn and L. Tseng. Harmonic Broadcasting for Video-on-Demand Service. IEEE Transactions on Broadcasting, 43(3):268–271, 1997. 9. L. Juhn and L. Tseng. Fast Data Broadcasting and Receiving Scheme for Popular Video Service. IEEE Transactions on Broadcasting, 44(1):100–105, 1998. 10. J. F. Pˆ aris. A Broadcasting Protocol for Video-on-Demand Using Optional Partial Preloading. In Proceedings of the 11th International Conference on Computing, ˝ vol.I, 319U-329, 2002. 11. J. Pˆ aris. A Simple Low-Bandwidth Broadcasting Protocol for Video-on-Demand. In Proceedings of the 8th International Conference on Computer Communications and Networks (IC3N), 118–123, 1999. 12. J. Pˆ aris. A Fixed-Delay Broadcasting Protocol for Video-on-Demand. In Proceedings of the 10th International Conference on Computer Communications and Networks (IC3N), 418–423, 2001. 13. J. Pˆ aris. A Simple but Efficient Broadcasting Protocol for Video-on-Demand. In Proceedings of the 24th International Performance of Computers and Communica˝ tion Conference (IPCCC 2005), 167-U174, 2005.
Optimal Delay for Media-on-Demand with Pre-loading and Pre-buffering
181
14. J. Pˆ aris, S. W. Carter, and D. D. E. Long. A Low Bandwidth Broadcasting Protocol for Video on Demand. In Proceedings of the 7th International Conference on Computer Communications and Networks (IC3N), 690–697, 1998. 15. J. Pˆ aris, S. W. Carter, and D. D. E. Long. A Hybrid Broadcasting Protocol for Video on Demand. In Proceedings of the IS&T/SPIE Conference on Multimedia Computing and Networking (MMCN), 317–326, 1999. 16. J. Pˆ aris and D. D. E. Long. The Case for Aggressive Partial Preloading in Broadcasting Protocols for Video-on-Demand. In Proceedings of the IEEE International Conference on Multimedia and Expo (ICME), 113–116, 2001. 17. J. Pˆ aris and D. D. E. Long. Limiting the Receiving Bandwidth of Broadcasting Protocols for Video-on-Demand. In Proceedings of the Euromedia Conference, 107111, 2000. 18. J. Pˆ aris, D. D. E. Long, and P. E. Mantey, Zero-Delay Broadcasting Protocols for Video-on-Demand. In Proceedings of the 1999 ACM Multimedia Conference pages 189-197, 19. ReplayTV. http://www.replay.com 20. S. Sen, J. Rexford, and D. Towsley. Proxy prefix caching for multimedia streams. In Proceedings of the IEEE 18th Conference on Computer Communications (INFOCOM), 1310–1319, 1999. 21. Y. C. Tseng, M. H. Yang, and C. H. Chang. A Recursive Frequency-Splitting Scheme for Broadcasting Hot Video in VOD Service. IEEE Transactions on Communications, 50(8):1348–1355, 2002. 22. TiVo Technologies. http://www.tivo.com 23. UltimateTV. http://www.ultimatetv.com 24. S. Viswanathan and T. Imielinski. Metropolitan Area Video-on-Demand Service Using Pyramid Broadcasting. ACM Multimedia Systems, 4(3):197–208, 1996.
Strongly Terminating Early-Stopping k-Set Agreement in Synchronous Systems with General Omission Failures Philippe Raïpin Parvédy, Michel Raynal, and Corentin Travers IRISA, Université de Rennes 1, Campus de Beaulieu, 35042 Rennes, France {praipinp, raynal, ctravers}@irisa.fr
Abstract. The k-set agreement problem is a generalization of the consensus problem: considering a system made up of n processes where each process proposes a value, each non-faulty process has to decide a value such that a decided value is a proposed value, and no more than k different values are decided. It has recently be shown that, in the crash failure model, min(⌊ fk ⌋ + 2, ⌊ kt ⌋ + 1) is a lower bound on the number of rounds for the non-faulty processes to decide (where t is an upper bound on the number of process crashes, and f , 0 ≤ f ≤ t, the actual number of crashes). This paper considers the k-set agreement problem in synchronous systems where up to t < n/2 processes can experience general omission failures (i.e., a process can crash or omit sending or receiving messages). It first introduces a new property, called strong termination. This property is on the processes that decide. It is satisfied if, not only every non-faulty process, but any process that neither crashes nor commits receive omission failures decides. The paper then presents a k-set agreement protocol that enjoys the following features. First, it is strongly terminating (to our knowledge, it is the first agreement protocol to satisfy this property, whatever the failure model considered). Then, it is early deciding and stopping in the sense that a process that either is non-faulty or commits only send omission failures decides and halts by round min(⌊ fk ⌋ + 2, ⌊ kt ⌋ + 1). To our knowledge, this is the first early deciding k-set agreement protocol for the general omission failure model. Moreover, the protocol provides also the following additional early stopping property: a process that commits receive omission failures (and does not crash) executes at most min(⌈ fk ⌉ + 2, ⌊ kt ⌋ + 1) rounds. It is worth noticing that the protocol allows each property (strong termination vs early deciding/stopping vs early stopping) not to be obtained at the detriment of the two others. The combination of the fact that min(⌊ fk ⌋ + 2, ⌊ kt ⌋ + 1) is lower bound on the number of rounds in the crash failure model, and the very existence of the proposed protocol has two very interesting consequences. First, it shows that, although general omission failure model is more severe than the crash failure model, both models have the same lower bound for the non-faulty processes to decide. Second, it shows that, in the general omission failure model, that bound applies also the processes that commit only send omission failures. Keywords: Agreement problem, Crash failure, Strong Termination, Early decision, Early stopping, Efficiency, k-set agreement, Message-passing system, Receive omission failure, Round-based computation, Send omission failure, Synchronous system. P. Flocchini and L. Gasieniec ˛ (Eds.): SIROCCO 2006, LNCS 4056, pp. 182–196, 2006. c Springer-Verlag Berlin Heidelberg 2006
Strongly Terminating Early-Stopping k-Set Agreement
183
1 Introduction Context of the paper k -set and consensus problems. The k-set agreement problem generalizes the uniform consensus problem (that corresponds to the case k = 1). It has been introduced by S. Chaudhuri who, considering the crash failure model, investigated how the number of choices (k) allowed to the processes is related to the maximum number (t) of processes that can be faulty (i.e., that can crash) [7]. The problem can be defined as follows. Each of the n processes (processors) defining the system starts with its own value (called “proposed value”). Each process that does not crash has to decide a value (termination), in such a way that a decided value is a proposed value (validity) and no more than k different values are decided (agreement)1. k-set agreement can trivially be solved in crash-prone asynchronous systems when k > t [7]. A one communication step protocol is as follows: (1) t + 1 processes are arbitrarily selected prior to the execution; (2) each of these processes sends its value to all processes; (3) a process decides the first value it receives. Differently, it has been shown that there is no solution in these systems as soon as k ≤ t [5, 17, 31]. (The asynchronous consensus impossibility, case k = 1, was demonstrated before, using a different technique [11]. A combinatorial characterization of the tasks which are solvable in presence of one process crash is presented in [3]). Several approaches have been proposed to circumvent the impossibility to solve the k-set agreement problem in process crash prone asynchronous systems (e.g., probabilistic protocols [22], or unreliable failure detectors with limited scope accuracy [16, 21, 32]). The situation is different in process crash prone synchronous systems where the kset agreement problem can always be solved, whatever the value of t with respect to k. It has also been shown that, in the worst case, the lower bound on the number of rounds (time complexity measured in communication steps) is ⌊t/k⌋ + 1 [8]. (This bound generalizes the t + 1 lower bound associated with the consensus problem [1, 2, 10, 20]. See also [4] for the case t = 1.) Early decision. Although failures do occur, they are rare in practice. For the uniform consensus problem (k = 1), this observation has motivated the design of early deciding synchronous protocols [6, 9, 19, 30], i.e., protocols that can cope with up to t process crashes, but decide in less than t + 1 rounds in favorable circumstances (i.e., when there are few failures). More precisely, these protocols allow the processes to decide in min(f + 2, t + 1) rounds, where f is the number of processes that crash during a run, 0 ≤ f ≤ t, which has been shown to be optimal (the worst scenario being when there is exactly one crash per round) [6, 18]2 . In a very interesting way, it has very recently been shown that the early deciding lower bound for the k-set agreement problem in the synchronous crash failure model is ⌊f /k⌋+2 for 0 ≤ ⌊f /k⌋ ≤ ⌊t/k⌋−2, and ⌊f /k⌋+1 otherwise [12]. This lower bound, 1
2
A process that decides and thereafter crashes is not allowed to decide one more value, in addition to the k allowed values. This is why k-set agreement generalizes uniform consensus where no two processes (be they faulty or not) can decide different values. Non-uniform consensus allows a faulty process to decide a value different from the value decided by the correct processes. The non-uniform version of the k-set agreement problem has not been investigated in the literature. More precisely, the lower bound is f + 2 when f ≤ t − 2, and f + 1 when f = t − 1 or f = t.
184
P. Raïpin Parvédy, M. Raynal, and C. Travers
not only generalizes the corresponding uniform consensus lower bound, but also shows an “inescapable tradeoff” among the number t of crashes tolerated, the number f of actual crashes, the degree k of coordination we want to achieve, and the best running time achievable [8]. As far as the time/coordination degree tradeoff is concerned, it is important to notice that, when compared to consensus, k-set agreement divides the running time by k (e.g., allowing two values to be decided halves the running time). Related work. While not-early deciding k-set agreement protocols for the synchronous crash failure model (i.e., protocols that always terminate in ⌊t/k⌋ + 1 rounds) are now well understood [2, 8, 20], to our knowledge, so far only two early deciding k-set agreement protocols have been proposed [13, 27] for that model. The protocol described in [13] assumes t < n − k, which means that (contrarily to what we could “normally” hope) the number of crashes t that can be tolerated decreases as the coordination degree k increases. The protocol described in [27], which imposes no constraint on t (i.e., t < n), is based on a mechanism that allows the processes to take into account the actual pattern of crash failures and not only their number, thereby allowing the processes to decide in much less than ⌊f /k⌋ + 2 rounds in a lot of cases (the worst case being only when the crashes are evenly distributed in the rounds with k crashes per round). We have recently designed an early deciding k-set agreement protocol for the synchronous send (only) omission failure model [28]. Content of the paper. This paper investigates the k-set agreement problem in synchronous systems prone to general omission failures and presents a corresponding protocol. This failure model lies between the crash failure model and the Byzantine failure model [24]: a faulty process is a process that crashes, or omits sending or receiving messages [14, 25]. This failure model is particularly interesting as it provides the system designers with a realistic way to represent input or output buffer overflow failures of at most t processes [14, 25]. The proposed protocol enjoys several noteworthy properties. – The usual termination property used to define an agreement problem concerns only the correct processes: they all have to decide. This requirement is tied to the problem, independently of a particular model. Due to the very nature of the corresponding faults, there is no way to force a faulty process to decide in the crash failure model. It is the same in the Byzantine failure model where a faulty process that does not crash can decide an arbitrary value. The situation is different in the general omission failure model where a faulty process that does not crash cannot have an arbitrary behavior. On one side, due to the nature of the receive omission failures committed by a process, there are runs where that process can forever be prevented from learning that it can decide a value without violating the agreement property (at most k different values are decided). So, for such a process, the best that can be done in the general case is either to decide a (correct) value, or halt without deciding because it does not know whether it has a value that can be decided. On the other side, a process that commits only send omission failures receives all the messages sent to it, and should consequently be able to always decide a correct value. We say that a protocol is strongly terminating if it forces to decide all the processes that neither crash nor commit receive omission failures (we call them
Strongly Terminating Early-Stopping k-Set Agreement
185
the good processes; the other processes are called bad processes). This new termination criterion is both theoretically and practically relevant: it extends the termination property to all the processes that are committing only “benign” faults. The proposed protocol is strongly terminating3. – Although, as discussed before, early decision be an interesting property, some early-deciding (consensus) protocols make a difference between early decision and early stopping: they allow a correct process to decide in min(f + 2, t + 1) but stop only at a later round (e.g., [9]). Here we are interested in early-deciding protocols in which a process decides and stops during the very same round. More precisely, the protocol has the following property: • A good process decides and halts by round min(⌊ fk ⌋ + 2, ⌊ kt ⌋ + 1). So, when ⌊ fk ⌋ ≤ ⌊ kt ⌋ − 2, the protocol has the noteworthy property to extend the ⌊ fk ⌋+2 lower bound for a correct process to decide (1) from the crash failure model to the general omission failure model, and (2) from the correct processes to all the good processes. As noticed before, it is not possible to force a bad process to decide. So, for these processes the protocol “does its best”, namely it ensures the following early stopping property: • No process executes more than min(⌈ fk ⌉ + 2, ⌊ kt ⌋ + 1) rounds. Let us notice that it is possible that a bad process decides just before halting. Moreover, when f = x k where x is an integer (which is always the case for consensus), or when there is no fault (f = 0), a bad process executes no more rounds than a good process. In the other cases, it executes at most one additional round. – Each message carries a proposed value and two boolean arrays of size n (sets of process identities). This means that, if we do not consider the size of the proposed values (that does not depends on the protocol), the bit complexity is upper bounded by O(n2 f /k) per process. The design of a protocol that satisfies, simultaneously and despite process crashes and general omission faults, the agreement property of the k-set problem, strong termination, early decision and stopping for the good processes and early stopping for the bad processes is not entirely obvious, as these properties are partly antagonistic. This is due to the fact that agreement requires that no more than k distinct values be decided (be the deciding processes correct or not), strong termination requires that, in addition to the correct processes, a well defined class of faulty processes decide, and early stopping requires the processes to halt as soon as possible. Consequently the protocol should not prevent processes from deciding at different rounds, and so, after it has decided, a process can appear to the other processes as committing omission failures, while it is actually correct. Finally, the strong termination property prevents the elimination from the protocol of a faulty process that commits only send omission failures as soon as it has been discovered faulty, as that process has to decide a value if it does not crash later. A major difficulty in the design of the protocol consists in obtaining simultaneously all these properties and not each one at the price of not satisfying one of the others. 3
None of the uniform consensus protocols for the synchronous general omission failure model that we are aware of (e.g., [25, 26]) is strongly terminating.
186
P. Raïpin Parvédy, M. Raynal, and C. Travers
General transformations from a synchronous failure model to another synchronous failure model (e.g., from omission to crash) are presented in [23]. These transformations are general (they are not associated with particular problems) and have a cost (simulating a round in the crash failure model requires two rounds in the more severe omission failure model). So, they are not relevant for our purpose. When instantiated with k = 1, the protocol provides a new uniform consensus protocol for the synchronous general omission failure model. To our knowledge, this is the first uniform consensus protocol that enjoys strong termination and directs all the processes to terminate by round min(f + 2, t + 1). Let us finally observe that the paper leaves open two problems for future research. The first consists in proving or disproving that ⌈ kf ⌉ + 2 is a tight lower bound for a bad process to stop when f = k x + y with x and y being integers and 0 < y < k (we think it is). The second problem concerns t: is t < n/2 a lower bound to solve the strongly terminating early stopping k-set problem? (Let us remark that the answer is “yes” for k = 1 [23, 30].) k-set protocol can be useful to allocate shareable resources. As an example, let us consider the allocation of broadcast frequencies in communication networks (this example is taken from [20]). Such a protocol allows processes to agree on a small number of frequencies for broadcasting large data (e.g., a movie). As the communication is broadcast based, the processes can receive the data using the same frequency. Roadmap. The paper consists of 6 sections. Section 2 presents the computation model and gives a definition of the k-set agreement problem. To underline its basic design principles and make its understanding easier, the protocol is presented incrementally. Section 3 presents first a strongly terminating k-set agreement protocol. Then, Section 5 enriches this basic protocol to obtain a strongly terminating, early stopping k-set agreement protocol. Formal statements of the properties (lemmas and theorems) of both protocols are provided in Section 4 and Section 6, respectively. Due to the page limitation, the full proofs of these properties do not appear in this paper. The interested reader can find them in a companion technical report [29] available on-line.
2 Computation Model and Strongly Terminating k-Set Agreement 2.1 Round-Based Synchronous System The system model consists of a finite set of processes, namely, Π = {p1 , . . . , pn }, that communicate and synchronize by sending and receiving messages through channels. Every pair of processes pi and pj is connected by a channel denoted (pi , pj ). The underlying communication system is assumed to be failure-free: there is no creation, alteration, loss or duplication of message. The system is synchronous. This means that each of its executions consists of a sequence of rounds. Those are identified by the successive integers 1, 2, etc. For the processes, the current round number appears as a global variable r that they can read, and whose progress is managed by the underlying system. A round is made up of three consecutive phases:
Strongly Terminating Early-Stopping k-Set Agreement
187
– A send phase in which each process sends messages. – A receive phase in which each process receives messages. The fundamental property of the synchronous model lies in the fact that a message sent by a process pi to a process pj at round r, is received by pj at the same round r. – A computation phase during which each process processes the messages it received during that round and executes local computation. 2.2 Process Failure Model A process is faulty during an execution if its behavior deviates from that prescribed by its algorithm, otherwise it is correct. A failure model defines how a faulty process can deviate from its algorithm [15]. We consider here the following failure models: – Crash failure. A faulty process stops its execution prematurely. After it has crashed, a process does nothing. Let us observe that if a process crashes in the middle of a sending phase, only a subset of the messages it was supposed to send might actually be sent. – Send Omission failure. A faulty process crashes or omits sending messages it was supposed to send [14]. – General Omission failure. A faulty process crashes, omits sending messages it was supposed to send or omits receiving messages it was supposed to receive (receive omission) [25]. It is easy to see that these failure models are of increasing “severity” in the sense that any protocol that solves a problem in the General Omission (resp., Send Omission) failure model, also solves it in the (less severe) Send Omission (resp., Crash) failure model [15]. This paper considers the General Omission failure model. As already indicated, n, t and f denote the total number of processes, the maximum number of processes that can be faulty, and the actual number of processes that are faulty in a given run, respectively (0 ≤ f ≤ t < n/2). As defined in the introduction, good processes are the processes that neither crash nor commit receive omission failures. A bad process is a process that commits receive omission failures or crashes. So, given a run, each process is either good or bad. A good process commits only “benign” failures, while a bad process commits “severe” failures. 2.3 Strongly Terminating k-Set Agreement The problem has been informally stated in the Introduction: every process pi proposes a value vi and each correct process has to decide on a value in relation to the set of proposed values. More precisely, the k-set agreement problem is defined by the following three properties: – Termination: Every correct process decides. – Validity: If a process decides v, then v was proposed by some process. – Agreement: No more than k different values are decided. As we have seen 1-set agreement is the uniform consensus problem. In the following, we implicitly assume k ≤ t (this is because, as we have seen in the introduction, k-set agreement is trivial when k > t).
188
P. Raïpin Parvédy, M. Raynal, and C. Travers
As already mentioned, we are interested here in protocols that direct all the good processes to decide. So, we consider a stronger version of the k-set agreement problem, in which the termination property is replaced by the following property: – Strong Termination: Every good process decides.
3 A Strongly Terminating k-Set Agreement Protocol We first present a strongly terminating k-set agreement protocol where the good processes terminate in ⌊ kt ⌋ + 1 rounds. The protocol is described in Figure 1. r is a global variable that defines the current round number; the processes can only read it. A process pi starts the protocol by invoking the function k-SET _ AGREEMENT(vi ) where vi is the value it proposes. It terminates either by crashing, by returning the default value ⊥ at line 08, or by returning a proposed value at line 11. As we will see, only a bad process can exit at line 08 and return ⊥. That default value cannot be proposed by a process. So, returning ⊥ means “no decision” from the k-set agreement point of view. 3.1 Local Variables A process pi manages four local variables. The scope of the first two is the whole execution, while the scope of the last two is limited to each round. Their meaning is the following: – esti is pi ’s current estimate of the decision value. Its initial value is vi (line 01). – trustedi represents the set of processes that pi currently considers as being correct. Its initial value is Π (the whole set of processes). So, i ∈ trustedi (line 04) means that pi considers it is correct. If j ∈ trustedi we say “pi trusts pj ”; if j ∈ / trustedi we say “pi suspects pj ”. – rec_f romi is a round local variable used to contain the ids of the processes that pi does not currently suspect and from which it has received messages during that round (line 05). – Wi (j) is a set of processes identities that represents the set of the processes pℓ that are currently trusted by pi and that (to pi ’s knowledge) trust pj (line 06). 3.2 Process Behavior The aim is for a process to decide the smallest value it has seen. But, due to the send and receive omission failures possibly committed by some processes, a process cannot safely decide the smallest value it has ever seen, it can only safely decide the smallest in a subset of the values it has received during the rounds. The crucial part of the protocol consists in providing each process with correct rules that allow it to determine its “safe subset”. During each round r, these rules are implemented by the following process behavior decomposed in three parts according to the synchronous round-based computation model.
Strongly Terminating Early-Stopping k-Set Agreement
189
Function k-SET _ AGREEMENT (vi) (01) esti ← vi ; trusted i ← Π; % r = 0 % (02) for r = 1, . . . , ⌊ kt ⌋ + 1 do (03) begin_round (04) if (i ∈ trusted i ) then foreach j ∈ Π do send (esti , trusted i ) to pj enddo endif; (05) let rec_f romi = {j : (estj , trust j ) is received from pj during r ∧ j ∈ trusted i }; (06) foreach j ∈ rec_fromi letWi (j) = {ℓ : ℓ ∈ rec_from i ∧ j ∈ trust ℓ }; (07) trusted i ← rec_fromi − j : |Wi (j)| < n − t ; (08) if (|trusted i | < n − t) then return (⊥) endif; (09) esti ← min(estj received during r and such that j ∈ trustedi ) (10) end_round; (11) return (esti ) Fig. 1. Strongly terminating k-set protocol for general omission failures, code for pi , t
k (let vm denote the kth smallest value in EST [r], i.e., the greatest value among the k smallest values of EST [r]). Let i ∈ Completing[r]. We have n − k r < |trustedi [r]| ⇒ esti [r] ≤ vm . 4.3 Properties of the Protocol Theorem 1. [Validity] A decided value is a proposed value. Theorem 2. [Strong Termination] A process pi that neither crashes nor commits receive omission failures decides. As a correct process does not commit receive omission failures, the following corollary is an immediate consequence of the previous theorem. Corollary 1. [Termination] Every correct process decides. Theorem 3. [Agreement] No more than k different values are decided.
5 A Strongly Terminating and Early Stopping k-Set Agreement Protocol This section enriches the previous strongly terminating k-set agreement protocol to obtain an early stopping protocol, namely, a protocol where a good process decides and halts by round min(⌊ fk ⌋ + 2, ⌊ kt ⌋ + 1), and a bad process executes at most min(⌈ fk ⌉ + 2, ⌊ kt ⌋ + 1) rounds. The protocol is described in Figure 2. To make reading and understanding easier, all the lines from the first protocol appears with the same number. The line number of each of the 10 new lines that make the protocol early stopping are prefixed by “E”. We explain here only the new parts of the protocol. 5.1 Additional Local Variables A process pi manages three additional local variables, one (can_deci ) whose scope is the whole computation, and two (CAN _DECi and REC _FROMi ) whose scope is limited to each round. Their meaning is the following. – can_deci is a set of process identities that contains, to pi ’s knowledge, all the processes that can decide a value without violating the agreement property. The current value of can_deci is part of each message sent by pi . Its initial value is ∅.
192
P. Raïpin Parvédy, M. Raynal, and C. Travers
Function k-SET _ AGREEMENT (vi) (01) esti ← vi ; trusted i ← Π; can_dec i ← ∅; % r = 0 % (02) for r = 1, . . . , ⌊ kt ⌋ + 1 do (03) begin_round (04) if (i ∈ trusted i ) then foreach j ∈ Π do send (esti , trusted i , can_deci ) to pj enddo endif; (E01) let REC _FROMi = {i} ∪ {j : (estj , trust j , c_decj ) rec. from pj during r}; (E02) let CAN _DECi = ∪(c_decj : j ∈ REC _FROMi ); (E03) if (i ∈ / trustedi ∨ i ∈ can_deci ) then (E04) if |CAN _DECi | > t then let ESTi = {estj : j ∈ REC _FROMi ∧ c_decj = ∅}; (E05) return (min(ESTi )) (E06) endif endif; (05) let rec_f romi = {j : (estj , trust j , c_decj ) rec. from pj during r ∧ j ∈ trusted i }; (06) foreach j ∈ rec_fromi letWi (j) = {ℓ : ℓ ∈ rec_from i ∧ j ∈ trust ℓ }; (07) trusted i ← rec_fromi − j : |Wi (j)| < n − t ; (08) if (|trusted i | < n − t) then return (⊥) endif; (09) esti ← min(estj received during r and such that j ∈ trustedi ); (E07) can_deci ← ∪(c_decj received during r and such that j ∈ trustedi ); / can_deci )then (E08) if (i ∈ trustedi ∧ i ∈ (E09) if (n − k r < |trustedi |) ∨ (can_deci = ∅) then can_deci ← can_deci ∪ {i} (E10) endif endif (10) end_round; (11) return (esti ) Fig. 2. k-set early-deciding protocol for general omission failures, code for pi , t
t used at line E04: that additional predicate guarantees that at least one correct process can early decide and consequently has transmitted or will transmit its (estj , can_decj ) pair to all. So, the early decision/stopping predicate for a process pi spans actually two rounds r and r′ (r′ > r). This is a “two phase” predicate split as follows: – During r (lines E08|E09): (i ∈ trustedi ∧i ∈ / can_deci )∧(n−k r < |trustedi |)∨ (can_deci = ∅), and – During r′ (lines E03|E04): (i ∈ / trustedi ∨ i ∈ can_deci ) ∧ |CAN _DECi | > t. Moreover, for a correct process pi , the assignment can_deci ← can_deci ∪ {i} can be interpreted as a synchronization point separating the time instants when they are evaluated to true.
6 Proof of the Strongly Terminating Early Stopping Protocol Detailed proofs of the following lemmas and theorems are given in [29]. 6.1 Basic Lemmas The next lemma extends Lemma 1 to the early stopping context. Lemma 6. Let rd be the first round during which a correct process decides at line E05 (If there is no such round, let rd = ⌊ kt ⌋ + 1). Let pi be a process that is correct or commits only send omission failures. ∀r ≤ rd : if pi does not decide at line E05 of the round r, we have (1) C ⊆ trustedi [r] and (2) i ∈ Completing[r].
194
P. Raïpin Parvédy, M. Raynal, and C. Travers
Lemma 5 considers a round r such that C ⊆ Completing[r − 1] (i.e., a round executed by all the correct processes). Its proof relies on Lemma 1, but considers only the rounds r′ ≤ r. As, until a correct process decides, the Lemma 1 and the Lemma 6 are equivalent, it follows that the Lemma 1 can be replaced by Lemma 6 in the proof of Lemma 5. Let us also observe that the proofs of the Lemmas 2, 3 and 4 are still valid in the early stopping context (these proofs use the set Completing[r] and do not rely on the set C). We now state and prove additional lemmas used to prove the early stopping k-set agreement protocol. Lemma 7. The set ESTi [r] computed by pi during round r (line E04) is not empty. Lemma 8. Assuming that a process decides at line E05 during round r, let px be a process that proceeds to round r + 1 (if r = ⌊ kt ⌋ + 1, “proceed to round r + 1” means “execute the return() statement at line 11”). We have: x ∈ / trustedx [r] ∨ x ∈ can_decx [r]. Lemma 9. Let i ∈ Completing[r] (1 ≤ r ≤ ⌊ kt ⌋ + 1). can_deci [r] = ∅ ⇒ esti [r] is one of the k smallest values in EST [r]. Lemma 10. Assuming that a process decides at line E05 during round r, let px be a process that proceeds to round r + 1 (if r = ⌊ kt ⌋ + 1, “proceed to round r + 1” means “execute the return() statement at line 11”). We have: estx [r] is among the k smallest values in EST [r − 1]. Lemma 11. Let r ≤ ⌊ kt ⌋ be the first round during which a process decides at line E05. Then, (1) every process that is correct or commits only send omission failures decides at line E05 during round r or r + 1. Moreover, (2) no process executes more than r + 1 rounds. 6.2 Properties of the Protocol Theorem 4. [Agreement] No more than k different values are decided. Theorem 5. [Strong Termination and Early Stopping] (i) A process that is correct or commits only send omission failures decides and halts by round min(⌊ fk ⌋ + 2, ⌊ kt ⌋ + 1). (ii) No process halts after min(⌈ fk ⌉ + 2, ⌊ kt ⌋ + 1) rounds. The next corollary is an immediate consequence of the previous theorem. Corollary 2. [Termination] Every correct process decides. Theorem 6. [Validity] A decided value is a proposed value. Theorem 7. [Bit Complexity] Let b be the number of bits required to represent a proposed value. The bit complexity is upper bounded by O(n(b + 2n)f /k) per process.
Strongly Terminating Early-Stopping k-Set Agreement
195
References 1. Aguilera M.K. and Toueg S., A Simple Bivalency Proof that t-Resilient Consensus Requires t + 1 Rounds. Information Processing Letters, 71:155-178, 1999. 2. Attiya H. and Welch J., Distributed Computing, Fundamentals, Simulation and Advanced Topics (Second edition). Wiley Series on Parallel and Distributed Computing, 414 pages, 2004. 3. Biran O., Moran S. and Zaks S., A Combinatorial Characterization of the Distributed 1Solvable Tasks. Journal of Algorithms, 11(3): 420-440, 1990. 4. Biran O., Moran S. and Zaks S., Tight Bounds on the Round Complexity of Distributed 1-Solvable Tasks. Theoretical Computer Science, 145(1-2):271-290, 1995. 5. Borowsky E. and Gafni E., Generalized FLP Impossibility Results for t-Resilient Asynchronous Computations. Proc. 25th ACM Symposium on Theory of Computation (STOC’93), California (USA), pp. 91-100, 1993. 6. Charron-Bost B. and Schiper A., Uniform Consensus is Harder than Consensus. Journal of Algorithms, 51(1):15-37, 2004. 7. Chaudhuri S., More Choices Allow More Faults: Set Consensus Problems in Totally Asynchronous Systems. Information and Computation, 105:132-158, 1993. 8. Chaudhuri S., Herlihy M., Lynch N. and Tuttle M., Tight Bounds for k-Set Agreement. Journal of the ACM, 47(5):912-943, 2000. 9. Dolev D., Reischuk R. and Strong R., Early Stopping in Byzantine Agreement. Journal of the ACM, 37(4):720-741, April 1990. 10. Fischer M.J., Lynch N.A., A Lower Bound on the Time to Assure Interactive Consistency. Information Processing Letters, 14(4):183-186, 1982. 11. Fischer M.J., Lynch N.A. and Paterson M.S., Impossibility of Distributed Consensus with One Faulty Process. Journal of the ACM, 32(2):374-382, 1985. 12. Gafni E., Guerraoui R. and Pochon B., >From a Static Impossibility to an Adaptive Lower Bound: The Complexity of Early Deciding Set Agreement. Proc. 37th ACM Symposium on Theory of Computing (STOC’05), Baltimore (MD), pp.714-722, May 2005. 13. Guerraoui R. and Pochon B., The Complexity of Early Deciding Set Agreement: how Topology Can Help? Proc. 4th Workshop in Geometry and Topology in Concurrency and Distributed Computing (GETCO’04), BRICS Notes Series, NS-04-2, pp. 26-31, Amsterdam (NL), 2004. 14. Hadzilacos V., Issues of Fault Tolerance in Concurrent Computations. PhD Thesis, Tech Report 11-84, Harvard University, Cambridge (MA), 1985. 15. Hadzilacos V. and Toueg S., Reliable Broadcast and Related Problems. In Distributed Systems, ACM Press (S. Mullender Ed.), New-York, pp. 97-145, 1993. 16. Herlihy M.P. and Penso L. D., Tight Bounds for k-Set Agreement with Limited Scope Accuracy Failure Detectors. Distributed Computing, 18(2): 157-166, 2005. 17. Herlihy M.P. and Shavit N., The Topological Structure of Asynchronous Computability. Journal of the ACM, 46(6):858-923, 1999. 18. Keidar I. and Rajsbaum S., A Simple Proof of the Uniform Consensus Synchronous Lower Bound. Information Processing Letters, 85:47-52, 2003. 19. Lamport L. and Fischer M., Byzantine Generals and Transaction Commit Protocols. Unpublished manuscript, 16 pages, April 1982. 20. Lynch N.A., Distributed Algorithms. Morgan Kaufmann Pub., San Fransisco (CA), 872 pages, 1996. 21. Mostéfaoui A. and Raynal M., k-Set Agreement with Limited Accuracy Failure Detectors. Proc. 19th ACM Symposium on Principles of Distributed Computing (PODC’00), ACM Press, pp. 143-152, Portland (OR), 2000.
196
P. Raïpin Parvédy, M. Raynal, and C. Travers
22. Mostéfaoui A. and Raynal M., Randomized Set Agreement. Proc. 13th ACM Symposium on Parallel Algorithms and Architectures (SPAA’01), ACM Press, pp. 291-297, Hersonissos (Crete), 2001. 23. Neiger G. and Toueg S., Automatically Increasing the Fault-Tolerance of Distributed Algorithms. Journal of Algorithms, 11:374-419, 1990. 24. Pease L., Shostak R. and Lamport L., Reaching Agreement in Presence of Faults. Journal of the ACM, 27(2):228-234, 1980. 25. Perry K.J. and Toueg S., Distributed Agreement in the Presence of Processor and Communication Faults. IEEE Transactions on Software Eng., SE-12(3):477-482, 1986. 26. Raïpin Parvédy Ph. and Raynal M., Optimal Early Stopping Uniform Consensus in Synchronous Systems with Process Omission Failures. Proc. 16th ACM Symposium on Parallel Algorithms and Architectures (SPAA’04), Barcelona (Spain), ACM Press, pp. 302-310, 2004. 27. Raïpin Parvédy Ph., Raynal M. and Travers C., Early-Stopping k-set Agreement in Synchronous Systems Prone to any Number of Process Crashes. 8th Int. Conference on Parallel Computing Technologies (PaCT’05), Krasnoyarsk (Russia), Springer Verlag LNCS #3606, pp. 49-58, 2005. 28. Raïpin Parvédy Ph., Raynal M. and Travers C., Decision Optimal Early-Stopping k-set Agreement in Synchronous Systems Prone to Send Omission Failures. Proc. 11th IEEE Pacific Rim Int. Symposium on Dependable Computing (PRDC’05), Changsa (China), IEEE Computer Press, pp. 23-30, 2005. 29. Raïpin Parvédy Ph., Raynal M. and Travers C., Strongly Terminating Early-Stopping k-set Agreement in Synchronous Systems with General Omission Failures. Tech Report #1711, IRISA, Université de Rennes (France), 22 pages 2005. ftp://ftp.irisa.fr/techreports/2005/PI-1711.ps.gz 30. Raynal M., Consensus in Synchronous Systems: a Concise Guided Tour. Proc. 9th IEEE Pacific Rim Int. Symposium on Dependable Computing (PRDC’02), Tsukuba (Japan), IEEE Computer Press, pp. 221-228, 2002. 31. Saks M. and Zaharoglou F., Wait-Free k-Set Agreement is Impossible: The Topology of Public Knowledge. SIAM Journal on Computing, 29(5):1449-1483, 2000. 32. Yang J., Neiger G. and Gafni E., Structured Derivations of Consensus Algorithms for Failure Detectors. Proc. 17th Int. ACM Symposium on Principles of Distributed Computing (PODC’98), ACM Press, pp. 297-308, Puerto Vallarta (Mexico), July 1998.
On Fractional Dynamic Faults with Threshold⋆ aloviˇc2, Richard Kr´ aloviˇc2, and Nicola Santoro3 Stefan Dobrev1 , Rastislav Kr´ 1
School of Information Technology and Engineering, University of Ottawa, Ottawa, K1N 6N5, Canada 2 Dept. of Computer Science, Comenius University, Mlynsk´ a dolina, 84248 Bratislava, Slovakia 3 School of Computer Science, Carleton University, Ottawa, K1S 5B6, Canada
Abstract. Unlike localized communication failures that occur on a fixed (although a priori unknown) set of links, dynamic faults can occur on any link. Known also as mobile or ubiquitous faults, their presence makes many tasks difficult if not impossible to solve even in synchronous systems. Their analysis and the development of fault-tolerant protocols have been carried out under two main models. In this paper, we introduce a new model for dynamic faults in synchronous distributed systems. This model includes as special cases the existing settings studied in the literature. We focus on the hardest setting of this model, called simple threshold, where to be guaranteed that at least one message is delivered in a time step, the total number of transmitted messages in that time step must reach a threshold T ≤ c(G), where c(G) is the edge connectivity of the network. We investigate the problem of broadcasting under this model for the worst threshold T = c(G) in several classes of graphs as well as in arbitrary networks. We design solution protocols, proving that broadcast is possible even in this harsh environment. We analyze the time costs showing that broadcast can be completed in (low) polynomial time for several networks including rings (with or without knowledge of n), complete graphs (with or without chordal sense of direction), hypercubes (with or without orientation), and constant-degree networks (with or without full topological knowledge).
1
Introduction
1.1
Dynamic Faults
In a message-passing distributed computing environment, entities communicate by sending messages to their neighbors in the underlying communication network. However, during transmission, messages might be lost. The presence of communication faults renders the solution of problems difficult if not impossible. In particular, in asynchronous settings, the mere possibility of faults renders unsolvable almost all non trivial tasks, even if the faults are localized to (i.e., restricted to occur on the links of) a single entity [11]. Due to this ⋆
Partially supported by VEGA 1/3106/06, UK/404/2006, NSERC, and TECSIS Co.
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 197–211, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
198
S. Dobrev et al.
inherent difficulty connected with asynchrony, the focus is on synchronous environments, both from the point of view of theoretical investigation, and industrial application (e.g. communication protocols for wireless networks). Since synchrony provides a perfect omission detection mechanism [2], localized faults are easily dealt with in these systems; indeed, any number of faulty links can be tolerated provided they do not disconnect the network. The immediate question is then whether synchrony allows to tolerate also dynamic communication faults; that is, faults that are not restricted to a fixed (but a priori unknown) set of links, but can occur between any two neighbors [17]. These types of faults, also called mobile or ubiquitous, are clearly more difficult to handle. In this regard, the investigations have focused mostly on the basic problem of broadcast: an entity has some information that must communicate to all other entities in the network. Indeed, the ability or impossibility of performing this task has immediate consequence for many other tasks. Not surprisingly, a large research effort has been on the analysis of broadcasting in the presence of dynamic communication faults. Clearly no computation, including broadcast, is possible if the amount of faults that can occur per time unit and the modality of their occurrence is unrestricted. The research quest has thus been on determining under what conditions on the faults non-trivial computations can be performed in spite of those faults. Constructively, the effort is on designing protocols that can correctly solve a problem provided some restrictions on the occurrence of faults hold. A first large group of investigations have considered the so-called cumulative model; that is, there is a (known) limit L on the number1 of messages that can be lost at each time unit. If the limit is less than the edge connectivity of the network, L < c(G), then broadcast can be achieved by simply flooding and repeating transmissions for an appropriate amount of time. The research has been on determining what is the smallest amount of time in general or for specific topologies [3, 4, 5, 6, 8, 9, 10, 12, 14, 15], as well as on how to use broadcast for efficiently computing functions and achieving other tasks [7, 18, 19]. The advantage of the cumulative model is that solutions designed for it are L-tolerant; that is they tolerate up to L communication faults per time units. The disadvantage of this approach is that it neglects the fact that in real systems the number of lost messages is generally a function of the number of all message transitions. This feature leads to an anomaly of the cumulative model, where solutions that flood the network with large amounts of messages tend to work well, while their behavior in real faulty environments is often quite poor. A setting that takes into account the interplay between amount of transmissions and number of losses is the probabilistic model: there is no a priori upper bound on the total number of faults per time unit, but each transmission has a (known) probability p < 1 to fail. The investigations in this model have focused on designing broadcasting algorithms with low time complexity and high probability of success [1, 16]. The drawback of this model is that the solutions derived for it have no deterministic guarantee of correctness. 1
Since the faults are dynamic, no restriction is clearly posed on their location.
On Fractional Dynamic Faults with Threshold
199
The drawbacks of these two models have been the motivation behind the introduction of the so called fractional model, a deterministic setting that explicitly takes into account the interaction between the number of omissions and the number of messages. In the fractional model, the amount of faults that can occur at time t is not fixed but rather a linear fraction ⌊α mt ⌋ of the total number mt of messages sent at time t, where 0 ≤ α < 1 is a (known) constant. The advantage of the fractional model is that solutions designed for it tolerate the loss of up to a fraction of all transmitted messages [13]. The anomaly of the fractional model is that, in this setting, transmitting a single message per communication round ensures its delivery; thus, the model leads to very counterintuitive algorithms which do not behave well in real faulty environments. Summarizing, to obtain optimal solutions, message redundancy must be avoided in the fractional model, while massive redundancy of messages must be used in the cumulative model; in real systems, both solutions might not fare well. In many ways, the two models are opposite extremes. The lesson to be learned from their anomalies is that on one hand there is need to use redundant communication, but on the other hand brute force algorithms based on repeatedly flooding the network do not necessarily solve the problem. In this paper we propose a deterministic model that combines the cumulative and fractional models in a way that might better reflect reality. This model is actually more general, in that it includes those models as particular, extreme cases. It also defines a spectrum of settings that avoid the anomalies of both extreme cases. 1.2
Fractional Threshold and Broadcast
The failure model we consider, and that we shall call fractional dynamic faults with threshold or simply fractional threshold model, is a combination of the fractional model with the cumulative model. Both fractional and cumulative models can be described as a game between the algorithm and an adversary: in a time step t, the algorithm tries to send mt messages, and the adversary may destroy up to F (mt ) of them. While in the cumulative model, the dependency function F is a constant function, in fractional model F (mt ) = ⌊αmt ⌋. The dependency function of the fractional threshold model is the maximum of those two: F (mt ) = max{T − 1, ⌊α mt ⌋} where T ≤ c(G) is a constant at most equal to the edge connectivity of the graph, and α is a constant 0 ≤ α < 1. The name “fractional threshold” comes from the fact that it is the fractional model with the additional requirement that the algorithm has to send at least T messages in a time step t in order to have any guarantees about the number of faults. Note that both the cumulative and the fractional models are particular, extreme instances of this model. In fact, α = 0 yields the cumulative setting: at most T − 1 faults occur at each time step. On the other hand, the case T = 1 results in the fractional setting. In between, it defines a spectrum of new settings never explored before, which avoid the anomalies of both extreme cases.
200
S. Dobrev et al.
From this spectrum, the settings that give the maximum power to the adversary, thus making the broadcasting most difficult, are what will be called a simple threshold model defined by T = c(G) and α = 1 − ε with ε infinitely close to 0. In this model, if less than c(G) messages are sent in a step, none of them is guaranteed to arrive (i.e., they all may be lost); on the other hand, if at least c(G) messages are transmitted, at least one message is guaranteed to be delivered. In this paper we start the analysis of fault-tolerant computing in the fractional threshold model, focusing on the simple threshold setting. In this draconian setting the tricks from cumulative and fractional models fail: if the algorithm uses simple flooding the adversary can deliver only one message between the same pair of vertices over and over. If, on the other hand, the algorithm sends too few messages, they all may be lost. 1.3
The Results
The network is represented by a simple graph G of n vertices representing the entities and m edges representing the links. The vertices are anonymous, i.e. they are without distinct IDs. The communication is by means of synchronous message passing (i.e. in globally synchronized communication rounds), local computation is performed between the communication rounds and is considered instantaneous. The communication failures are dynamic omissions in the simple threshold model. We consider the problem of broadcasting: At the beginning, there is a single initiator v containing the information to be disseminated. Upon algorithm termination, all entities must have learned this information. We consider explicit termination, i.e. when the algorithm terminates at an entity, it will not process any more messages (and, in fact, no messages should be arriving anyway). The complexity measure of interest is time (i.e., number of communication rounds). We consider various levels of topological knowledge about the network (knowing network size n, being aware of the network topology, having Sense of Direction or having full topological knowledge). In this paper, we focus on the hardest setting, the simple threshold, where to be guaranteed that at least one message is delivered in a time step, the total amount of transmitted messages in that time step must be at least c(G), i.e. the edge connectivity of the network. By definition, it is sufficient to ensure that c(G) or more messages are transmitted at each time unit to guarantee that at least one of these messages is delivered. The problem however is that an entity does not know which other entities are transmitting at the same time and in general does not know which of its neighbors has already received its messages. Indeed the problem, in spite of synchrony and of the simplicity of its statement, is not simple. We investigate the problem of broadcasting under this model in several classes of graphs as well as in arbitrary networks. We design solution protocols, proving that broadcast is possible even under the worst threshold c(G). We analyze the time costs showing the surprising result that broadcast can be completed in (low) polynomial time for several networks including rings (with or without knowledge
On Fractional Dynamic Faults with Threshold
201
Table 1. Summary of results presented in this paper Topology Condition Time complexity ring n not necessarily known Θ(n) complete graph with chordal sense of direction O(n2 ) complete graph unoriented Ω(n2 ), O(n3 ) hypercube oriented O(n2 log n) hypercube unoriented O(n4 log 2 n) arbitrary network full topological knowledge O(2c(G) nm) no topological knowledge arbitrary network O(2c(G) m2 n) except c(G), n, m
of n), complete graphs (with or without chordal sense of direction), hypercubes (with or without orientation), and constant-degree networks (with or without full topological knowledge). In addition to the upper bounds, we also establish a lower bound in the case of complete graphs without sense of direction. The results are summarized in the Table 1. Due to space constraints some technical parts have been omitted.
2
Ring
The ring is a 2-connected network, i.e. T = c(G) = 2. Hence, at least two messages must be sent in a round to ensure that not all of them are lost. We first present the algorithm assuming the ring size n is known, and then show how it can be extended to the case n unknown. At any moment of time, the vertices can be either informed or uninformed. Since the information is spreading from the single initiator vertex s, informed vertices form a connected component. The initiator splits this component into the left part and the right part. Each informed vertex v can easily determine whether it is on the left part or on the right part of the informed component – this information is delivered in the message that informs the vertex v. Each informed vertex can be further classified as either active or passive. A vertex is active if and only if it has received a message from only one of its neighbor. A passive vertex has received a message from both neighbors. This implies that, as long as the broadcast has not yet finished, there is at least one active vertex in both left and right part of the informed component (the leftmost and the right-most informed vertices must be active; note, however, that also the intermediate vertices might be active). The computation consists of n − 1 phases, with each phase taking four communication rounds. The goal of a phase is to ensure that at least one active vertex becomes passive. Each phase consists of the following four steps: 1. Each active vertex sends a message to its possibly uninformed neighbor. 2. Each active vertex in the right part sends a message to its possibly uninformed neighbor. Each vertex in the left part that received a message in step 1 replies to this message.
202
S. Dobrev et al.
3. Same as step 2, but left and right parts are reversed. 4. Each vertex that received a non-reply message in steps 1–3 replies to that message. To avoid corner cases at the initiator of the broadcast, the initiator is split into two virtual vertices such that each of them starts in active state (i.e. the initiator acts as if it belongs both to the left and to the right part). Lemma 1. At least one reply message passes during the phase. Initially, there are two active (virtual) vertices (the left- and right- part of the initiator). Lemma 1 ensures that during each of the subsequent phases, at least one previously active vertex becomes passive. Since passive vertices never become active again, it follows that after at most n − 1 phases, there are n − 1 passive vertices. Once there are n−1 passive vertices, the remaining two must be informed (both are neighbors of a passive vertex), i.e. n − 1 phases are sufficient to complete the broadcast. Note also that the algorithm does not require distinct IDs or ring orientation (it can compute them, though, as it is initiated by a single vertex). Theorem 1. There is 4(n − 1)-time fault-tolerant broadcasting algorithm for (anonymous, unoriented) rings of known size. If n is unknown, the above algorithm cannot be directly used, as it does not know when to terminate. This is not a serious obstacle, though. Assume that the algorithm is run without a time bound, and each discover message also contains a counter how far is the vertex from the initiator. After at most n phases there will be a vertex v that has received discover messages from both directions. From the counters in those messages v can compute the ring size n. In the second part of the algorithm v broadcasts n (and the time since the start of the second broadcast) using the algorithm for known n; when that broadcast is finished, the whole algorithm terminates. In order to make this work, we have to ensure that there is no interaction between the execution of the first broadcast and the second broadcast. That can be easily accomplished by scheduling the communication steps of the first broadcast in odd time slots and the second broadcast in even time slots. Theorem 2. There is an O(n)-time fault-tolerant broadcasting algorithm for (anonymous, unoriented) rings of unknown size.
3
Complete Graphs
As the connectivity of complete graphs is n − 1, we assume that least n − 1 messages must be sent to ensure that at least one passes through.
On Fractional Dynamic Faults with Threshold
3.1
203
Complete Graphs with Chordal Sense of Direction
Chordal Sense of Direction in a complete graphs means that vertices are numbered 0, 1, . . . , n − 1 and the link from a vertex u to a vertex v is labelled v − u mod n.2 The algorithm consists of two parts. The purpose of the first part is to make sure that at least ⌈n/2⌉ vertices are informed; the second part uses these vertices to inform the remaining ones. The algorithm is executed by informed vertices. Each message contains a time counter, so a newly informed vertex can learn the time and join the computation at the right place. The first part of the algorithm consists of phases 0, 1, . . . , ⌈n/2⌉ − 2. During phase 0 the initiator sends messages to all its neighbors. The goal of phase k is to ensure that there are at least k + 1 informed vertices distinct from the initiator; this ensures that after the first part, there are at least ⌈n/2⌉ informed vertices. Consider a phase k and suppose that there are exactly k informed vertices distinct from the initiator at the beginning of phase k. Let d = n−1 k+1 , and consider k+1 disjoint intervals I0 , . . . , Ik each of size d, consisting of non-initiator vertices. The phase will consist of k + 1 steps. The idea is that during the i-th step, the informed vertices (including initiator) try to inform an additional vertex in the interval Ii by sending messages to all vertices in Ii . If Ii does not contain any informed vertices, and at least one message is delivered, then a new vertex must be informed. The problem is, however, that only d(k +1) messages are sent, which may not be sufficient to guarantee delivery. To remedy this, the i-th step will span over d rounds. In a j-th round, all informed vertices send messages to all vertices in Ii and to the j-th vertex of Ii⊕1 (the addition is taken modulo k + 1). Now, in each step there are (k + 1)(d + 1) messages sent, so at least one must be delivered. Hence we can argue that, during phase k, a new vertex is informed if there is an interval Ii that does not contain any informed vertices, followed by interval Ii⊕1 that contains at least one non-informed vertex. However, the existence of such Ii follows readily from the fact that there are only k informed vertices distinct from initiator and d ≥ 2. Lemma 2. After phase k there are at least k + 1 informed vertices distinct from the initiator. Each phase k consists of k + 1 steps with d rounds each, therefore every phase takes O(n) time steps. Since there are O(n) phases, the first part of the algorithm finishes in O(n2 ) time. The second part of the algorithm starts with at least ⌈n/2⌉ informed vertices and informs all remaining ones. The algorithm is as follows: consider all pairs [i, j] such that 1 ≤ i, j ≤ n − 1, sorted in lexicographic order. In each step, all informed vertices consider one pair and send messages to vertices i and j. Since 2
Strictly speaking, the vertices do not necessarily need to know their ID, the link labels are sufficient: The initiator may assume ID 0 and each message will also carry the link label it travels on and the ID of the sender, allowing the receiver to compute its ID.
204
S. Dobrev et al.
at least 2⌈n/2⌉ ≥ n − 1 messages are sent, at least one of them is delivered. This ensures that a new vertex is informed whenever both i and j were uninformed. In this manner, all but one vertex can be informed (at any moment the two smallest unexplored vertices form a pair that has not been considered yet). To inform the last vertex, all n − 1 informed vertices send in turn messages to vertices 1, 2, . . . , n − 1. Theorem 3. There is a O(n2 ) time fault-tolerant broadcasting algorithm for complete graphs with chordal sense of direction. Proof. The first part consist of ⌈n/2⌉ − 2 phases, with each phase taking O(n) steps. The second part consists of n(n − 1)/2 steps and informing the last vertex takes n − 1 steps. Note that the algorithm did not exploit all properties of the chordal sense of direction, it is sufficient for the informed vertices to agree on the IDs of the vertices, and to be able to determine the ID of the vertex on the other side of a link. Therefore, we get: Corollary 1. There is a O(n2 ) time broadcasting algorithm for complete graphs with neighboring (Abelian group based) sense of direction. 3.2
Unoriented Complete Graphs
The algorithm in the previous section strongly relied on the fact that the vertices know the IDs of the vertices on the other side of the links. In this section, we use very different techniques to develop an algorithm that works for unoriented complete graphs (i.e. the only structural information available is the knowledge that the graph is complete; of course, local orientation – being able to distinguish incident ports – is also required). We will view the flow of messages as tokens traveling through the network (and possibly spawning new tokens). A message (token) arriving to a vertex may cause the vertex to transmit some messages (either immediately, or in some of the subsequent steps). We will view those new messages as child tokens of the parent token. This means the tokens form a tree structure, and each token can be assigned unique identifier (corresponding to a path in the tree structure). Note that each vertex can also be given unique identifier (the ID of the token that first informed it). Each token carries all information about itself and its ancestors (i.e. IDs of its ancestors, traversed vertices and traversed ports). Each token may be of two types: green and red. The intuition is that a token is green if it is “exploring”, i.e. trying to traverse a port that has never been explored by its ancestors. When every port has been explored by the token’s ancestors, the broadcast is finished, and no new tokens are sent. Ideally, if a token arrives to a vertex v, it would be spawned as a green token along all links that have not yet been explored by its ancestors. However, there is usually not enough unexplored ports in v 3 . In this case red tokens are sent along some already explored links. 3
Recall that at least n − 1 messages must be sent in every step to make sure that at least one is delivered.
On Fractional Dynamic Faults with Threshold
205
The meaning is that a red token carries a “request for help” to already explored vertices that are not yet engaged in helping. This request triggers new tokens to be sent from those vertices, and eventually a situation occurs when only green tokens are sent and at least one of them is delivered. Let T be any token. The green ancestor of T is the closest green ancestor of T , if T is red, and T itself, if T is green. The red tail of token T is the path (sequence of tokens) between the green ancestor of T and T itself. Note that all tokens on the red tail are red except the first one. We present a fault-tolerant broadcast algorithm that satisfies the following invariants: I1. Let T be a token that is sent over an oriented edge a, b . If T is green, then it holds that no ancestor of T has been sent over a, b . Conversely, if T is red, there exists some ancestor of T that has been sent over a, b . I2. Let T be a red token. Then the red tail of T contains at most n vertices. I3. Let T be a red token. Then T is sent exactly one round later than the parent of T . I4. Let T be a green token. Then T is sent at most n + 1 rounds later than the last green ancestor of the parent of T . I5. Let T be a green token delivered in round t. If the broadcast is not finished yet, at least one green token is delivered in some of the rounds t + 1, . . . t + n. These invariants imply that the broadcast completes in O(n3 ) time: the invariant I5 ensures that the algorithm can not stop before the broadcast is finished. Consider a path from root to a leaf in the tree of tokens. Invariant I1 ensures that the leaf is green and that there are at most O(n2 ) green tokens on this path. Invariant I4 implies that there are at most n + 1 consecutive red tokens on the path. Hence the overall time of the broadcasting algorithm is O(n3 ). The algorithm works as follows. In the first round of the algorithm, the initiator sends green tokens through all its ports. All these tokens are children of some virtual root token. In each subsequent round t, each vertex gathers all received tokens in this round and processes them in parallel using procedure Process described in Algorithm 1.. If some processor should send more than one token through a port in one round, it (arbitrarily) chooses single one of them to send and discards the remaining ones. Lemma 3. The presented algorithm satisfies invariants I1, I2, . . . , I5. Combining Lemma 3 with the discussion about the invariants we get Theorem 4. There exist a O(n3 ) fault-tolerant broadcasting algorithm for unoriented complete networks. 3.3
Lower Bound for Unoriented Complete Networks
The O(n) algorithm for rings is obviously asymptotically optimal. An interesting question is: How far from optimal are our algorithms for oriented and unoriented complete networks? In this section we show that
206
S. Dobrev et al.
Algorithm 1. Complete graphs without sense of direction 1: procedure Process(T ) // process token T 2: Let P be the set of all ports 3: Let A be the set of ports that have never been traversed by any ancestor of T 4: If A = ∅, the broadcast is finished. 5: Let S be the set of vertices acting as a source of a red token in the red tail of T . 6: Let B ⊆ P − A be the set of ports that lead to a vertex in S. 7: Let C = P − (A ∪ B) // Note that since only ports already traversed by (an ancestor of ) T // are considered, the vertex processing T can indeed compute B and C. 8: 9: 10: 11:
for the first round of processing T do Send new red tokens with parent T to all ports in C Send new green tokens with parent T to all ports in A end for
12: Let l be the length of the red tail of T . 13: for subsequent n − l rounds of processing T do 14: Send new green token with parent T to all ports in A 15: end for 16: end procedure
Theorem 5. Any fault-tolerant broadcasting algorithm on unoriented complete networks must spend Ω(n2 ) time. Proof. In the course of the computation there are two kinds of ports: the ports that have never been traversed by any message in any direction are called “free”, the ports that are not free are called “bound”. The lower bound proof is based on the following simple fact: Let p be a free port of vertex u in time t. Let v be any vertex such that no bound port of u leads to v. Then it is possible that port p leads to vertex v. Indeed, if p would lead to v, the first t rounds of computation would be the same. Hence, the computation can be viewed as a game of two players: the algorithm chooses a set of ports through which messages are to be sent. The adversary chooses one port through which the requested message passes. If this port is free, it chooses also the vertex to which this port will be bound. We show now that it is possible for the adversary to keep the vertex n un= Ω(n2 ) communication rounds. The idea is that some informed for (n−1)(n−2) 2 message has to traverse through all edges between vertices 1 . . . n − 1 before any message arrives to the vertex n. Consider the time step i < (n−1)(n−2) and assume that the vertex n is not 2 informed yet. There exist at most 2i bound ports, since in each time step at most one edge, i.e two ports are bounded. This means that at least (n−1)(n−1)−2i ≥ n ports of vertices 1 . . . n − 1 are free. The following cases can occur:
On Fractional Dynamic Faults with Threshold
207
1. The algorithm sends some message through some bound port. The adversary passes this message, hence the vertex n stays uninformed. 2. The algorithm sends messages only through free ports. (a) The algorithm does not send messages from all vertices 1 . . . n − 1. Then there have to be at least 2 messages sent from one vertex. The adversary delivers one of these messages and binds the corresponding port to any vertex other than n. (Since there are at least two free ports, it is possible for the adversary to do so.) (b) The algorithm sends messages from all vertices 1 . . . n−1. Since at least n ports of vertices 1 . . . n − 1 are free, at least one vertex w from 1 . . . n − 1, has 2 free ports. The adversary delivers the message sent from w, and binds corresponding port to any vertex other than n. (Again, since there are at least two free ports, it is possible for the adversary to do so.) Hence it is possible for the adversary to keep the vertex n uninformed for the first Ω(n2 ) time steps. Now assume a stronger computation model: each vertex immediately learns for any message it has sent whether this message has been delivered or not. It is interesting to note that our lower bound is valid also in this model. Furthermore, it is easy to see that the lower bound is tight in this model.
4
Arbitrary k-Connected Graphs
In this section we consider k-edge-connected graphs and we assume the threshold is k, i.e. at least k messages must be sent to ensure that a message is delivered. 4.1
With Full Topological Knowledge
The algorithm runs in n − 1 phases. Each phase has an initiator vertex u (informed) and a destination vertex v (uninformed), with the source s being the initiator of the first phase. The goal of a phase is to inform vertex v, which then becomes the initiator of the next phase; the process is repeated until all vertices are informed. The basic idea is a generalization of the idea from rings. The ring algorithm tried to “push” the information simultaneously along the left and right part of the ring. Here, the initiator u chooses k edge-disjoint paths4 P = {P1 . . . Pk } from itself to v and then pushes the information through all the paths simultaneously. Let Pi = (u0 = u, u1 , . . . uli = v); consider an oriented edge e = uj , uj+1 . This edge can be either sleeping, active or passive: 1. The edge e is passive if and only if a message has been received over both e and the edge opposite to e, i.e. uj+1 , uj . 4
Since the graph is k-edge-connected and the vertices have full topological knowledge, the initiator can always find these paths.
208
S. Dobrev et al.
2. The edge e is active if and only if it is not passive and a message has been received over the edge uj−1 , uj . In case j = 0 the edge e is active whenever it is not passive. 3. The edge e is sleeping if and only if it is not active nor passive. One phase consists of several rounds, each round spanning over many communication steps. The goal of one round is to ensure that a progress over at least one edge has been made: at least one active edge becomes passive, at least one sleeping edge becomes active or the vertex v becomes informed. The procedure Round() defined in Algorithm 2. is the core of the algorithm; it is performed in each round by every vertex w ∈ P. Algorithm 2. k-connected graphs 1: procedure Round(vertex w) 2: Let A be the set of active edges incident to w at the beginning of the round 3: for i:=0 to k do // One subround: 4: for B ⊆ {1 . . . k} such that |B| = i do // one iteration per time step 5: Let C be the set of edges incident to w via which an activating message 6: has been received in the current round // not in the current time step 7: for e ∈ C do 8: send deactivating message through e // all in one time step 9: end for / B do 10: for e ∈ A such that e ∈ Pz ∧ z ∈ 11: send activating message through e // all in the same time step as in 8 12: end for 13: end for 14: end for 15: end procedure
It is easy to see that the uninformed vertices never send any messages and that at any time each vertex can determine all active edges incident to it. Synchronous communication and full topological knowledge ensure that all procedures (phases/rounds/subrounds) are started and executed simultaneously by all participating vertices. Lemma 4. During one round at least one active edge becomes passive, or a sleeping edge becomes active, or v is informed. Proof. By contradiction. Assume the contrary, we show that in such case, at the beginning of the i-th subround there will be at least i paths P ′ ⊆ P such that on any path Pj ∈ P ′ there is an edge through which an activating message has been delivered in the current round. This would mean that in the k-th subround there are at least k deactivating messages sent and therefore at least one of them will be delivered and an active edge will become passive, a contradiction. We prove that above statement about subrounds by induction on i. The statement trivially holds for i = 0, as there is nothing to prove. Assume (by induction
On Fractional Dynamic Faults with Threshold
209
hypothesis) that at the beginning of the i-th subround there are exactly i paths P ′ with an edge over which an activating message has been delivered in the current round(if there are more, the hypothesis is already true for i + 1). From the definition of an active edge and from construction it follows that unless the vertex v is informed, there is at least one active edge on each path Pj . Let us focus on the time step in the i-th subround when B contains exactly the numbers of paths from P ′ (i.e. B = {j|Pj ∈ P ′ }). In this time step, at least k − i activating and at least i deactivating messages are sent, therefore at least one of them must be delivered. As no activating message is sent over an edge e ∈ P ′ and no deactivating message is delivered (by assumption that no active edge becomes passive), an activating message must be delivered on a path not in P ′ . Hence, the invariant is ensured for the subround i + 1, too. Theorem 6. There is a fault-tolerant broadcasting algorithm on k-connected graphs with full topology knowledge that uses O(2k nm) time, where n is the number of vertices and m is the number of edges in the graph. Proof. The correctness follows straightforwardly from construction and Lemma 4. The time complexity of one round is 2k , as it spends one time step for each subset of {1, 2, . . . , k}. The number of rounds per phase is5 2m, as all paths in P together cannot contain more than all m edges and each edge can change its state at most twice (from sleeping to active to passive). Finally, the number of phases is n − 1 as n − 1 vertices need to be informed. Multiplying we get O(2k mn). Theorem 6 can be successfully applied to many commonly used interconnection topologies. However, better results can usually be obtained by carefully choosing the order in which the vertices should be informed, allowing for short paths in P. One such example is oriented hypercubes (i.e. each link is marked by the dimension it lies in): Theorem 7. There is a fault-tolerant broadcasting algorithm for oriented ddimensional hypercubes that uses O(n2 log n) time, where n = 2d is the number of vertices of the hypercube. Proof. The basic idea is to use the algorithm for k-connected graphs, with the initiator of a phase choosing as the next vertex to inform its successor in (a fixed) Hamiltonian path of the hypercube. The algorithm for one phase is the same as in the case of k-connected graphs with the following exception: it is possible to choose d edge-disjoint paths from vertex u to its neighbor vertex v such that each of these paths has length at most 3. This results in P containing only O(d) edges instead of O(n log n), thus reducing the cost of one phase from O(n2 log n) to O(nd) = O(n log n). The resulting time complexity is therefore O(n2 log n). 5
Some topology-specific optimization is possible here.
210
4.2
S. Dobrev et al.
Without Topological Knowledge
Finally, we show that the broadcasting on a k-connected graph with n vertices and m edges can be performed in time O(2k m2 n) even in the case when the only known information about the graph are the values of n, m, and k. To achieve this, we combine the ideas used for complete graphs with those using full topology knowledge. In particular, the vertices accumulate topology information (using local identifiers) in a fashion similar to the algorithm for complete graphs. The algorithm works in phases, where each phase is performed within one informed component, and uses the topology knowledge of that component. However, since there may be many phases active at the same moment, great care must be given to avoid unwanted interference. The detailed result has been omitted due to space constraints. Applying this result to the case of d-dimensional hypercube without sense of direction yields an algorithm that uses O(n4 log2 n) time.
5
Conclusions
We have introduced a new model for dynamic faults in synchronous distributed systems. This model includes as special cases the existing settings studied in the literature. We have focused on the simple threshold setting where, to be guaranteed that at least one message is delivered in a time step, the total amount of transmitted messages in that time step must be above the threshold T . We have investigated broadcasting in rings and complete graphs, as well as arbitrary networks, and we have designed solution protocols, proving that broadcast is possible also under the worst threshold (i.e., equal to the connectivity). The perhaps surprising result is that the time costs are (low) polynomial for several networks including rings, complete graphs, hypercubes, and constant-degree networks. This investigation is the first step in the analysis of distributed computing in spite of fractional dynamic faults with threshold.
References 1. P. Berman, K. Diks, and A. Pelc, “Reliable broadcasting in logarithmic time with Byzantine link failures”. Journal of Algorithms, 22 (2), 199–211, 1997. 2. T. Chandra, V. Hadzilacos, and S. Toueg, “The weakest failure detector for solving consensus”. Journal of ACM, 43(4), 685–722, 1996. 3. B.S. Chlebus, K. Diks, and A. Pelc, “Broadcasting in synchronous networks with dynamic faults”. Networks 27, 309–318, 1996. 4. G. De Marco and A. Rescigno, “Tighter time bounds on broadcasting in torus networks in presence of dynamic faults”. Parallel Processing Letters 10 (1), 39–50, 2000. 5. G. De Marco and U. Vaccaro, “Broadcasting in hypercubes and star graphs with dynamic faults”. Information Processing Letters 66, 309–318, 1998. 6. S. Dobrev, “Communication-efficient broadcasting in complete networks with dynamic faults”. Theory of Computing Systems 36(6), 695–709, 2003.
On Fractional Dynamic Faults with Threshold
211
7. S. Dobrev, “Computing input multiplicity in anonymous synchronous networks with dynamic faults”. Journal of Discrete Algorithms 2, 425–438, 2004. 8. S. Dobrev and I. Vrt’o, “Optimal broadcasting in hypercubes with dynamic faults”. Information Processing Letters 71, 81–85, 1999. 9. S. Dobrev and I. Vrt’o, “Optimal broadcasting in even tori with dynamic faults”. Parallel Processing Letters 12, 17–22, 2002. 10. S. Dobrev and I. Vrt’o, “Dynamic faults have small effect on broadcasting in hypercubes”. Discrete Applied Mathematics 137(2), 155–158, 2004. 11. M. J. Fischer, N.A. Lynch, and M.S. Paterson, “Impossibility of distributed consensus with one faulty process”, Journal of the ACM 32 (2), 1985. 12. P. Fraigniaud and C. Peyrat, “Broadcasting in a hypercube when some calls fail”, Information Processing Letters 39, 115–119, 1991. 13. R. Kr´ aloviˇc, R. Kr´ aloviˇc, and P. Ruˇziˇcka, “Broadcasting with many faulty links”. In Proc. 10th Colloquium on Structural Information and Communication complexity (SIROCCO’03), 211–222, 2003. 14. Z. Liptak and A. Nickelsen, “Broadcasting in complete networks with dynamic edge faults”, In Proc. 4th International Conference on Principles of Distributed Systems (OPODIS 00), Paris, 123–142, 2000. 15. Tz. Ostromsky and Z. Nedev, “Broadcasting a Message in a Hypercube with Possible Link Faults”. In Parallel and Distributed Processing ’91 (K. Boyanov, editor), Elsevier, 231–240, 1992. 16. A. Pelc and D. Peleg, “Feasibility and complexity of broadcasting with random transmission failures”. In Proc. 24th ACM Symposium on Principles of Distributed Computing (PODC 05), 334–341, 2005. 17. N. Santoro and P. Widmayer, “Time is not a healer”. In Proc. 6th Ann. Symposium on Theoretical Aspects of Computer Science (STACS 89), LNCS 349, 304–313, 1989. 18. N. Santoro and P. Widmayer, “Distributed function evaluation in the presence of transmission faults”. In Proc. International Symposium on Algorithms (SIGAL 90), Tokyo, LNCS 450, 358–367, 1990. 19. N. Santoro and P. Widmayer, “Agreement in synchronous networks with ubiquitous faults”. In Theoretical Computer Science, 2006, to appear; preliminary version in Proc. 12th Colloquium on Structural Information and Communication Complexity (SIROCCO’05), LNCS, 2005.
Discovering Network Topology in the Presence of Byzantine Faults Mikhail Nesterenko1,⋆ and S´ebastien Tixeuil2,⋆⋆ 1
Computer Science Department, Kent State University Kent, OH, 44242, USA [email protected] 2 LRI-CNRS UMR 8623 & INRIA Grand Large Universit´e Paris Sud, France [email protected]
Abstract. We study the problem of Byzantine-robust topology discovery in an arbitrary asynchronous network. We formally state the weak and strong versions of the problem. The weak version requires that either each node discovers the topology of the network or at least one node detects the presence of a faulty node. The strong version requires that each node discovers the topology regardless of faults. We focus on non-cryptographic solutions to these problems. We explore their bounds. We prove that the weak topology discovery problem is solvable only if the connectivity of the network exceeds the number of faults in the system. Similarly, we show that the strong version of the problem is solvable only if the network connectivity is more than twice the number of faults. We present solutions to both versions of the problem. Our solutions match the established graph connectivity bounds. The programs are terminating, they do not require the individual nodes to know either the diameter or the size of the network. The message complexity of both programs is low polynomial with respect to the network size.
1
Introduction
In this paper, we investigate the problem of Byzantine-tolerant distributed topology discovery in an arbitrary network. Each node is only aware of its neighboring peers and it needs to learn the topology of the entire network. Topology discovery is an essential problem in distributed computing (e.g. see [1]). It has direct applicability in practical systems. For example, link-state based routing protocols such as OSPF use topology discovery mechanisms to compute the routing tables. Recently, the problem has come to the fore with the introduction of ad hoc wireless sensor networks, such as Berkeley motes [2], where topology discovery is essential for routing decisions. ⋆
⋆⋆
This author was supported in part by DARPA contract OSU-RF#F33615-01-C-1901 and by NSF CAREER Award 0347485. This author was supported in part by the FNS grants FRAGILE and SR2I from ACI “S´ecurit´e et Informatique”.
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 212–226, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
Discovering Network Topology in the Presence of Byzantine Faults
213
As reliability demands on distributed systems increase, the interest in developing robust topology discovery programs grows. One of the strongest fault models is Byzantine [3]: the faulty node behaves arbitrarily. This model encompasses rich set of fault scenarios. Moreover, Byzantine fault tolerance has security implications, as the behavior of an intruder can be modeled as Byzantine. One approach to deal with Byzantine faults is by enabling the nodes to use cryptographic operations such as digital signatures or certificates. This limits the power of a Byzantine node as a non-faulty node can verify the validity of received topology information and authenticate the sender across multiple hops. However, this option may not be available. For example, wireless sensors may not have the capacity to manipulate digital signatures. Another way to limit the power of a Byzantine process is to assume synchrony: all processes proceed in lock-step. Indeed, if a process is required to send a message with each pulse, a Byzantine process cannot refuse to send a message without being detected. However, the synchrony assumption may be too restrictive for practical systems. Our Contribution. In this study we explore the fundamental properties of topology discovery. We select the weakest practical programming model, establish the limits on the solutions and present the programs matching those limits. Specifically, we consider arbitrary networks of arbitrary topology where up to fixed number of nodes k is faulty. The execution model is asynchronous. We are interested in solutions that do not use cryptographic primitives. The solutions should be terminating and the individual processes should not be aware of the network parameters such as network diameter or its total number of nodes. We state two variants of the topology discovery problem: weak and strong. In the former — either each non-faulty node learns the topology of the network or one of them detects a fault; in the latter — each non-faulty node has to learn the topology of the network regardless of the presence of faults. As negative results we show that any solution to the weak topology discovery problem can not ascertain the presence of an edge between two faulty nodes. Similarly, any solution to the strong variant can not determine the presence of a edge between a pair of nodes at least one of which is faulty. Moreover, the solution to the weak variant requires the network to be at least (k+1)-connected. In case of the strong variant the network must be at least (2k + 1)-connected. The main contribution of this study are the algorithms that solve the two problems: Detector and Explorer. The algorithms match the respective lower bounds. To the best of our knowledge, these are the first asynchronous Byzantine-robust solutions to the topology discovery problem that do not use cryptographic operations. Explorer solves the stronger problem. However, Detector has better message complexity. Detector either determines topology or signals fault in O(δn3 ) messages where δ and n are the maximum neighborhood size and the number of nodes in the system respectively. Explorer finishes in O(n4 ) messages. We extend our algorithms to (a) discover a fixed number of routes instead of complete topology and (b) reliably propagate arbitrary information instead of topological data.
214
M. Nesterenko and S. Tixeuil
Related Work. A number of researchers employ cryptographic operations to counter Byzantine faults. Avromopolus et al [4] consider the problem of secure routing. Therein see the references to other secure routing solutions that rely on cryptography. Perrig et al [5] survey robust routing methods in ad hoc sensor networks. The techniques covered there also assume that the processes are capable of cryptographic operations. A naive approach of solving the topology discovery problem without cryptography would be to use a Byzantine-resilient broadcast [6, 7, 8, 9]: each node advertises its neighborhood. However all existing solutions for arbitrary topology known to us require that the graph topology is a priori known to the nodes. Let us survey the non-cryptography based approaches to Byzantine faulttolerance. Most programs described in the literature [10, 11, 12, 13] assume completely connected networks and can not be easily extended to deal with arbitrary topology. Dolev [7] considers Byzantine agreement on arbitrary graphs. He states that for agreement in the presence of up to k Byzantine nodes, it is necessary and sufficient that the network is (2k + 1)-connected and the number of nodes in the system is at least 3k + 1. However, his solution requires that the nodes are aware of the topology in advance. Also, this solution assumes the synchronous execution model. Recently, the problem of Byzantine-robust reliable broadcast has attracted attention [6, 8, 9]. However, in all cases the topology is assumed to be known. Bhandari and Vaidya [6] and Koo [8] assume two-dimensional grid. Pelc and Peleg [9] consider arbitrary topology but assume that each node knows the exact topology a priori. A notable class of algorithms tolerates Byzantine faults locally [14, 15, 16]. Yet, the emphasis of these algorithms is on containing the fault as close to its source as possible. This is only applicable to the problems where the information from remote nodes is unimportant such as vertex coloring, link coloring or dining philosophers. Thus, local containment approach is not applicable to topology discovery. Masuzawa [17] considers the problem of topology discovery and update. However, Masuzawa is interested in designing a self-stabilizing solution to the problem and thus his fault model is not as general as Byzantine: he considers only transient and crash faults. The rest of the paper is organized as follows. After stating our programming model and notation in Section 2, we formulate the topology discovery problems, as well as state the impossibility results in Section 3. We present Detector and Explorer in Sections 4 and 5 respectively. We discuss the composition of our programs and their extensions in Section 6 and conclude the paper in Section 7.
2
Notation, Definitions and Assumptions
Graphs. A distributed system (or program) consists of a set of processes and a neighbor relation between them. This relation is the system topology. The topology forms a graph G. Denote n and e to be the number of nodes1 and edges in G respectively. Two processes are neighbors if there is an edge in G connecting 1
We use terms process and node interchangeably.
Discovering Network Topology in the Presence of Byzantine Faults
215
them. A set P of neighbors of process p is neighborhood of p. In the sequel we use small letters to denote singleton variables and capital letters to denote sets. In particular, we use a small letter for a process and a matching capital one for this process’ neighborhood. Since the topology is symmetric, if q ∈ P then p ∈ Q. Denote δ to be the maximum number of nodes in a neighborhood. A node-cut of a graph is the set of nodes U such that G \ U is disconnected or trivial. A node-connectivity (or just connectivity) of a graph is the minimum cardinality of a node-cut of this graph. In this paper we make use of the following fact about graph connectivity that follows from Menger’s theorem (see [18]): if a graph is k-connected (where k is some constant) then for every two vertices u and v there exists at least k internally node-disjoint paths connecting u and v in this graph. Program Model. A process contains a set of variables. When it is clear from the context, we refer to a variable var of process p as var.p. Every variable ranges over a fixed domain of values. For each variable, certain values are initial. Each pair of neighbor processes share a pair of special variables called channels. We denote Ch.b.c the channel from process b to process c. Process b is the sender and c is the receiver. The value for a channel variable is chosen from the domain of (potentially infinite) sequences of messages. A state of the program is the assignment of a value to every variable of each process from its corresponding domain. A state is initial if every variable has initial value. Each process contains a set of actions. An action has the form name : guard −→ command. A guard is a boolean predicate over the variables of the process. A command is sequence of assignment and branching statements. A guard may be a receive-statement that accesses the incoming channel. A command may contain a send-statement that modifies the outgoing channel. A parameter is used to define a set of actions as one parameterized action. For example, let j be a parameter ranging over values 2, 5 and 9; then a parameterized action ac.j defines the set of actions ac.(j = 2) [ ] ac.(j = 5) [ ] ac.(j = 9). Either guard or command can contain quantified constructs [19] of the form: (quantif ierbound variables : range : term), where range and term are boolean constructs. Semantics. An action of a process of the program is enabled in a certain state if its guard evaluates to true. An action containing receive-statement is enabled when appropriate message is at the head of the incoming channel. The execution of the command of an action updates variables of the process. The execution of an action containing receive-statement removes the received message from the head of the incoming channel and inserts the value the message contains into the specified variables. The execution of send-statement appends the specified message to the tail of the outgoing message. A computation of the program is a maximal fair sequence of states of the program such that the first state s0 is initial and for each state si the state si+1 is obtained by executing the command of an action whose state is enabled in si . That is, we assume that the action execution is atomic. The maximality of
216
M. Nesterenko and S. Tixeuil
a computation means that the computation is either infinite or it terminates in a state where none of the actions are enabled. The fairness means that if an action is enabled in all but finitely many states of an infinite computation then this action is executed infinitely often. That is, we assume weak fairness of action execution. Notice that we define the receive statement to appear as a standalone guard of an action. This means, that if a message of the appropriate type is at the head of the incoming channel, the receive action is enabled. Due to weak fairness assumption, this leads to fair message receipt assumption: each message in the channel is eventually received. Observe that our definition of a computation considers asynchronous computations. To reason about program behavior we define boolean predicates on program states. A program invariant is a predicate that is true in every initial state of the program and if the predicate holds before the execution of the program action, it also holds afterwards. Notice that by this definition a program invariant holds in each state of every program computation. Faults. Throughout a computation, a process may be either Byzantine (faulty) or non-faulty. A Byzantine process contains an action that assigns to each local variable an arbitrary value from its domain. This action is always enabled. Observe that this allows a faulty node to send arbitrary messages. We assume, however, that messages sent by such node conform to the format specified by the algorithm: each message carries the specified number of values, and the values are drawn from appropriate domains. This assumption is not difficult to implement as message syntax checking logic can be incorporated in receive-action of each process. We assume oral record [3] of message transmission: the receiver can always correctly identify the message sender. The channels are reliable: the messages are delivered in FIFO order and without loss or corruption. Throughout the paper we assume that the maximum number of faults in the system is bounded by some constant k. Graph Exploration. The processes discover the topology of the system by exchanging messages. Each message contains the identifier of the process and its neighborhood. Process p explored process q if p received a message with (q, Q). When it is clear from the context, we omit the mention of p. An explored subgraph of a graph contains only explored processes. A Byzantine process may potentially circulate information about the processes that do not exist in the system altogether. A process is fake if it does not exist in the system, a process is real otherwise.
3
Topology Discovery Problem: Statement and Solution Bounds
Problem Statement Definition 1 (Weak Topology Discovery Problem). A program is a solution to the weak topology discovery problem if each of the program’s computation
Discovering Network Topology in the Presence of Byzantine Faults
217
satisfies the following properties: termination — either all non-faulty processes determine the system topology or at least one process detects a fault; safety — for each non-faulty process, the determined topology is a subset of the actual system topology; validity — the fault is detected only if there are faulty processes in the system. Definition 2 (Strong Topology Discovery Problem). A program is a solution to the strong topology discovery problem if each of the program’s computations satisfies the following properties: termination — all non-faulty processes determine the system topology; safety — the determined topology is a subset of the actual system topology. According to the safety property of both problem definitions each non-faulty process is only required to discover a subset of the actual system topology. However, the desired objective is for each node to discover as much of it as possible. The following definitions capture this idea. A solution to a topology discovery problem is complete if every non-faulty process always discovers the complete topology of the system. A solution to the problem is node-complete if every non-faulty process discovers all nodes of the system. A solution is adjacent-edge complete if every non-faulty node discovers each edge adjacent to at least one non-faulty node. A solution is two-adjacent-edge complete if every non-faulty node discovers each edge adjacent to two non-faulty nodes. Solution Bounds. The proofs for the theorems stated in this section are to be found elsewhere [20]. Theorem 1. There does not exist a complete solution to the weak topology discovery problem. Theorem 2. There exists no node- and adjacent-edge complete solution to the weak topology problem if the connectivity of the graph is lower or equal to the total number of faults k. Observe that for (k + 1)-connected graphs an adjacent-edge complete solution is also node complete. Theorem 3. There does not exist an adjacent-edge complete solution to the strong topology discovery problem. Theorem 4. There exists no node- and two-adjacent-edge complete solution to the strong topology problem if the connectivity of the graph is less than or equal to twice the total number of faults k.
4
Detector
Outline. Detector solves the weak topology discovery problem for system graphs whose connectivity exceeds the number of faulty nodes k. The algorithm leverages the connectivity of the graph. For each pair of nodes, the graph guarantees
218
M. Nesterenko and S. Tixeuil
the presence of at least one path that does not include a faulty node. The topology data travels along every path of the graph. Hence, the process that collects information about another process can find the potential inconsistency between the information that proceeds along the path containing faulty nodes and the path containing only non-faulty ones. Care is taken to detect the fake nodes whose information is introduced by faulty processes. Since the processes do not know the size of the system, a faulty process may potentially introduce an infinite number of fake nodes. However, the graph connectivity assumption is used to detect fake nodes. As faulty processes are the only source of information about fake nodes, all the paths from the real nodes to the fake ones have to contain a faulty node. Yet, the graph connectivity is assumed to be greater than k. If a fake node is ever introduced, one of the non-faulty processes eventually detects a graph with too few paths leading to the fake node. Detailed Description. The program is shown in Figure 1. Each process p stores the identifiers of its immediate neighbors. They are kept in set P . Each process keeps the upper bound k on the number of faulty processes. Process p maintains the following variables. Boolean variable detect indicates if p discovers a fault process p const P : set of neighbor identifiers of p k: integer, upper bound on the number of faulty processes parameter q:P var detect : boolean, initially false, signals fault start : boolean, initially true, controls sending of p’s neighborhood info T OP : set of tuples, initially {(p, P )}, (process ids, neighbor id set) received by p ∗[ init: start −→ start := false, (∀j : j ∈ P : send (p, P ) to j) [] accept: receive (r, R) from q −→ if (∃s, S : (s, S) ∈ T OP : s = r ∧ S = R) ∨ (path number(T OP ∪ {(r, R)}) < k + 1) then detect := true else if (∄s, S : (s, S) ∈ T OP : s = r) then T OP := T OP ∪ {(r, R)}, (∀j : j ∈ P : send (r, R) to j) ] Fig. 1. Process of Detector
Discovering Network Topology in the Presence of Byzantine Faults
219
in the system. Boolean variable start guards the execution of the action that sends p’s neighborhood information to its neighbors. Set T OP (for topology) stores the subgraph explored by p; T OP contains tuples of the form: (process identifier, its neighborhood ). In the initial state, T OP contains (p, P ). Function path number evaluates the topology of the subgraph stored in T OP . Recall that a node u is unexplored by p if for every tuple (s, S) ∈ T OP , s is not the same as u. That is u may appear in S only. We construct graph G′ by adding an edge to every pair of unexplored processes present in T OP . We calculate the value of path number as follows. If the information of T OP is inconsistent, that is: (∃u, v, U, V : ((u, U ) ∈ T OP ) ∧ ((v, V ) ∈ T OP ) : (u ∈ V ) ∧ (v ∈ U )) then path number returns 0. If there is exactly one explored node in T OP , path number returns k + 1. Otherwise the function returns the minimum number of internally node disjoint paths between two explored nodes in G′ . In the correctness proof for this program we show that unless there is a fake node, the path number of G′ is no smaller than the connectivity of G. Processes exchange messages of the form (process identifier, its neighborhood id set ). A process contains two actions: init and accept. Action init starts the propagation of p’s neighborhood throughout the system. Action accept receives the neighborhood data of some process, records it, checks against other data already available for p and possibly further disseminates the data. If the data received from neighbor q about a process r contradicts what p already holds about r in T OP or if the newly arrived information implies that G is less than (k + 1)-connected p indicates that it detected a fault by setting detect to true. Alternatively, if p did not previously have the information about r, p updates T OP and sends the received information to all its neighbors. Theorem 5. Detector is an adjacent-edge complete solution to the weak topology discovery problem in case the connectivity of system topology graph exceeds the number of faults. A correctness proof of the theorem can be found elsewhere [21]. Efficiency Evaluation. Since we consider an asynchronous model, the number of messages a Byzantine process can send in a computation is infinite. To evaluate the efficiency of Detector we assume that each process is familiar with the upper bound on the number of processes in the system and this upper bound is in O(n). A non-faulty process then detects a fault if the number of processes it explores exceeds this bound or if it receives more than one identical message from the same neighbor. We assume that the process stops and does not send or receive any more messages if it detects a fault. In this case we can estimate the number of messages that are received by nonfaulty processes before one of them detects a fault or before the computation terminates. To make the estimation fair, the assume that the unit is log(n) bits.
220
M. Nesterenko and S. Tixeuil
Since it takes that many bits to assign unique process identifiers to n processes, we assume that one identifier is exactly one unit of information. A message in Detector carries up to δ + 1 identifiers, where δ is the maximum number of nodes in the neighborhood of a process. Observe that a process can receive at most n messages from each incoming channel. Thus, the total number of messages that can be sent by Detector is 2en, where e is the number of edges in the graph. The message complexity of the program is in O(2enδ). If e is proportional to n2 , then the complexity of the program is in O(δn3 ).
5
Explorer
Outline. The main idea of Explorer is for each process to collect information about some node’s neighborhood such that the information goes along more than twice as many paths as the maximum number of Byzantine nodes. While the paths are node-disjoint, the information is correct if it comes across the majority of the paths. In this case the recipient is in possession of confirmed information. It turns out that the topology information does not have to come directly from the source. Instead it can come from processes with confirmed information. The detailed description of Explorer follows. To simplify the presentation, we describe and prove correct the version of Explorer that tolerates only one Byzantine fault. We describe how this version can be extended to tolerate multiple faults in the end of the section. Description. Since we first describe the 1-fault tolerant version of Explorer we assume that the graph is 3-connected. The program is shown in Figure 2. Similar to Detector, each process p in Explorer, stores the ids of its immediate neighbors. Process p maintains the variable start, whose function is to guard the execution of the action that initiates the propagation of p’s own neighborhood. Unlike Detector, however, p maintains two sets that store the topology information of the network: uT OP and cT OP . Set uT OP stores the topology data that is unconfirmed; cT OP stores confirmed topology data. Set uT OP contains the tuples of neighborhood information that p received from other nodes. Besides the process id and the set of its neighbor ids, each such tuple contains a set of process identifiers, that relayed the information. We call it visited set. The tuples in cT OP do not require visited set. Processes exchange messages where, along with the neighbor identifiers for a certain process, a visited set is propagated. A process contains two actions: init and accept. The purpose of init is similar to that in the process of Detector. Action accept receives the neighborhood information of some process r, its neighborhood R which was relayed by nodes in set S. The information is received from p’s neighbor — q. First, accept checks if the information about r is already confirmed. If so, the only manipulation is to record the received information in uT OP . Actually, this update of uT OP is not necessary for the correct operation of the program, but it makes the its proof of correctness easier to follow.
Discovering Network Topology in the Presence of Byzantine Faults
221
process p const P , set of neighbor identifiers of p parameter q:P var start : boolean, initially true, controls sending of p’s neighbor ids cT OP : set of tuples, initially {(p, P )}, (process id, neighbor id set) confirmed topology info uT OP : set of tuples, initially ∅, (process id, neighbor id set, visited id set) unconfirmed topology info ∗[ init: start −→ start := false, (∀j : j ∈ P : send (p, P, ∅) to j) [] accept: receive (r, R, S) from q −→ if (∀t, T : (t, T ) ∈ cT OP : t = r) then if (∀t, T, U : (t, T, U ) ∈ uT OP : t = r ∨ T = R) then (∀j : j ∈ P : send (r, R, S ∪ {q}) to j) elsif (∃t, T, U : (t, T, U ) ∈ uT OP : t = r ∧ R = T ∧ ((U ∩ (S ∪ {q}))) ⊂ {r})) then cT OP := cT OP ∪ {(r, R)}, (∀j : j ∈ P : send (r, R, ∅) to j) uT OP := uT OP ∪ {(r, R, S ∪ {q})} ] Fig. 2. Process of Explorer
If the received information does not concern already confirmed process, accept checks if this information differs from what is already recorded in uT OP either in r or in R. In either case the information is broadcast to all neighbors of p. Before broadcasting p appends the sender — q to the visited set S. If the information about r and R has already been received and recorded in uT OP , accept checks if the previously recorded information came along an internally node disjoint path. If so, the information about r is added to cT OP . In this case, this information is also broadcast to all p’s neighbors. Note, however, that p is now sure of the information it received. Hence, the visited set of nodes in the broadcast message is empty. Theorem 6. Explorer is a two-adjacent-edge complete solution to the strong topology discovery problem in case of one fault and the system topology graph is at least 3-connected. A correctness proof of the theorem be found elsewhere [21]. Modification to Handle k > 1 faults. Observe that Explorer confirms the topology information about a node’s neighborhood, when it receives two mes-
222
M. Nesterenko and S. Tixeuil
sages carrying it over internally node disjoint paths. Thus, the program can handle a single Byzantine fault. The explorer can handle k > 1 faults, if it waits until it receives k + 1 messages before it confirms the topology info. All the messages have to travel along internally node disjoint paths. For the correctness of the algorithm, the topology graph has to be (2k + 1)-connected. Proposition 1. Explorer is a two-adjacent-edge complete solution to the strong topology discovery problem in case of k faults and the system topology graph is at least (2k + 1)-connected. Efficiency evaluation. Unlike Detector, Explorer does not quit when a fault is discovered. Thus, the number of messages a faulty node may send is arbitrary large. However, we can estimate the message complexity of Explorer in the absence of faults. Each message carries a process identifier, a neighborhood of this process and a visited set. The number of the identifiers in a neighborhood is no more than δ, and the number of identifiers in the visited set can be as large as n. Hence the message size is bounded by δ + n + 1 which is in O(n). Notice, that for the neighborhood A of each process a, every process broadcasts a message twice: when it first receives the information, and when it confirms it. Thus, the total number of sent messages is 4e · n and the overall message complexity of Explorer if no faults are detected is in O(n4 ).
6
Composition and Extensions
Composing Detector and Explorer . Observe that Detector has better message complexity than Explorer if the neighborhood size is bounded. Hence, if the incidence of faults is low, it is advantageous to run Detector and invoke Explorer only if a fault is detected. We assume that the processes can distinguish between message types of Explorer and Detector. In the combined program, a process running Detector switches to Explorer if it discovers a fault. Other processes follow suit, when they receive their first Explorer messages. They ignore Detector messages henceforth. A Byzantine process may potentially send an Explorer message as well, which leads to the whole system switching to Explorer. Observe that if there are no faults, the system will not invoke Explorer. Thus, the complexity of the combined program in the absence of faults is the same as that of Detector. Notice that even though Detector alone only needs (k +1)-connectivity of the system topology, the combined program requires (2k + 1)-connectivity. Message Termination. We have shown that Detector and Explorer comply with the functional termination properties of the topology discovery problem. That is, all processes eventually discover topology. However, the performance aspect of termination, viz. message termination, is also of interest. Usually an algorithm is said to be message terminating if all its computations contain a finite number of sent messages [22]. However, a Byzantine process may send messages indefinitely. To capture this, we weaken the definition of message termination. We consider a Byzantinetolerant program message terminating if the system eventually arrives at a state
Discovering Network Topology in the Presence of Byzantine Faults
223
where: (a) all channels are empty except for the outgoing channels of a faulty process; (b) all actions in non-faulty processes are disabled except for possibly the receive-actions of the incoming channels from Byzantine processes, these receiveactions do not update the variables of the process. That is, in a terminating program, each non-faulty process starts to eventually discard messages it receives from its Byzantine neighbors. Making Detector terminating is fairly straightforward. As one process detects a fault, the process floods the announcement throughout the system. Since the topology graph for Detector is assumed (k + 1)-connected, every process receives such announcement. As the process learns of the detection, it stops processing or forwarding of the messages. Notice that the initiation of the flood by a Byzantine node itself, only accelerates the termination of Detector as the other processes quickly learn of the faulty node’s existence. The addition of termination to Explorer is more involved. To ensure termination, restrictions have to be placed on message processing and forwarding. However, the restrictions should be delicate as they may compromise the liveness properties of the program. By the design of Explorer, each process may send at most one message about its own neighborhood to its neighbors. Hence, the subsequent messages can be ignored. However, a faulty process may send messages about neighborhoods of other processes. These processes may be real or fake. We discuss these cases separately. Note that each process in Explorer can eventually obtain an estimate of the identities of the processes in the system and disregard fake process information. Indeed, a path to a fake node can only lead through faulty processes. Thus, if a process discovers that there may be at most k internally node disjoint paths between itself and a certain node, this node is fake. Therefore, the process may cease to process messages about the fake node’s neighborhood. Notice, that since the system is (2k+1)-connected, messages about real nodes will always be processed. Therefore, the liveness properties of Explorer are not affected. As to the real processes, they can be either Byzantine or non-faulty. Recall that each non-faulty process of Explorer eventually confirms neighborhoods of all other non-faulty processes. After the neighborhood of a process is confirmed, further messages about it are ignored. The last case is a Byzantine process u sending a message to its correct neighbor v about the neighborhood of another Byzantine process w. By the design of Explorer, v relays the message about w provided that the neighborhood information about w differs from what previously received about w. As we discussed above, eventually v estimates the identities of all real processes in the system. Therefore, there is a finite number of possible different neighborhoods of w that u can create. Hence, eventually they will be exhausted, and v starts ignoring further messages form u about w. Thus, Explorer can be made terminating as well. Other Extensions. Observe that Explorer is designed to disseminate the information about the complete topology to all processes in the system. However, it
224
M. Nesterenko and S. Tixeuil
may be desirable to just establish the routes from all processes in the system to one or a fixed number of distinguished ones. To accomplish this Explorer needs to be modified as follows. No, neighborhood information is propagated. Instead of the visited set, each message carries the propagation path of the message. That is the order of the relays is significant. Only the distinguished processes initiate the message propagation. The other processes only relay the messages. Just as in the original Explorer, a process confirms a path to another process only if it receives 2k + 1 internally node disjoint paths from the source or from other confirming nodes. Again, like in Explorer, such process rebroadcasts the message, but empties the propagation path. In the outcome of this program, for every distinguished process, each nonfaulty process will contain paths to at least 2k + 1 processes that lead to this distinguished node. Out of these paths, at least k + 1 ultimately lead to the distinguished node. In Explorer, for each process the propagation of its neighborhood information is independent of the other neighborhoods. Thus, instead of topology, Explorer can be used for efficient fault-tolerant propagation of arbitrary information from the processes to the rest of the network.
7
Conclusion
In conclusion, we would like to outline a couple of interesting avenues of further research. The existence of Byzantine-robust topology discovery solutions opens the question of theoretical limits of efficiency of such programs. The obvious lower bound on message complexity can be derived as follows. Every process must transmit its neighborhood to the rest of the nodes in the system. Transmitting information to every node requires at least n messages, so the overall message complexity is at least δn2 . If k processes are Byzantine, they may not relay the messages of other nodes. Thus, to ensure that other nodes learn about its neighborhood, each process has to send at least k+1 messages. Thus, the complexity of any Byzantinerobust solution to the topology discovery problem is at least in Ω(δn2 k). Observe that Explorer and Detector may not explicitly identify faulty nodes or the inconsistent view of the their immediate neighborhoods. We believe that this can be accomplished using the technique used by Dolev [7]. In case there are 3k+1 non-faulty processes, they may exchange the topologies they collected to discover the inconsistencies. This approach, may potentially expedite termination of Explorer at the expense of greater message complexity: if a certain Byzantine node is discovered, the other processes may ignore its further messages.
References 1. Spinelli, J.M., Gallager, R.G.: Event-driven topology broadcast without sequence numbers. IEEE trans. on commun. COM-37, 5 (1989) 468–474 2. Hill, J., Culler, D.: Mica: A wireless platform for deeply embedded networks. IEEE Micro 22 (2002) 12–24
Discovering Network Topology in the Presence of Byzantine Faults
225
3. Lamport, L., Shostak, R., Pease, M.: The byzantine generals problem. ACM Transactions on Programming Languages and Systems 4 (1982) 382–401 4. Avramopoulos, I.C., Kobayashi, H., Wang, R., Krishnamurthy, A.: Highly secure and efficient routing. In: Proceedings of INFOCOM: The Conference on Computer Communications, joint conference of the IEEE Computer and Communications Societies, Hong Kong (2004) 5. Perrig, A., Stankovic, J., Wagner, D.: Security in wireless sensor networks. Communications of the ACM 47 (2004) 53–57 6. Bhandari, V., Vaidya, N.H.: On reliable broadcast in a radio network. In: Proceedings of the Twenty-Fourth Annual ACM SIGACT-SIGOPS Symposium on Principles of Distributed Computing (PODC 2005), Las Vegas, Nevada (2005) to appear 7. Dolev, D.: The Byzantine generals strike again. Journal of Algorithms 3 (1982) 14–30 8. Koo, C.Y.: Broadcast in radio networks tolerating byzantine adversarial behavior. In: PODC ’04: Proceedings of the twenty-third annual ACM symposium on Principles of distributed computing, New York, NY, USA, ACM Press (2004) 275–282 9. Pelc, A., Peleg, D.: Broadcasting with locally bounded byzantine faults. Information Processing Letters 93 (2005) 109–115 10. Attiya, H., Welch, J.: Distributed Computing: Fundamentals, Simulations, and Advanced Topics. McGraw-Hill Publishing Company, New York (1998) 6. 11. Malkhi, D., Reiter, M., Rodeh, O., Sella, Y.: Efficient update diffusion in byzantine environments. In: The 20th IEEE Symposium on Reliable Distributed Systems (SRDS ’01), Washington - Brussels - Tokyo, IEEE (2001) 90–98 12. Malkhi, D., Mansour, Y., Reiter, M.K.: Diffusion without false rumors: on propagating updates in a Byzantine environment. Theoretical Computer Science 299 (2003) 289–306 13. Minsky, Y., Schneider, F.B.: Tolerating malicious gossip. Distributed Computing 16 (2003) 49–68 14. Masuzawa, T., Tixeuil, S.: A self-stabilizing link-coloring protocol resilient to unbounded byzantine faults in arbitrary networks. Technical Report 1396, Laboratoire de Recherche en Informatique (2005) 15. Nesterenko, M., Arora, A.: Tolerance to unbounded byzantine faults. In: Proceedings of 21st IEEE Symposium on Reliable Distributed Systems. (2002) 22–29 16. Sakurai, Y., Ooshita, F., Masuzawa, T.: A self-stabilizing link-coloring protocol resilient to byzantine faults in tree networks. In: Proceedings of the 2004 International Conference on Principles of Distributed Systems (OPODIS’2004). Lecture Notes in Computer Science, Springer-Verlag (2004) 17. Masuzawa, T.: A fault-tolerant and self-stabilizing protocol for the topology problem. In: Proceedings of the Second Workshop on Self-Stabilizing Systems. (1995) 1.1–1.15 18. Yellen, J., Gross, J.L.: Graph Theory & Its Applications. CRC Press (1998) ISBN: 0–849–33982–0. 19. Dijkstra, E.W., Scholten, C.S.: Predicate Calculus and Program Semantics. Springer-Verlag, Berlin (1990) 20. Nesterenko, M., Tixeuil, S.: Bounds on topology discovery in the presence of byzantine faults. Technical Report TR-KSU-CS-2006-01, Dept. of Computer Science, Kent State University (2006) http://www.cs.kent.edu/techreps/TR-KSU-CS-200601.pdf.
226
M. Nesterenko and S. Tixeuil
21. Nesterenko, M., Tixeuil, S.: Discovering network topology in the presence of byzantine faults. Technical Report TR-KSU-CS-2005-01, Dept. of Computer Science, Kent State University (2005) http://www.cs.kent.edu/techreps/TR-KSU-CS-200501.pdf. 22. Dijkstra, E., Scholten, C.: Termination detection for diffusing computations. Information Processing Letters 11 (1980) 1–4
Minimum Energy Broadcast and Disk Cover in Grid Wireless Networks⋆ (Extended Abstract) Tiziana Calamoneri2 , Andrea E.F. Clementi1 , Miriam Di Ianni1 , Massimo Lauria2 , Angelo Monti2 , and Riccardo Silvestri2 1
2
Dipartimento di Matematica, Universit` a degli Studi di Roma“Tor Vergata” {clementi, diianni}@mat.uniroma2.it Dipartimento di Informatica, Universit` a degli Studi di Roma “La Sapienza” {calamo, lauria, monti, silver}@di.uniroma1.it Abstract. The Minimum Energy Broadcast problem consists in finding the minimum-energy range assignment for a given set S of n stations of an ad hoc wireless network that allows a source station to perform broadcast operations over S. We prove a nearly tight asymptotical bound on the optimal cost for the Minimum Energy Broadcast problem on square grids. We emphasize that finding tight bounds for this problem restriction is far to be easy: it involves the Gauss’s Circle problem and the Apollonian Circle Packing. We also derive near-tight bounds for the Bounded-Hop version of this problem. Our results imply that the best-known heuristic, the MSTbased one, for the Minimum Energy Broadcast problem is far to achieve optimal solutions (even) on very regular, well-spread instances: its worst√ case approximation ratio is about π and it yields Ω( n) hops. As a by product, we get nearly tight bounds for the Minimum Disk Cover problem and for its restriction in which the allowed disks must have non-constant radius. Finally, we emphasize that our upper bounds are obtained via polynomial time constructions.
1
Introduction
An ad-hoc wireless network consists of a set S of radio stations connected by wireless links. We assume that stations are located on the Euclidean plane. A transmission range is assigned to every station: a range assignment r : S → R determines a directed communication graph G(S, E) where edge (i, j) ∈ E if and only if dist(i, j) ≤ r(i) where dist(i, j) is the Euclidean distance between i and j. In other words, (i, j) ∈ E if and only if j belongs to the disk of radius r(i) centered at i. The transmission range of a station depends on the energy power supplied to the station. In particular, the power Ps required by a station s to transmit data to another station t must satisfy the inequality Ps ≥ 1 dist(s, t)α ⋆
Research partially supported by the EC Project AEOLUS.
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 227–239, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
228
T. Calamoneri et al.
where α ≥ 1 is the distance-power gradient. In the empty space, α = 2 (see [20]): this is the case considered in this paper. Stations of an ad-hoc network cooperate in order to provide specific network connectivity properties by adapting their transmission ranges. A Broadcast Range Assignment (for short Broadcast ) is a range assignment that yields a communication graph G containing a directed spanning tree rooted at a given source station s. A fundamental problem in the design of ad-hoc wireless networks is the Minimum Energy Broadcast Problem (for short Minimum Broadcast): it consists in finding a Broadcast of minimal overall energy power [7, 10, 18]. A range assignment r can be represented by the corresponding family D = {D1 , . . . , Dℓ } of disks, and its overall energy power (i.e. cost(D)) is defined as cost(D) =
ℓ
ri2 where ri is the radius of Di
(1)
i=1
The Minimum Broadcast problem is known to be NP-hard [5] and the bestknown approximation algorithm is the MST-based heuristic [1, 10]. The MSTbased heuristic computes the minimum spanning tree of the complete graph induced by S, then, it assigns a direction to the edges from the source s to the leaves; finally, it assigns to each node i a range equal to the length of the longest edge outgoing from i. This heuristic is efficient and easy to implement, so, its worst-case approximation analysis has been the subject of several works over the last five years. In particular, the first constant upper bound (≃ 40) on the approximation ratio was determined in [5]. A rather sophisticated analysis, recently introduced in [1], yields the tight upper bound 6. The tightness follows from the lower bound proved in [4, 10] by considering unlike input configurations. The worst-case analysis is often not sufficient to evaluate the practical interest of a heuristic. It might be the case that the MST-based heuristic provides nearly optimal solutions for most of natural and practically-relevant instances. Recently, experimental studies have been presented on this issue [11, 6, 10]. 1.1
Our Results
Minimum Broadcast Problem. In this paper, we address the above issue by adopting an analytical approach: we consider Minimum Broadcast and some other related problems on square grids. Square grids have been often considered in wireless networks since they well-model some well-spread, practically relevant ad-hoc network topologies [8, 19, 20]. One can see that the MST-based heuristic, on a square grid of n points (without loss of generality, adjacent points are placed at unit distance), returns, in the worst-case, a solution of cost n − 1. On the other hand, what is the optimal cost on the square grids? One may think that determining this cost is an easy task for so simple instances. On the contrary, this is far to be true: as we will see later, this analysis involves the well-known mathematical Gauss’ Circle problem [15, 17] and the Apollonian Circle Packing [13, 21]. Our first contribution is the following result.
Minimum Energy Broadcast and Disk Cover in Grid Wireless Networks
229
Theorem [Broadcast]. If B ∗ is any optimal Broadcast for the square grid G of n points, then √ √ n n − O( n) ≤ cost(B ∗ ) ≤ 1.01013 + O( n) π π The upper bound is achieved via a polynomial time construction. The above upper bound implies that the MST-based heuristic yields, in the worst-case, a solution cost which is about π times larger than the optimum. Minimum Cover Problem. Any Broadcast yields a (disk) cover of the grid and a communication graph that contains a spanning tree. A cover C of a set S of points is a set of disks C = {D1 , . . . , Dℓ } of radius at least 1, centered at some points of S, that covers all points in S. The cost of C is defined as cost(C) (see Eq. 1). The Minimum Cover problem consists in finding a cover for S of minimum cost. Observe that this is a variant of the well-known NP-hard Minimum Geometric Disk Cover [9, 16]. In general, a cover does not suffice to provide a feasible solution for the Minimum Broadcast problem. A natural question here is whether (or when) the minimum cover cost is asymptotically equivalent to the minimum broadcast cost. This question is formally addressed by determining the cost of a minimum cover for square grids. Theorem [Cover]. If C ∗ is any optimal cover of the square grid G of n points, then √ n/5 ≤ cost(C ∗ ) ≤ n/5 + O( n) The upper bound is achieved via a polynomial time construction. From the above theorems, it turns out that the cost of the cover is significantly lower than the cost of the broadcast. However, next theorem shows that this is not the case when we require that the disks are sufficiently large. Theorem [Large Disk Cover]. Let f (n) = ω(1). The cost of any cover of G with disks of radius at least f (n) is at least nπ − o(n). The upper bound is achieved via a polynomial time construction. We emphasize that there are important network scenarios in which the installing cost (i.e. the cost of installing an omni-directional transmitter at a given location) is rather high and it must be ”amortized” by a relevant use of the antenna. In such cases, it is convenient to assign positive range to a station only if such a range (so, disk) is large enough. Bounded-Hop Broadcast. An important version of the Minimum Broadcast problem is the one in which feasible solutions must guarantee a bounded number of hops: The number of links (i.e. hops) in the path from the source to any other node must be not larger than a fixed bound. This problem version is relevant since the number of hops is closely related to the delay transmission time. The hop restriction finds another application in the context of reliability: Assume that,
230
T. Calamoneri et al.
in a communication network, link faults happen with probability p and that all faults occur independently. Then, the probability that a multi-hop transmission fails exponentially increases with the number of hops. For further motivations in studying bounded hops communication see [2, 12, 14, 22]. A main question here is the following: Does broadcasting with a bounded number of hops require a significantly larger cost than broadcasting with an unbounded number of hops? Intuitively speaking, one might figure out that the right answer is the positive one since the cost is proportional to the area of the solution disks and bounded-hop solutions require larger disks. Observe also that the use of large disks yields large disk overlapping. Rather surprisingly, this is not the case: we derive a broadcast for grids that uses only a constant (i.e. not depending on n) number of disks and thus yields a constant number of hops. This solution has a cost which is very close to that of the unbounded-hops version. Theorem [Broadcast with few Hops]. A positive constant c exists such that it is possible to construct in polynomial time a broadcast B for G with (only) c disks √ (of radius Ω( n)) and such that cost(B) < 1.1171
√ n + O( n). π
By comparing the above theorem with Theorem [Large Disks Cover], we can state that covering and broadcasting over grids have almost asymptotically-equivalent cost when the solution disks have non-constant radius (remind that any broadcast is also a cover). We also remark that the MST-based √ heuristic always returns a solution for the grid that has an unbounded (i.e. Ω( n)) number of hops. So, our almost optimal polynomial-time construction yields bounded-hop solutions whose structure significantly departs from that of the MST-based solutions. Square grids are thus the first family of well-spread, natural instances that perfectly capture the ”hardness” of solving the Minimum Broadcast problem via the MST-based heuristic. It is our opinion that the set of results presented in this paper provides strong theoretical arguments that open new possibilities in the design of an efficient heuristic that significantly improves over the MST-based one (at least) in the case of well-spread and uniform-random instances. 1.2
Preliminaries
We consider a Cartesian coordinates system and a square grid G of side length m − 1 with its bottom left vertex in the origin. G contains n = m2 points at integer coordinates; the coordinates of point P of the grid will be denoted as xp and yp . A G-disk D is a disk centered at any point of the grid and having at least one point of the grid on its boundary. We also denote as D the set of points of grid G covered by D.
Minimum Energy Broadcast and Disk Cover in Grid Wireless Networks
2
231
The Minimum Cover Problem on the Grid
In this section we study two versions of the disk cover problem of the grid G. In the first version, we consider coverings by disks of arbitrary radius, while, in the second one, disks are required to have a minimal non constant radius. For both versions, we need to evaluate the number N (r) of points of the infinite grid covered by a G-disk of radius r. This problem, known as Gauss’ Circle problem, has been extensively studied [15, 17] in order to derive the best exponent δ < 1 such that N (r) ≤ πr2 + crδ for some constant c. However, all these studies are not useful to provide a good bound on c: instead, we need an upper bound on N (r) with a small constant c while the exponent δ can be 1. The proof of next lemma is given in the full version of the paper [3]. √ Lemma 1. For any radius r√≥ 1, it holds that N (r) < πr2 + (π 2 − 2)r + √ √ 1 π 10, it holds that N (r) < πr2 + 2 2r − 5. 5 r + 2 . Moreover, for r > The above lemma is now exploited to prove asymptotically tight lower and upper bounds on the minimum cost of a cover of grid G. Theorem 1. If C ∗ is any minimum cover of the square grid G of n points, then √ n/5 ≤ cost(C ∗ ) ≤ n/5 + O( n) The upper bound is achieved via a polynomial time construction. Proof. We first observe that, for any r > 0, it holds that N (r) ≤ 5r2 .
(2)
√ Indeed, N (1) = 5, N ( 2) = 9, and Lemma 1 implies that N (r) ≤ 5r2 , for any r ≥ 2. Let D1 , D2 , . . . Dt be the G-disks of an optimal cover and let cost∗ be its cost. Let ri be the radius of Di , 1 ≤ i ≤ t. Since Di covers N (ri ) points, Inequality (2) implies that n≤ ∗
and so cost ≥
n 5.
t i=1
N (ri ) ≤
t i=1
5ri2 = 5 · cost∗
√ A cover of G with cost n5 + O( n) is shown in Figure 1 for m = 11. It is easy to see√that the number of grey G-disks (i.e. disks not completely contained in G) is O( n), and the number of white G-disks (i.e. disks completely contained in G) √ is not greater than n5 . Since all G-disks have unit radius, then the cost n5 + O( n) follows. It is easy to check that the above construction can be computed in time polynomial in n. ✷ The cover resulting by the construction in Theorem 1 uses only G-disks of unit radius. Next theorem investigates the cost of covers using only G-disks of large, non constant radius.
232
T. Calamoneri et al.
Fig. 1. An asymptotically optimum disk cover for G with m = 11
Theorem 2. Let f (n) = ω(1). The cost of any cover of G with G-disks of radius at least f (n) is at least nπ − o(n). Proof. Let D1 , D2 , . . . Dt be the G-disks of a cover of G and let cost be its cost. Let ri be the radius of Di , 1 ≤ i ≤ t. As Di covers N (ri ) points, Lemma 1 implies that n
− π π
ri +
Di ∈Y ∩X
∗
Di ∈Y ∩X
N (ri ) − πri 2
Di ∈X
(6)
Minimum Energy Broadcast and Disk Cover in Grid Wireless Networks
+
1 π
Di ∈Y ∩X
Now we bound
1 M (ri ) − N (ri ) + πri 2 − π
Di ∈Y ∩X
235
(N (ri ) − πri 2 )
Di ∈Y ∩X
ri . Consider the sets
Bk = {Dj ∈ Y | 2k−1 ≤ rj < 2k }, 1 ≤ k ≤ l
where l = ⌈log rmax ⌉ + 1 and rmax = max{rj | Dj ∈ Y }. It holds that
Di ∈Y ∩X
ri ≤
ri =
l
k=1 Di ∈Bk
Di ∈Y
ri ≤
l
k=1
1 2k−1
ri 2
(7)
Di ∈Bk
Replace the G-disks in B1 ∪ B2 ∪ . . . Bk by a G-disk with radius (2k+1 ) and centered in the source point. This operation produces a new broadcast with cost ri 2 + (2 · 2k )2 cost∗ − Di ∈B1 ∪B2 ∪...Bk
Hence, from the optimality of the previous broadcast it must be ri 2 ≤ (2 · 2k )2 Di ∈B1 ∪B2 ∪...Bk
From the above inequality and from Inequality (7) we have
Di ∈Y ∩X
ri ≤
l 22k+2
k=1
2k−1
=
l
√ 2k+3 < 2l+4 < 26 rmax = O( n)
(8)
k=1
where the last step follows from the initial assumption that broadcast G-disks have radii less than nπ . It is possible to exhaustively prove that M (r) − N (r) + √ √ √ √ √ πr2 > 0 when r ≤ 10, i.e., r ∈ {1, 2, 2, 5, 8, 3, 10}. Hence, (9) M (ri ) − N (ri ) + πri 2 > 0 Di ∈Y ∩X
√ Moreover, the number of G-disks in Y ∩ X is bounded by constant N ( 10). Thus, (10) N (ri ) − πri 2 = O(1) Di ∈Y ∩X
Finally, by combining Inequality (6) with bounds (8), (9) and (10) we get the thesis. ✷ The construction of optimal Broadcasts for the grid is somewhat connected with the famous problem known as Apollonian Circle Packing [13, 21]. More precisely, we observe that if it were possible to evaluate the cost of the Apollonian Circle Packing of the grid then it would be possible to obtain the optimal bound on the Broadcast cost. We strongly believe that this is the only way to obtain such an optimal bound. The former problem is known to be a hard mathematical problem. In order to get a near-tight bound, we here adopt a simpler construction.
236
T. Calamoneri et al.
Theorem 4. Given any source s ∈ G, it is possible to construct, in polynomial √ time, a Broadcast for G of cost 1.01013 πn + O( n). √ Proof. In order to provide a Broadcast of cost 1.01013 πn + O( n), we assume that m − 1 is a multiple of 6. If this is not the case, we can add O(m) new unit radius G-disks to our construction in order to broadcast to the remaining points.
S
Fig. 2. An almost optimal Broadcast for the grid where m = 19
Consider the Broadcast shown in figure 2. Its cost can be computed by summing up the following three contributions. – A chain of G-disks of radius 1 from the source point to the middle point of G. The cost of this chain is O(m). centered in the middle point of G. This disk – A big G-disk of radius r = m−1 2 has cost r2 = n4 − Θ(m). – A set of G-disks of radius 1 that broadcast to all nodes of G out of the big G-disk. In order to compute the cost of this set, assume that the origin of the Cartesian plane lies in the middle point of G and compute only the cost of the G-disks in the first quadrant, multiplied by 4. Furthermore, observe horizontal chains that the contribution of the first quadrant consists of m−1 6 of unit-radius G-disks whose length depends on their y-coordinates. So the cost of this contribution is: r
r
3
3 −1
4
r− r2 − (3i)2 < r2 − 4 r2 − (3i)2 − 1 < C =4 3 i=0 i=0
2 and power α ≥ d [4]. More precisely, the kissing number is the maximum number of d-spheres (or hyperspheres) of a given radius r that can simultaneously touch a d-sphere of radius r in the d-dimensional Euclidean space [12]. In the 3-dimensional Euclidean space the kissing number is 12 (see Figure 1) but the best known approximation ratio so far is 26 [6].
Fig. 1. The kissing number in the 2- and in the 3-dimensional case. It is given by 6 circles and 12 spheres respectively, simultaneously touching a central one.
In this paper we are interested in investigating more carefully this 3dimensional case. We reduce the gap between upper and lower bound by decreasing the upper bound to roughly 18.8 (the exact obtained ratio is 18.802). Note that the 3-dimensional space better models practical environments since, in real life scenarios, radio stations are distributed over a 3-dimensional Euclidean space. Again the presence of obstacles can be overcome by the increasing of the power of transmission α. The main analysis is based on the study presented in [9] where a 6.33-approximation ratio of the M ST heuristic for the 2-dimensional case was proven. The paper is organised as follows. In the next section, we introduce the M EBR problem with notations and the necessary definitions. In Section 3, we describe the technique that was used in [6] to prove the mentioned upper bound of 26
242
A. Navarra
and we explain how to modify it in order to obtain a tighter bound for the 3-dimensional case. In Section 4, we present our main contribution that leads to the 18.8-approximation ratio. Finally, in Section 5, we give some conclusive remarks and discuss some open questions.
2
Minimum Energy Broadcast Routing
Let us first provide a formal definition of the Minimum Energy Broadcast Routing problem. Given a set of points S in a d-dimensional Euclidean space that represents the set of radio stations, an integer α ≥ 1 and a constant β ∈ IR+ , let Gα (S) be the complete weighted graph obtained as follows. The nodes of Gα (S) represent the points of S and the weight of each edge {x, y} is the power consumption needed for a correct communication between x and y, that is β · (x, y)α . For any subset of stations Q ⊆ S, let Gα (Q) be the subgraph of Gα (S) induced by Q. A range assignment for S is a function r : S → IR+ such that the range r(x) of a station x denotes the maximal distance from x at which signals can be correctly received. The total cost of a range assignment is then cost(r) = β · r(x)α . x∈S
A range assignment r for S yields a directed communication graph Gr = (S, A) such that, for each (x, y) ∈ S 2 , the directed edge (x, y) belongs to A if and only if y is at distance at most r(x) from x. In other words, (x, y) belongs to A if and only if the emission power of x is at least equal to the weight of {x, y} in Gα (S). In order to perform the required M EBR from a given source s ∈ S, Gr must contain a directed spanning tree rooted at s and must have a minimum cost, from now on denoted as m∗α (S, s). One fundamental algorithm, called the M ST heuristic [1], is based on the idea of tuning ranges so as to include a spanning tree of minimum cost. Roughly speaking, the heuristic computes the directed minimum spanning tree from the given source to the leaves. Such a computation is made over the complete weighted graph obtained from the set of nodes in which weights are the power of α of the distances of the endpoints of the edges. For each node, then, the heuristic assigns a power of transmission equal to the weight of the longest outgoing edge. More precisely, let Tα (S) be a minimum spanning tree of Gα (S) and M ST (Gα (S)) its cost. Considering Tα (S) rooted at the source station s, the heuristic directs the edges of Tα (S) toward the leaves and sets the range r(x) of every internal station x of Tα (S) with k children x1 , . . . , xk in such a way that r(x) = β · maxi=1,...,k x, xi α . In other words, r is the range assignment of minimum cost inducing the directed tree derived from Tα (S) and is such that cost(r) ≤ M ST (Gα (S)). Therefore, in order to bound the approximation ratio of the heuristic, it is sufficient to bound the ratio between the cost M ST (Gα (S)) of a minimum spanning tree of Gα (S) and the optimal cost m∗α (S, s).
3-D Minimum Energy Broadcasting
243
Starting from the definition of minimum spanning tree given in [13], in [6] an interesting way to evaluate the cost of the heuristic is provided. For any subset of stations Q ⊆ S, let Gα (Q, r) be the graph obtained by considering only the edges of Gα (Q) of length at most r (that clearly have cost at most βrα ) and let CC(Q, r) be the set of the connected components of Gα (Q, r). Let n(Q, r) = |CC(Q, r)| be the number of connected components in Gα (Q, r) and rmax (Q) be the minimum r such that Gα (Q, r) is connected (i.e. n(Q, rmax ) = 1). Corollary 1. [6] For any subset of stations Q ⊆ S, M ST (Gα (Q)) = αβ
rmax (Q)
(n(Q, r) − 1)rα−1 ∂r.
0
For any set of stations Q let e(Q) = minx∈Q maxy∈Q x, y be the eccentricity of Q. Hence, there exists a station x ∈ Q such that x, y ≤ e(Q) for every other y ∈ Q. Once chosen such a station x, let c(Q) be the sphere of radius e(Q) centered at x. The following general lemma is useful in the estimation of the approximation ratio of the M ST heuristic. Lemma 1. [6] If M ST (Gα (Q)) ≤ ρβe(Q)α for any subset of stations Q ⊆ S, then the M ST heuristic is a ρ-approximation algorithm for the M EBR problem. In the following we will concentrate on the M EBR problem with α = 3 in the 3-dimensional case. Thus, the cost of each edge of the weighted complete graph G3 (S) representing the input network is proportional to the cube of the distance between its endpoints. For ease of notation, for any set of stations Q we will denote G3 (Q) simply as G(Q). Moreover, for the sake of simplicity, without loss of generality we assume β = 1 and e(Q) = 1, as all the results provided under this assumption can be directly extended to the general case [6].
3
Description of the Approach
In this section we firstly describe the general technique presented in [6]. Such a technique leads to the (3d − 1)-approximation ratio of the M ST heuristic for the M EBR problem for any d > 1 and any α ≥ d. In our specific case, that is d = 3, α = 3, the obtained approximation is 26. Secondly, by following the ideas in [9], we describe how to modify the previous technique hence leading to a new and tighter estimation of the upper bound, that is, of roughly 18.8. For the general case the technique was based on a growing process (from now on called basic) in which d-spheres of equal radii centered in the stations of the subset Q are synchronously grown (see for instance Figure 2). The process starts by setting the radius r = 0 and ends when r = rmax2 (Q) ≤ 12 , that is, when G(Q, 2r) becomes connected. This is accomplished by increasing at any infinitesimal step the current radii, all equal to a given r, by ∂r. Starting from the equality established in Corollary 1 on the cost M ST (G(Q)) of any minimum spanning tree of G(Q), the idea was to provide suitable lower
244
A. Navarra
x
x
e(Q) |CC(0)| = 7, r = 0
x
|CC(r2 )| = 5, r =
|CC(r1 )| = 6, r =
r1 2
x
r2 2
e(Q) + |CC(rmax )| = 1, r =
rmax 2
rmax 2
Fig. 2. The growing process of circles around the radio stations of the set Q in the 2-dimensional case
and upper bounds on the overall volume covered by the union of all the d-spheres at the end of the described process. In [6] the bound M ST (G(Q)) ≤ 3d − 1 was proven, that by Lemma 1 implies the 26-approximability of the M ST heuristic in the 3-dimensional case. Note that the lower bound is instead 12 and it is given by the kissing number [4, 12]. We now show how to improve the 26-approximation ratio by means of a new technique. The new analysis is based on the method presented in [9] where the 2-dimensional case was considered. The idea is to slightly change the shapes that are grown around stations at each infinitesimal step of the previously described basic growing process. More precisely, being in the 3-dimensional case we consider c(Q) as the spherical place inside which the radio stations are thrown uniformly at random. While before each station was wrapped by a sphere, now things remain the same inside c(Q), but the volume is thinned when growing outside c(Q). Informally speaking, this allows to maintain the lower bound on the covered volume at the end of the growing process. On the other hand, the upper bound decreases since all the volume can be now included in a smaller sphere with respect to [6], thus improving the bound on the cost of the returned solution. For the sake of clarity from now on we often drop Q from the notation, thus for instance writing G, G(r), CC(r), n(r) and rmax instead of G(Q), G(Q, r), CC(Q, r), n(Q, r) and rmax (Q), respectively. In order to better explain the new reshaping technique we describe it in two phases. For any given radius r, the shape of radius r associated to a given
3-D Minimum Energy Broadcasting
245
h(r,d)
r y d
θ
x
x
Fig. 3. Section of the new associated growing shape to each radio station
station y inside c(Q) having distance d from the central station x is such that its intersection with c(Q) coincides with the circular intersection of c(Q) with a sphere of radius r centered at y. In other words, the intersection with c(Q) of the new shape coincides with the basic shape given by the sphere of [6]. Outside c(Q), the remaining portion of the sphere of radius r, if any, is reshaped as a kind of cylinder of suitable height h(r, d) wrapping the outside spherical surface of c(Q). In Figure 3 it is showed a cut section of the sphere c(Q) centered at x and of the new shape. The height h(r, d) is evaluated in such a way that its volume coincides with the volume of the corresponding portion of the basic shape outside c(Q). This implies that the total volume remains 43 πr3 . With θ(r, d) we identify a conic angle obtained by connecting the center x with the circular intersection of the shape with c(Q) (see Figure 3). At each infinitesimal step in which the radius r grows by ∂r, given any function g depending on r, we denote by ∂g(r) = g(r+∂r)−g(r) the infinitesimal variation of g(r). At each infinitesimal step, while the growth of the spherical part inside c(Q) is the same as in the basic case, the angle θ(r, d) of the outside part augments by a given quantity ∂θ(r, d). This is done according to the intersection of the increased sphere of radius r+∂r with c(Q). About the height h(r, d), it augments by ∂h(r, d) in such a way that the total volume added to the shape is 4πr2 ∂r as in the basic case. Clearly, two shapes corresponding to a given radius r overlap if and only if the corresponding centers are at distance at most 2r, as in the basic case. Starting from the observation that the shapes never meet at the circular intersections with the spherical surface of c(Q),1 it is possible to slightly enlarge the outside part of each shape. This introduces the second phase of our shape modification by which enlarging the shape outside c(Q) decreases its height. This must be done by increasing the angles θ(r, d) without violating the constraint that two shapes never meet outside c(Q) before they meet inside. This allows to decrease the maximum 1
The only exception is given when such intersections are subtended by the biggest section of the current sphere that they represent. To better explain this concept, in the 2-dimensional Euclidean space, this happen when the intersections are the endpoints of the diameter of the corresponding growing circle.
246
A. Navarra
c(z,r) with z inside c(Q)
c(z,r) with z along the circumference of c(Q) z’1 y1
z1
z1
z’1 y1
z z y2 z’2
y2
z2 X
z2
z’2
Fig. 4. Section of the new shape given by the increase of the angle θ by the black portions, yielding the new angle θ′ and the decrease of the height from the dotted lines to the bold ones
height of the outside part of the shapes, thus yielding a further improvement on the approximation ratio. In other words the new shape will be larger but lower and it is defined as follows. Consider any point z inside c(Q). Let c(z, r) be the sphere of radius r centered at z and let I(z, r) be the circular intersection of c(z, r) with the spherical surface of c(Q). Consider the sphere c(z ′ , r′ ) centered on the border of c(Q) and having the same intersection with the spherical surface of c(Q), i.e., I(z, r) ≡ I(z ′ , r′ ). The conic angle associated to z is now defined by the vertex x and the cone tangent to c(z ′ , r′ ) (see the cut section of the conic angle in the right of Figure 4). Note that, in the case in which z lies on the spherical surface of c(Q), c(z, r) and c(z ′ , r′ ) coincide (see the cut section of the new conic angle on the left of Figure 4). Indeed their angle does not, since, as already described, it is given by the tangent cone to the internal spherical shape and not, as before, by the cone wrapping the intersection with the surface of c(Q). When two new shapes are centered along the spherical surface of c(Q) at distance 2r, by construction, they meet outside at the same moment they meet inside, that is, when the radius grows till r. If we move one or both the corresponding centers more inside c(Q) and leaving their distance at 2r, the corresponding reshaped outside volumes remain disjoint.
4
18.8-Approximation Analysis of the M ST Heuristic
In this section we formalise what was previously described. We provide a set of lemmata that describe a corresponding set of properties of the defined new shape that are useful in order to prove the 18.8-approximation claimed in the concluding theorem. The new shape must guarantee some properties that were true by means of the standard sphere. One of those properties is that two shapes growing according to a given radius r, touch each other only when the corre-
3-D Minimum Energy Broadcasting
247
sponding centers are at distance at most 2r. Note that this is the fundamental property without which Corollary 1 cannot be applied for the estimation of the cost of the M ST heuristic. Lemma 2. Given any subset of stations Q ⊆ S, for any r < rmax 2 , two shapes overlap if and only if the corresponding points are at distance at most 2r. Proof. If two shapes meet inside c(Q), the property easily holds since the shape has the same behavior of spheres. In order to prove the claim we have to show that two shape never meet outside if they do not meet inside also. By construction, the external part of a shape is more extended (in terms of occupancy of the outer spherical surface) when the center resides along the spherical surface of c(Q). In such a case, if two shapes touch each other, they do exactly at their intersection with the spherical surface of c(Q) (see Figure 4). If one them has the center more inside, its growing outside part is less extended hence it cannot touch any other outer part of another shape. ✷ The following two lemmata consider more carefully the structure of the new shape by considering the conic angle and the outside growing height, respectively. About the angle, it is proven that the more a station, whose associated shape grows also outside, is closer to x, the more its angle grows at each infinitesimal step. and any Lemma 3. Given any subset of stations Q ⊆ S, for any r < rmax 2 d1 ≤ 1 and d2 ≤ 1 such that 1 − r ≤ d1 ≤ d2 , ∂θ(r, d1 ) ≥ ∂θ(r, d2 ). The following lemma, instead, proves that the further a station is from x, the more its height outside c(Q) grows. Moreover it gives also a very useful lower bound to the infinitesimal growth of the height and its maximum extension. The new shape, in fact, grows in height, outside c(Q) as at least 35 the growth of the basic shape at any infinitesimal step. This guarantees that the growth of such a shape is quite uniform during the whole process hence it is still suitable for bounding the M ST heuristic cost. Moreover the maximal height outside c(Q) is bounded by .3527 hence decreasing the maximal extension of the basic shape that was of .5. and any Lemma 4. Given any subset of stations Q ⊆ S, for any r < rmax 2 d1 ≤ 1 and d2 ≤ 1 such that 1 − r ≤ d1 ≤ d2 , h(r, d1 ) ≤ h(r, d2 ). Moreover for any d ≤ 1, h(r, d) ≤ .3527... and ∂h(r, d) ≥ 35 ∂r. Note that Lemma 3 and Lemma 4 follow directly from the corresponding lemmata of the 2-dimensional case [9]. In order to better understand this, it is sufficient to consider the new shape as the 2-dimensional one rotated along the line passing through its center and the center of c(Q) (see Figure 5). In this way it is clear that what was true about the angle of the 2-dimensional case is now straightforward for the new conic angle θ (Lemma 3). And the same happens for the height h that remains unchanged (Lemma 4). With the last lemma we ensure that the new shape guarantees an infinitesimal growth, for each connected component equal to at least the same growth of one
248
A. Navarra
Fig. 5. The new shape obtained by means of a rotation of the 2-dimensional one along the line passing through its center and the center of c(Q)
sphere for each component. This was straightforward in the general case of dspheres while it is quite complicated both in the 2- and the 3-dimensional case for the modified shapes. Lemma 5. The infinitesimal growth of the volume v(P, r) of the region P (r) covered by the shapes of a connected component P ∈ CC(2r) of G(2r) is ∂v(P, r) ≥ 4πr2 ∂r. Proof. (Sketch) If P contains just one station, then, by construction, the claim clearly holds. In fact, if the growth of the shape associated to such a station does not concern outside c(Q) then it coincides with a growing sphere. Since the spherical surface is given by 4πr2 , the infinitesimal growth is ∂v(P, r) = 4πr2 ∂r. In the case the growth of the shape associated to the considered station goes outside c(Q), then, by construction, the new shape is made in such a way that inside c(Q) things do not change. Outside, the volume is maintained equal to the spherical case at every infinitesimal step, hence its growing too. When P contains more than one station, intuitively things can just go better, i.e., the growth of the union of the associated shapes is at least the growth of one sphere. This is given by the fact that both inside and outside c(Q) when two shapes join in one connected component, their physical extension contains the shape
3-D Minimum Energy Broadcasting
249
corresponding to just one station. This suggest that at any infinitesimal step, its growth is bigger than the sphere. ✷ From all the above lemmata we can finally obtain the following theorem. Theorem 1. In the 3-dimensional Euclidean space the M ST heuristic is a 18.8approximation algorithm for the M EBR problem. Proof. It is enough to prove that for any subset of stations Q ⊆ S, M ST (G(Q)) < 18.8. The claim then follows by Lemma 1. Exploiting Lemma 5, we can easily provide a lower bound for the total region of the space covered by rmax the union of all the shapes related to Q of radius rmax 2 , that is v(Q, 2 ), the covered volume at the end of the described growing process. In fact, recalling r (Q) that by Corollary 1 M ST (G(Q)) = 3 0 max (n(Q, r) − 1)r2 ∂r, r rmax 2 max v Q, = 2 0
P ∈CC(2r)
∂v(P, r)∂r ≥
rmax 2
n(2r)4πr2 ∂r =
0
rmax rmax 1 1 (n(r) − 1)r2 ∂r + π r2 ∂r = π 2 0 2 0 0 π 3 π = M ST (G) + rmax . 6 6 Moreover, by Lemma 4, v(Q, rmax 2 ) is included in a sphere of radius 1 + rmax rmax 4 3 h( 2 , 1) centered at the station x. Therefore, v(Q, rmax 2 ) ≤ 3 π(1+h( 2 , 1)) , so that r 3 4 r π 3 π max max M ST (G) + rmax ,1 ≤ π 1+h , ≤ v Q, 6 6 2 3 2 =
1 4π 8
rmax
n(r)r2 ∂r =
hence,
r 3 max 3 M ST (G) ≤ 8 1 + h ,1 − rmax . 2 Standard maximization argument obtained for rmax ranging from 0 to 1 shows 3 3 that the quantity 8(1 + h( rmax 2 , 1)) − rmax is maximised for rmax = 1, and since by Lemma 4, h(r, d) ≤ .3527..., it finally results 3 1 M ST (G) ≤ 8 1 + h ,1 − 1 < 18.802. 2
5
✷
Conclusion
In this paper we have investigated the Minimum Energy Broadcast Routing problem in the 3-dimensional Euclidean space. We have improved the previous known upper bound on the approximation ratio of the M ST heuristic from 26 to 18.8, considerably decreasing the gap with the lower bound of 12 [4]. It is worth noting that, according to the considered method, such a new bound is not tight in
250
A. Navarra
terms of the associated volume outside c(Q) as it was in the 2-dimensional case. Let us consider, in fact, the instance of the lower bound obtained by thirteen stations distributed like the centers of the spheres of the kissing number, i.e., everyone at distance at least rmax = 1 from each other inside c(Q). The resulting associated volume of the new shapes does not fulfil neither c(Q) as it was for the 2-dimensional case, nor the external volume in between the two spheres of radii 1 and 1 + hmax ≈ 1.3527 respectively, see Figure 6. Assuming the lower bound of 12 as the real bound of the M ST heuristic in the 3-dimensional Euclidean space, the loss of 6.8 with respect to it must be found then in those “holes” inside and outside c(Q), that is, the shaded volumes of Figure 6.
1 + hmax 1
Fig. 6. On the right, a cut section of the lower bound case with the associated shapes. Shaded areas represent the mentioned holes inside the sphere c(Q) of radius 1. On the left, a squeesed representation of what happens outside c(Q). Again the shaded surfaces represent the mentioned holes outside c(Q).
An interesting issue for a future work is of trying to apply the arguments of [5] in this 3-dimensional case and check whether they lead to anything better than the obtained 18.8 bound. The 3-D Delaunay triangulation is something known [14, 15] but it is not clear if the 2-dimensional arguments of [5] can be directly extended to the 3-dimensional case. Another interesting case in the 3-dimensional environment is given for 2 ≤ α < d. Since it can happen in practical application that the presence of obstacles can be both in contrast and in favor of communications, it depends on the desired directions. In the former case the given solution for the free 3-dimensional case is still valid since it is enough to suitably increase the value of α. In the latter, things become harder. In this case, in fact, it is not clear what the best solution may be. Moreover, the 18.8-approximation ratio does not hold for values of α smaller than d. As last remark, from the experimental point of view, no results are known concerning the 3-dimensional case. All the experimental papers and the proposed heuristics start to investigate the 2-dimensional case (see for instance [16, 17, 18]). Is there any property not already captured that may lead to a better heuristic
3-D Minimum Energy Broadcasting
251
in the 3-dimensional case? In [7, 19], for instance, nice approaches to better understand the behavior of the M ST heuristic in the 2-dimensional case are provided. The experiments have shown how good is the heuristic when applied on practical instances, like the high-density ones. It may be of deep interest to investigate in this direction for the 3-dimensional case as well.
References 1. Wieselthier, J.E., Nguyen, G.D., Ephremides, A.: On the construction of energyefficient broadcast and multicast trees in wireless networks. In: Proceedings of the 19th Annual Joint Conference of the IEEE Computer and Communications Societies (INFOCOM), IEEE Computer Society (2000) 585–594 2. Caragiannis, I., Kaklamanis, C., Kanellopoulos, P.: New results for energy-efficient broadcasting in wireless networks. In: Proceedings of the 13th International Symposium on Algorithms and Computation (ISAAC), Springer-Verlag (2002) 332–343 3. Clementi, A.E.F., Ianni, M.D., Silvestri, R.: The minimum broadcast range assignment problem on linear multi-hop wireless networks. Theoretical Computer Science 299(1-3) (2003) 751–761 4. Clementi, A., Crescenzi, P., Penna, P., Rossi, G., Vocca, P.: On the complexity of computing minimum energy consumption broadcast subgraph. In: Proceedings of the 18th Annual Symposium on Theoretical Aspects of Computer Science (STACS). Volume 2010 of Lecture Notes in Computer Science., Springer-Verlag (2001) 121–131 5. Ambuehl, C.: An optimal bound for the mst algorithm to compute energy efficient broadcast trees in wireless networks. In: Proceedings of the 32nd International Colloquium on Automata, Languages and Programming (ICALP). Volume 3580 of Lecture Notes in Computer Science., Springer Verlag (2005) 1139–1150 6. Flammini, M., Klasing, R., Navarra, A., Perennes, S.: Improved approximation results for the Minimum Energy Broadcasting Problem. In: Proceedings of ACM Joint Workshop on Foundations of Mobile Computing (DIALM-POMC). (2004) 85–91. To appear on the associated Special Issue of Algorithmica. 7. Flammini, M., Navarra, A., Perennes, S.: The “Real” approximation factor of the MST heuristic for the Minimum Energy Broadcasting. In: Proceedings of the 4th International Workshop on Efficient and Experimental Algorithms (WEA). Volume 3503 of Lecture Notes in Computer Science., Springer Verlag (2005) 22–31. To appear on the associated Special Issue of Journal of Experimental Algorithmics. 8. Klasing, R., Navarra, A., Papadopoulos, A., Perennes, S.: Adaptive Broadcast Consumption (ABC), a new heuristic and new bounds for the minimum energy broadcast routing problem. In: Proceedings of the 3rd IFIP-TC6 International Networking Conference. Volume 3042 of Lecture Notes in Computer Science., Springer Verlag (2004) 866–877 9. Navarra, A.: Tighter bounds for the Minimum Energy Broadcasting problem. In: Proceedings of the 3rd International Symposium on Modeling and Optimization in Mobile, Ad Hoc and Wireless Networks (WiOpt). (2005) 313–322 10. Wan, P.J., Calinescu, G., Li, X., Frieder, O.: Minimum energy broadcasting in static ad hoc wireless networks. Wireless Networks 8(6) (2002) 607–617 11. Liang, W.: Constructing minimum-energy broadcast trees in wireless ad hoc networks. In: Proceedings of the 3rd ACM international symposium on Mobile ad hoc networking and computing (MOBIHOC). (2002) 112–122
252
A. Navarra
12. Conway, J.H., Sloane, N.J.A.: ”The Kissing Number Problem” and ”Bounds on Kissing Numbers”. Ch. 2.1 and Ch. 13 in: Sphere Packings, Lattices, and Groups. Springer-Verlag, New York (3rd edition, 1998) 13. Frieze, A.M., McDiarmid, C.J.H.: On Random Minimum Length Spanning Trees. Combinatorica 9 (1989) 363–374 14. Attali, D., Boissonnat, J.D.: A linear bound on the complexity of the delaunay triangulation of points on polyhedral surfaces. In: Proceedings of the 7th ACM symposium on Solid modeling and applications (SMA). (2002) 139–146 15. Fang, T.P., Piegl, L.A.: Delaunay triangulation in three dimensions. IEEE Computer Graphics and Applications 15(5) (1995) 62–69 16. Athanassopoulos, S., Caragiannis, I., Kaklamanis, C., Kanellopoulos, P.: Experimental Comparison of Algorithms for Energy-Efficient Multicasting in Ad Hoc Networks. In: Proceedings of the 3rd International Conference on Ad-Hoc Networks and Wireless (ADHOC-NOW). Volume 3158 of Lecture Notes in Computer Science., Springer Verlag (2004) 183–196 17. Penna, P., Ventre, C.: Energy-efficient broadcasting in ad-hoc networks: combining msts with shortest-path trees. In: Proceedings of the 1st ACM International Workshop on Performance Evaluation of Wireless, Ad Hoc, Sensor and Ubiquitous Networks (PE-WASUN). (2004) 61–68 18. Yuan, D.: Computing Optimal or Near-Optimal Trees for Minimum-Energy Broadcasting in Wireless Networks. In: Proceedings of the 3rd International Symposium on Modeling and Optimization in Mobile, Ad Hoc and Wireless Networks (WiOpt). (2005) 323–331 19. Clementi, A., Huiban, G., Penna, P., Rossi, G., Verhoeven, Y.C.: On the approximation ratio of the mst-based heuristic for the energy-efficient broadcast problem in static ad-hoc radio networks. In: Proceedings of the 3rd IEEE IPDPS Workshop on Wireless, Mobile and Ad Hoc Networks (WMAN). (2003) 222
Average-Time Complexity of Gossiping in Radio Networks Bogdan S. Chlebus1,⋆ , Dariusz R. Kowalski2, and Mariusz A. Rokicki1,⋆ 1 2
Department of Computer Science and Eng., UCDHSC, Denver, CO 80217, USA Department of Computer Science, University of Liverpool, Liverpool L69 7ZF, UK
Abstract. Radio networks model wireless synchronous communication with only one wave frequency used for transmissions. In the problem of many-to-all (M2A) communication, some nodes hold input rumors, and the goal is to have all nodes learn all the rumors. We study the average time complexity of distributed many-to-all communication by deterministic protocols in directed networks under two scenarios: of combined messages, in which all input rumors can be sent in one packet, and of separate messages, in which every rumor requires a separate packet to be transmitted. Let n denote the size of a network and k be the number of nodes activated with rumors; the case when k = n is called gossiping. We give a gossiping protocol for combined messages that works in the average time O(n/ log n), which is shown to be optimal. For the general M2A communication problem, we show that it can be performed in the average time O(min{k log(n/k), n/ log n}) with combined messages, and that Ω(k/ log n + log n) is a lower bound. We give a gossiping protocol for separate messages that works in the average time O(n log n), which is shown to be optimal. For the general M2A communication problem, we develop a protocol for separate messages with the average time O(k log(n/k) log n), and show that Ω(k log n) is a lower bound.
1
Introduction
Packet radio networks are a class of wireless networks in which only one wave frequency is used for communication. The restricted bandwidth results in a conflict when different messages arrive simultaneously at a node. The main challenge, in developing communication protocols for such networks, is in resolving local conflicts for access to the limited bandwidth. The networks we consider are directed, which captures a scenario in which a possibility of a direct transmission from node x to node y does not necessarily make it possible for node y to transmit directly to node x. Networks are ad-hoc, in that protocols do not rely on the knowledge of the topology; the only information about the network that may be a part of code of a protocol is the size n, which is the number of nodes. We consider deterministic distributed communication protocols. Initially, some k among the nodes are simultaneously activated with input data; these data are called rumors. The communication task is to make ⋆
The work of this author is supported by the NSF Grant 0310503.
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 253–267, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
254
B.S. Chlebus, D.R. Kowalski, and M.A. Rokicki
all the nodes in the network learn all the input rumors. This communication task can be called many-to-all communication (M2A). The special case in which k = n is called gossiping. The underlying network is assumed to be strongly connected, so that gossiping is always possible to achieve. Nodes exchange packets carrying rumors. A node sends at most one packet per round. In the model of combined messages, a packet can carry all the rumors. In such a setting, it is natural to have a node send all the rumors learned so far in any transmitted packet. In the model of separate messages, a packet can carry only one rumor. With such a restriction, a protocol needs to rely on a mechanism to prioritize rumors so that a node sends a rumor of the highest current priority at a round. The time of an execution of a protocol is defined to be the first round when the communication goal has been achieved. Such a completion of the communication task is not required to be known by the nodes. The complexity measure we investigate is the average time as a function of the size n of the network. To find the average time for size n, first compute conceptually the durations of executions of the protocol on all strongly connected networks of size n, and next take the average of the times accrued for these networks. Our results. We give upper and lower bounds on the average-case complexity of gossiping and many-to-all communication. Protocols are distributed and designed for both the models of combined and separate messages. Let n denote the size of a network and k the number of nodes activated with rumors. The summary of the contributions is as follows. I. Gossiping with combined messages can be performed in the average time O(n/ log n), which is shown to be optimal. II. We show that M2A communication can be performed in the average time O(min{k log(n/k), n/ log n}) with combined messages and that Ω(k/ log n + log n) is a lower bound. III. Gossiping with separate messages can be performed in the average time O(n log n), which is shown to be optimal. IV. M2A communication can be achieved in the average time O(k log(n/k) log n) with separate messages. We show a lower bound Ω(k log n). Previous work. Broadcasting in radio networks with topology modeled by [12], who showed that random graphs was considered by Els¨ asser and Gasieniec ֒ O(log n) expected time was optimum for distributed protocols. This result can be interpreted as giving the optimum average-time complexity of broadcasting. The authors of this paper do not know of any other results related to the average-time complexity of communication in radio networks. A many-to-many communication problem in radio networks, similar to what Kranakis, Pelc and Xin [13]. The problem we consider, was studied by Gasieniec, ֒ is defined as follows: There is a set S of k nodes initialized with rumors and every one among these nodes needs to get to know all the rumors. Networks are undirected, each node knows the topology of the network but does not know the set S, the maximum distance d among any pair of nodes in S is an additional
Average-Time Complexity of Gossiping in Radio Networks
255
parameter. A protocol solving this problem of time complexity O(d log2 n + k log3 n) was given in [13]. Related work. The model of multi-hop radio networks was introduced by Chlamtac and Kutten [4] who considered sequential algorithms to find an efficient broadcast protocol for a given input network. The first distributed randomized broadcast protocols of sub-quadratic expected-time performance were given by Bar-Yehuda, Goldreich and Itai [2]. The first distributed deterministic explicit broadcast protocol with sub-quadratic time performance was given by Chlebus, Gibbons, Pelc and Rytter [5]. Alon, Bar-Noy, Linial and Peleg [1] Gasieniec, ֒ showed that there exists a bipartite graph of n nodes for which any broadcasting protocol requires time Ω(log2 n) . The fastest known deterministic distributed broadcasting protocol was given by Czumaj and Rytter [10], who showed that it works in time O(n log2 D), where D is the diameter of the network. Gossiping was initially studied for the model of combined messages. The first distributed protocol of sub-quadratic time complexity was given by Chrobak, and Rytter [8]. The fastest known distributed deterministic protocol Gasieniec ֒ works in time O(n4/3 log4 n); it was given by Gasieniec, Radzik and Xin [14]. ֒ The best randomized protocol operates in the expected time O(n log2 n), it was given by Czumaj and Rytter [10]. Oblivious gossiping was first studied by Chlebus, Gasieniec, Lingas, and ֒ Pagourtzis [6]. The paper gave a deterministic gossiping protocol that works in time O(n3/2 ) on undirected networks; this was shown to be optimal by Kowalski and Pelc [15]. Randomized oblivious gossiping protocols working in the expected time O(n log2 n) on undirected networks and O(min {m, DΔ} log2 n) on directed networks, where Δ is the maximum node in-degree, were presented in [6]. The model of separate messages was first considered by Bar-Yehuda, Israeli and and Itai [3] and Clementi, Monti and Silvestri [9]. Christersson, Gasieniec, ֒ Lingas [7] considered gossiping in undirected networks; they gave an adaptive deterministic gossiping protocol with time complexity O(n3/2 log n) and a randomized protocol of the expected time complexity O(n log2 n).
2
Technical Preliminaries
A radio network is modeled as a graph G = (V, E), in which the set of vertices V represents the physical nodes of the network, and the set of edges E represents the possibilities of direct transmissions among the nodes. If node x of a radio network can send a message directly to y, then node y is reachable from x. For any ordered pair u, v of nodes in the network, edge u → v is in the graph G if and only if node v is reachable from node u. The size of the network is defined to be the number of nodes |V |, which we usually denote by n. We assume full synchrony in that all nodes are equipped with local clocks that are clicking at the same rate and indicate the same round numbers. Protocols we consider are for a scenario when all the nodes activated with inputs start simultaneously at round zero. When some two nodes v and v ′ transmit simultaneously at a given round, and are both in-neighbors of node x in the reachability
256
B.S. Chlebus, D.R. Kowalski, and M.A. Rokicki
graph of the network, then a conflict occurs at x. A conflict at x results in all the messages arriving at x interfering with one another so that each is received as garbled. A message is said to be heard when it is received as fully readable in its correct form. Radio networks have the following properties: (a) If a node performs a transmission, then it transmits a single message. (b) The message transmitted by a node is delivered in that round to all the reachable nodes. (c) A node can hear a message delivered at a round, if exactly one among its in-neighbors transmitted in this round. Communication problems. Initially some nodes hold their input data called rumors. When node i is initialized with a rumor, then this rumor is denoted by ri . The goal of communication protocols is to disseminate such input rumors. In the problem of gossiping, each node v is a source for its private input rumor rv , and the goal is to have all the nodes learn all the rumors. Gossiping may be called all-to-all communication problem. A generalization of gossiping called many-to-all problem, or simply M2A, is about a scenario in which only some of the nodes have input rumors. Such nodes are called activated. The goal is to have all the nodes in the network get to know all the rumors of the activated nodes. All nodes in the network participate in forwarding messages in the course of an execution of an M2A protocol. To have a communication problem in radio networks meaningful, we need to assume that the topology of the underlying graph makes the communication task at hand possible to perform. In the case of gossiping and M2A, the graph is assumed to be strongly connected. Communication protocols. Correctness of an M2A or gossiping protocol means that the communication goal is eventually achieved on any strongly connected network. Nodes running a protocol are not required to reach eventually a state representing the completion of a task. This is assumed in order to decouple termination from complexity considerations. The time complexity of a protocol at hand, for a given strongly connected network, is defined to be the first round when the communication goal has been achieved. Nodes of a network of size n are identified by their unique names. We assume that names give a one-to-one correspondence between the nodes and integers in the range [0, n − 1]. While designing communication protocols, we assume that the size of the network is known. A simple protocol called Round-Robin operates as follows. In round i, the unique node with name k such that i ≡ k (mod n) is scheduled to perform a transmission. There are variants of this protocol depending on the size of packets. In the model of combined messages, a node scheduled to transmit at the current round transmits a message with all the rumors it has learned so far. In the model of combined messages, the protocol is augmented by a selection rule to choose a rumor to transmit from among those that have been learned by the given round. Usually the selection is made by resorting to a queuing mechanism.
Average-Time Complexity of Gossiping in Radio Networks
257
for k := 0 to ℓn do if v is in Gk then transmit call Round-Robin
Fig. 1. Protocol Gossip-Combined-Messages; the code for node v
Average complexity. We consider the average time complexity of gossiping and M2A communication on strongly-connected networks. This is the same as the expected time complexity when the probabilistic space has all strongly connected networks on n nodes as elementary events, each occurring with the same probability. A random directed network is strongly connected with the probability exponentially close to 1. This fact allows to obtain expected time estimates while working with arbitrary random directed networks. These estimates are the same when conditioned on the networks being strongly connected, provided the time estimates are polynomial. An explicit termination in polynomial time could be obtained for all protocols we develop, since there are polynomial-time worstcase time estimates for these protocols, valid for strongly connected networks. We do not want M2A protocols to have their performance biased towards specific sets of activated nodes. Therefore we work with the average complexity of M2A protocols defined in an adversarial manner as follows. Suppose there is an adversary who is given a protocol P for n nodes together with a number k ≤ n. The adversary chooses a set K of k specific names of nodes to be activated; the goal of the adversary is to show a scenario maximizing the complexity of the protocol. The average complexity of the protocol P, for n-node networks, is defined to be the average complexity of protocol P measured when exactly the nodes in K are activated with rumors.
3
Gossiping with Combined Messages
We show that gossiping can be performed with the average time cn/ lg n, for any fixed c > 1, and that the average time always has to be at least cn/ lg n, for any fixed c < 1/2. (The logarithm of x to the base 2 is denoted by lg x.) Gossiping protocol for combined messages. Let ℓn = ⌈n/b lg n⌉, where b = 12 (1 + 1c ). Observe that the inequalities 1 > b > 1/c hold. Define group Gk , for 0 ≤ k ≤ ℓn , to consist of nodes i, for 0 ≤ i < n, with the property that the congruence i ≡ k (mod ℓn ) holds. The size of a group is about b lg n. The sizes of two groups differ by at most 1. We consider an oblivious protocol Gossip-Combined-Messages, which is given in Figure 1. A transmission by a node contains all the rumors that the node has already learnt in the execution. Theorem 1. For any c > 1, the average number of rounds to complete gossiping by protocol Gossip-Combined-Messages on a network of n nodes is smaller than cn/ lg n, for a sufficiently large n.
258
B.S. Chlebus, D.R. Kowalski, and M.A. Rokicki
Proof. Take a node y and group Gk . Let x be in Gk . The node y can hear x at the kth round of the first phase when the following two events hold: (i) x is an in-neighbor of y; and (ii) no other node in Gk is an in-neighbor of y. It follows that the probability of the event that y hears x ∈ Gk during the kth round of the first phase of the protocol is 2−|Gk | = 2−b lg n = n−b . Let x and v be two nodes. Node y is called a relay for the pair x, v when the following holds: (i) y is an in-neighbor of v; and (ii) y heard x in the first phase. Observe that 1 , Pr [y is a relay for x, v] = 2nb because the events “y heard x in the first phase” and “y is an in-neighbor of v” are independent. Consider the first t nodes, that is, the nodes i with 0 ≤ i < t. These nodes are scheduled to perform a transmission among the first t rounds of the protocol Round-Robin in the second phase. Node i may make node v learn the rumor rx of x if i is a relay for the pair x, v. For all such nodes i making the first t transmission during Round-Robin and different from x and v, the events “i is a relay for the pair (x, v)” are independent. If v has not learnt rx in the first t rounds of the second phase, then no i such that 0 ≤ i < t is a relay for the pair x, v. The latter event holds with the probability (1 − 2n1 b )t by independence of the events of being a relay node. It follows that v does not learn rx in the first t rounds of Round-Robin with the probability of at most (1 − 2n1 b )t . We use the inequality 1 s 1 , (1) 1− < exp −1 + s 2s which holds for real s > 1. It yields the following estimate: t t 1 t 1 t 1 − b < exp −1 + b = exp − exp . 2n 4n 2nb 2nb 8n2b
(2)
Let d = min{2b, 1}. Take t = na where b < a < d. Now the right-hand side of (2) becomes exp(−na−b /2) exp(na−d /8) = exp(−na−b /2)(1 + o(1)).
(3)
Consider the event that for any pair of nodes x, v there is a relay node during the first t rounds of the second phase. The event does not hold with the probability of at most n2 exp(−na−b /2)(1 + o(1)) by the estimate (3). If this event holds, then gossiping is completed by round b lgn n + na , which is smaller than cn lg n for a sufficiently large n. Otherwise the time of gossiping can be estimated by b lgn n + n2 . These two estimates contribute to the expected value of the time of protocol A to complete gossiping, which together is smaller than lgcnn , for all sufficiently large n.
Average-Time Complexity of Gossiping in Radio Networks
259
Lower bound for gossiping with combined messages. We show that any gossiping protocol for the model of combined messages has the average time complexity Ω(n/ log n). This implies that protocol Gossip-Combined-Messages is asymptotically optimal. Theorem 2. For any c < 1/2 and gossiping protocol A for the model of combined messages, the average number of rounds to complete gossiping by A on a network of n nodes is larger than cn/ lg n, for a sufficiently large n. Proof. Let X be the random variable defined on the domain of all directed graphs of n nodes. For such a graph G, run A on G and let s be the first round when the gossiping has been completed. Define X(G) = s. Let an execution of A be given as a sequence T0 , T1 , T2 , . . . of transmissions. We estimate the probability of the event X > s, for integer s > 0. Take event H(v, s), for node v and round s, which holds when no node has heard from node v by round s. Observe that Pr [X > s] ≥ Pr [H(v, s)].
(4)
We want to estimate the probability that H(v, s) holds. We start with choosing v. If some node v does not belong to any of the first s transmissions, then such v yields the best possible estimate Pr [H(v, s)] = 1, which also implies that EX > s. Assume that every node belongs to at least one among the first s transmissions of protocol A. Next we restrict our attention only to these transmissions. We claim that there is a node, say, v with the property that every transmission Ti that v belongs to, for i ≤ s, is of a size at least |Ti | ≥ n/s. This is because otherwise, even if every node belonged to only one transmission, the total number of nodes in the initial segment of s transmissions of A were smaller than n, which would contradict the assumption that these transmissions include all the nodes. A node x hears from v at round i ≤ s, provided v ∈ Ti , when the following two events hold: (i) v is an in-neighbor of x in Ti , and (ii) no other node y = x in Ti is an in-neighbor of x. This implies that the estimate Pr [x hears from v at round i | v ∈ Ti ] ≤ 2−n/s holds. Node v could belong to a number of transmissions Ti for i ≤ s, so we use the estimate Pr [x hears from v in the first s rounds] ≤ s2−n/s . Node x was arbitrary, and we need to be concerned with all the nodes. We use the estimate Pr [some node hears from v in the first s rounds ] ≤ ns2−n/s .
260
B.S. Chlebus, D.R. Kowalski, and M.A. Rokicki
The event H(v, s), that no node hears v during the first s transmissions, holds with a probability of at most Pr [H(v, s)] ≥ 1 − ns2−n/s .
(5)
To estimate the expected value EX of X, we use the formula EX =
∞
Pr [X > k],
k=0
which holds true for any random variable X with non-negative integer values. Combining this with the estimates (4) and (5), we obtain the inequality t 1 − nk · 2−n/k , EX ≥
(6)
k=1
for any integer t > 0. Let k0 be the largest value of k for which the expression 1 − nk · 2−n/k is positive. We take the upper bound t on the range of summation in (6) to be close to k0 . Next we estimate the magnitude of k0 as a function of n. Observe that k0 is the largest k for which the inequality nk ≤ 2n/k
(7)
holds. Take the binary logarithm lg of both sides of (7) to obtain the equivalent n inequality lg n + lg k ≤ nk , which implies k0 = 2 lg n (1 + o(1)). We use the value t = n/(2 lg n) in the estimate (6) to obtain n/(2 lg n)
EX ≥
k=1
1 − nk · 2−n/k =
n −n 2 lg n
n/(2 lg n)
k · 2−n/k .
(8)
k=1
The function f (k) = k2−n/k is increasing as k → ∞. The value f (t) = f (n/(2 lg n)) is the largest term in the sum on the right-hand side of (8). Observe that f (t) =
n n 1 · 2−2 lg n = · n−2 = 2 lg n 2 lg n 2n lg n
and hence the estimate n/(2 lg n)
k=1
k · 2−n/k ≤
n 1 1 · = 2 lg n 2n lg n 4 lg2 n
holds. Therefore (8) can be bounded from below as follows: EX ≥
1 n n n 1− , − = 2 2 lg n 4 lg n 2 lg n 2 lg n
which completes the proof of Theorem 2.
Average-Time Complexity of Gossiping in Radio Networks
261
for i := lg k downto 0 do call Selector-Subroutine(2i ) continue Round-Robin for 10 lg n rounds
Fig. 2. Procedure M2A-Combined(k)
4
M2A Communication with Combined Messages
Suppose k nodes among n in the network are activated with rumors. We give a protocol with average time complexity O(min{k log(n/k), n/ log n}). We assume that k is a power of 2. Two schedules of transmissions P1 and P2 are said to be interleaved, when the consecutive actions as specified by P1 are performed in even-numbered rounds, while P2 determines the actions for the odd-numbered rounds. Infinite schedules of transmissions are called protocols, while finite schedules are called procedures in this paper. When a procedure P1 is interleaved with a protocol P2 , then eventually P1 ends. At this point we make the protocol P2 take over completely, such that its actions are performed in all the following rounds; this is explicitly marked in the pseudocode of our protocols by the instruction continue P2 . Another mode of using a protocol P specifies that the schedule of P is repeatedly executed for an interval of x rounds, then it is frozen. This is indicated in the pseudocode by the instruction continue P for x rounds. We use families of sets called (n, j)-selectors in [8]. They are defined as follows. A set Y selects element v from a set X when X ∩ Y = {v}. A family F of subsets of [n] = [0, n − 1] is an (n, j)-selector when, for any set X ⊆ [n] of size ℓ, at least |X|/2 elements in X can be selected by sets in F . The size of F is called its length. We refer to any used selector F as a sequence F = F1 , F2 , . . . in an arbitrary fixed order. Selectors are used to determine schedules of transmissions. Given positive integer number ℓ and a (n, ℓ)-selector F , we define Selector-Subroutine(ℓ) as follows. Node v transmits in round i if v ∈ Fi ; rounds are counted from the call of this subroutine. We use (n, 2i )-selectors of length Θ(2i log(n/2i )), which were proved to exist in [11]. A M2A procedure, representing the case when k may be a part of code, is given in Figure 2. Protocol M2A-Combined-Messages is given in Figure 3. Next we analyze the average complexity of the protocol. A node v is said to be a unique transmitter at a round, when v is the only node transmitting at that round. We say that broadcast of rv was successful/completed, or that node v broadcast successfully, when every node has received rv . Lemma 1. Suppose that node v transmits its rumor rv as the unique transmitter, and after this Round-Robin is executed. Then the broadcast of rv is completed in at most 10 lg n following rounds of Round-Robin with the probability of at least 1 − 1/n3 .
262
B.S. Chlebus, D.R. Kowalski, and M.A. Rokicki
for j := 0 to lg n do call M2A-Combined(2j ) interleaved with Gossip-Combined-Messages continue Gossip-Combined-Messages Fig. 3. Protocol M2A-Combined-Messages
Theorem 3. Protocol M2A-Combined-Messages, on networks of n nodes with any k activated nodes, works in average time O(min{k log(n/k), n/ log n}). Proof. First we show that the protocol completes M2A by the end of the loop for j = ⌈lg k⌉ with the probability of at least 1− 4k/n3. The protocol runs M2ACombined(2j ) which involves Selector-Subroutine(2j ). Since there are k ≤ 2j activated nodes, during Selector-Subroutine(2j ) at most 2j−1 activated nodes did not transmit as unique transmitters. Being a unique transmitter results in a successful broadcast during the next Round-Robin part, with probability at least 1 − 1/n3 by Lemma 1. During Selector-Subroutine(2j−1 ), at most 2j−2 activated nodes did not transmit as unique transmitters, since there are at most 2j−1 participating nodes with probability at least 1 − 2j /n3 . Those which transmitted as unique transmitters have a successful broadcast during the next Round-Robin rounds with probability at least 1 − 2j /n3 − 2j−1 /n3 . In general, in an execution of Selector-Subroutine(2i ) within M2ACombined(2j ), there are at most 2i activated nodes for which broadcast was not j successful during previous iterations with probability at least 1 − a=i+1 2a /n3 . Conditioned on this event, during Selector-Subroutine(2i ) at most 2i−1 of activated nodes did not transmit as unique transmitters. It follows that after the i−1 rumors have not been broadcast successith iteration of the loop, at most 2 fully with probability at least 1 − ja=i 2a /n3 . Considering only M2A-Combined(2j ), it completes M2A for k activated nodes in time ji=0 O(2i log(n/2i ) + log n) ≤ O(k log(n/k)) with probability at j least 1 − a=0 2a /n3 ≥ 1 − 4k/n3 . Including also previous executions of M2A ′ j′ j′ Combined(2j ) for j ′ < j produces time estimate j ′ ≤j O(2 log(n/2 )) = O(k log(n/k)). Since O(n2 ) is the worst-case time bound, the average time of M2ACombined-Messages is O(k log(n/k)) + O(n2 ) · 4k/n3 = O(k log(n/k)). Theorem 4. The average cost of any M2A protocol, for the model of combined messages, executed on network of n nodes with some k of them activated is Ω(k/ log n + log n). Proof. Let A be a M2A protocol. Fix a set K of activated nodes, where |K| = k. Let T0 , T1 , . . . be the sequence in which Ti denotes the set of nodes transmitting at round i in the execution of A. There are two kinds of rounds i: Case 1: Rounds i in which Ti includes at most 4 lg n nodes in K that transmit for the first time.
Average-Time Complexity of Gossiping in Radio Networks
263
Even k/(4 lg n) such rounds are not sufficient to exhaust all the elements in K. Case 2: Rounds i in which there are more than 4 lg n nodes from K transmitting for the first time. We show that with a large probability in any round, up to round s = k/(4 lg n), there is no successful transmission between any pair of nodes. Take node v. Let a = |Ti | > 4 lg n. The probability that v receives a rumor for a node in Ti at round i is (a/2)(1/2)a−1 > 1/n3 , for sufficiently large n. It follows that the probability of existence of a node that receives a rumor at round i is smaller than 1/n2 . The probability that some node receives a rumor by round s is smaller than s/n2 . The expected value of the number of rounds by completion of the communication task is at least s · (1 − s/n2 ) > s/2 for n > 2. The complexity of our protocol is close to the lower bound by a factor of O(log n log(n/k)).
5
Gossiping with Separate Messages
We consider now gossiping in the case when input rumors are so large that it takes a separate packet to carry one rumor. We show that gossiping can be performed with the average time O(n log n), and that the average time has to be Ω(n log n). Gossiping protocol for separate messages. Every node v maintains a priority queue Queuev in the private memory. The queue is used to store rumors that v still needs to transmit. There is a set Receivedv to store all the rumors learned so far. A newly received message with a rumor that is not stored in Receivedv is added to both Receivedv and Queuev . The protocol working according to these rules is called Gossip-Separate-Messages; it is given in Figure 4. Let the nodes be ordered cyclically by their names in [n] = [0, n−1], so that i is followed by number (i + 1) mod n. This ordering governs which nodes transmit in any Round-Robin type of protocol, like Gossip-Separate-Messages in particular. The priority queue Queuev has its own queuing discipline. Rumors are ordered cyclically, starting from the own input rumor rv . This rumor is followed by rumors with larger indices according to their order, that is, rv+1 , rv+2 , until rn−1 , which is then followed by r0 , r1 , through the final rv−1 . Theorem 5. The average number of rounds to complete gossiping by protocol Gossip-Separate-Messages on a network of n nodes is O(n log n). Proof. Every node transmits every rumor exactly once. The worst-case time complexity of this gossiping protocol is n2 . The full cycle of n rounds makes an epoch. During the first epoch, every node v transmits its input rumor rv . Take some rumor r and consider an event Ea (r) which holds when r has been transmitted by a lg n different nodes. The probability of the event that some
264
B.S. Chlebus, D.R. Kowalski, and M.A. Rokicki
initialize Receivedv := Queuev := {rv }; for round i := 0 to ∞ do if v ≡ i (mod n) then if Queuev nonempty then transmit the first rumor r in Queuev and remove r from Queuev else attempt to receive a message; if rumor r received then if r is not in Receivedv then insert r into Queuev and add to Receivedv Fig. 4. Protocol Gossip-Separate-Messages; the code for node v
node y has not heard r, conditioned on Ea (r), is n−a . The probability that some node has not heard r, conditioned on Ea (r), is at most n · n−a = n1−a . The probability that some node has not heard some rumor, conditioned on the events Ea (r) for all rumors r, is at most n2−a . In the following application we will use a = 4 to obtain the probability n2−4 = n−2 . Consider the following event B: every rumor was transmitted at least 3 lg n times during the first b lg n epochs, for some fixed integer b to be determined later. Take a node v and the b lg n nodes preceding v in the cyclic ordering. If any of these nodes receives rumor rv in the first epoch from v, then it transmits rv in the first b lg n epochs. When v transmits in the first epoch, then every other node receives rv with probability 1/2 independently over all the nodes. The expected value of the number of these nodes that receive rv in the first epoch is μ = 2b lg n. Take δ determined by the equality (1 − δ) 2b lg n = 3 lg n, that is, δ = 1 − 6b . Then by the Chernoff bound, the probability that less than 3 lg n nodes receives rumor rv in the first epoch is at most 6 2b 6 2 b lg n ≤ n−(1− b ) 4 lg e . exp − 1 − b 4 Take integer b > 6 for which the inequality (1 − 6b )2 4b lg e ≥ 3 holds. This b is sufficient to guarantee that event B does not to hold with the probability of at most n−2 . Conditional on B, the expected time of gossiping is at most bn lg n+n−2 ·n3 = n(1+b lg n), because the worst-case time complexity is n3 . Since event B does not hold with probability at most n−2 , the unconditional expected time complexity is at most n(1 + b lg n) + n−2 · n3 = n(2 + b lg n), for a similar reason. The average number of rounds to complete gossiping on a network of n nodes is Ω(n log n); this is a corollary of a more general lower bound for M2A communication shown in Section 6.
Average-Time Complexity of Gossiping in Radio Networks
265
for i := lg k downto 0 do for j := 1 to m(n, 2i ) do (a) if v ∈ Fj (n, 2i ) then transmit rumor rv else attempt to hear a message ( this is jth round of Selector-Subroutine(2i ) ) (r) continue Round-Robin-Stack in next 10 lg n rounds
Fig. 5. Procedure M2A-Separate(k); the code for node v
6
M2A Communication with Separate Messages
We give a protocol with average time O(k log(n/k) log n). Let k be a power of 2. Selector-Subroutine(2i ) is similar to the one described for the protocol with combined messages, in that it uses (n, 2i )-selector. There are two main differences in how they are used. The first difference is that after each round of Selector-Subroutine(2i ) we continue with Round-Robin-Stack for 10 lg n rounds, while in the case of combined messages we put 10 lg n of Round-Robin rounds after every used (n, 2i )-selector. The second difference is that specific rumor needs to be selected for each transmission by a node. An M2A procedure, representing the case when k may be a part of code, is given in Figure 5. An auxiliary protocol Round-Robin-Stack used in procedure M2ASeparate(k) is defined as follows. A node maintains a stack of rumors different from its original one. A rumor heard by the node is pushed on its stack. A rumor to transmit is obtained by popping the stack; when the stack is empty, then the node pauses. The stack is initialized to be empty, and is made empty just before Round-Robin-Stack is to be continued for 10 lg n rounds, see Figure 5. Protocol M2A-Separate-Messages is given in Figure 6. Next we analyze the average complexity and optimality of the protocol. Theorem 6. Protocol M2A-Separate-Messages, on a network of n nodes with k nodes initially activated, has the average time O(k log(n/k) log n). Proof. First, M2A task is completed by the end of M2A-Separate(2j ), where j = ⌈lg k⌉, with probability at least 1 − 4k/n3 . Consider M2A-Separate(2j ). It follows that during Selector-Subroutine(2j ) of M2A-Separate(2j ) at most 2j−1 activated nodes do not transmit as unique transmitters in rounds (a). Those who transmit as unique transmitters in some rounds (a) have also successful broadcasts in the following 10 lg n rounds of Round-Robin-Stack in code line (r), with probability at least 1 − 1/n3 each, by Lemma 1. Consider Selector-Subroutine(2j−1 ), which is the second subroutine of M2A-Separate(2j ). During this part at most 2j−2 activated nodes did not transmit as unique transmitters in rounds (a). Conditioned on this event, certain rumors are completed during 10 lg n following rounds of Round-Robin-Stack in part (r) of the loop, with probability at least 1 − 1/n3 each, again by Lemma 1. We continue analyzing subroutines of M2A-Separate(2j ) which are based on
266
B.S. Chlebus, D.R. Kowalski, and M.A. Rokicki
for j = 0 to lg n do call M2A-Separate(2j ) call Gossip-Separate-Messages
Fig. 6. Protocol M2A-Separate-Messages
(n, 2i )-selectors for i = lg(k/4), lg(k/8), . . . , 1, 0. Quantitatively, by the beginning of Selector-Subroutine(2i ) at most 2i selected nodes have not broadcasted successfully, with the probability of at least 1− ja=i+1 2a /n3 . Conditioned on this event, during Selector-Subroutine(2i ) at most 2i−1 activated nodes did not transmit as unique transmitters in rounds (a), while those which have transmitted as unique transmitters in rounds (a) complete broadcast during next 10 lg n rounds in line (r) of the code, with the probability of at least 1 − 2i /n3 . Consequently, by the beginning of Selector-Subroutine(2i−1 ) at most 2i−1 of activated nodes j have not complete broadcast, with probability at least 1 − a=i 2a /n3 . lg k M2A-Separate(2j ) takes i=0 O(2i log(n/2i ) lg n) = O(k log(n/k) log n) rounds, and during this procedure M2A task is completed with probability at least 1 − ja=0 2a /n3 ≥ 1 − 4k/n3 . The number of rounds in M2A-Separate-Messages by the end of execution ′ ′ j of M2A-Separate(2j ) is j ′ =0 O(2j log(n/2j ) log n) = O(k log(n/k) log n). The worst-case O(n3 ) can occur with probability at most 4k/n3 . This justifies the estimate O(k log(n/k) log n) + O(n3 ) · 4k/n3 = O(k log(n/k) log n) to be an upper bound on the average time. We also show a lower bound for M2A communication with separate messages. Theorem 7. For any M2A protocol for the model of separate messages, the average number of rounds to complete gossiping on a network of n nodes with k nodes initially activated is Ω(k log n). Corollary 1. For any gossiping protocol for the model of separate messages, the average number of rounds to complete gossiping on a network of n nodes is Ω(n log n). Our M2A protocol is within a factor of at most O(log(n/k)) close to optimality. In the case of k = Ω(n), which includes gossiping, the protocol is asymptotically optimal.
References 1. N. Alon, A. Bar-Noy, N. Linial, and D. Peleg, A lower bound for radio broadcast, Journal of Computer and System Sciences, 43 (1991) 290 - 298. 2. R. Bar-Yehuda, O. Goldreich, and A. Itai, On the time complexity of broadcast in radio networks: An exponential gap between determinism and randomization, J. Computer and System Sciences, 45 (1992) 104 - 126.
Average-Time Complexity of Gossiping in Radio Networks
267
3. R. Bar-Yehuda, A. Israeli, and A. Itai, Multiple communication in multi-hop radio networks, SIAM J. on Computing, 22 (1993) 875 - 887. 4. I. Chlamtac, and S. Kutten, On broadcasting in radio networks - problem analysis and protocol design, IEEE Transactions on Communication, 33 (1985) 1240 - 1246. A.M. Gibbons, A. Pelc, and W. Rytter, Deterministic 5. B.S. Chlebus, L. Gasieniec, ֒ broadcasting in ad hoc radio networks, Distributed Computing, 15 (2002) 27 - 38. 6. B.S. Chlebus, L. Gasieniec, A. Lingas, and A. Pagourtzis, Oblivious gossiping in ad֒ hoc radio networks, in Proc., 5th International Workshop on Discrete Algorithms and Methods for Mobile Computing and Communications (DIALM), 2001, pp. 44 - 51. and A. Lingas, Gossiping with bounded size mes7. M. Christersson, L. Gasieniec, ֒ sages in ad-hoc radio networks, in Proc., 29th International Colloquium on Automata, Languages and Programming (ICALP), 2002, pp. 377 - 389. and W. Rytter, Fast broadcasting and gossiping in radio 8. M. Chrobak, L. Gasieniec, ֒ networks, Journal of Algorithms, 43 (2002) 177 - 189. 9. A.E.F. Clementi, A. Monti, and R. Silvestri, Distributed broadcasting in radio networks of unknown topology, Theoretical Computer Science, 302 (2003) 337 - 364. 10. A. Czumaj, and W. Rytter, Broadcasting algorithms in radio networks with unknown topology, in Proc., 44th IEEE Symposium on Foundations of Computer Science (FOCS), 2003, pp. 492 - 501. U. Vaccaro, Generalized framework for selectors with 11. A. De Bonis, L. Gasieniec, ֒ applications in optimal group testing, in Proc., 30th International Colloquium on Automata, Languages and Programming (ICALP), 2003, pp. 81 - 96. Radio communication in random graphs, in Proc., 12. R. Els¨ asser, and L. Gasieniec, ֒ 17th ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), 2005, pp. 309 - 315. E. Kranakis, A. Pelc, and Q.Xin, Deterministic M2M multicast in 13. L. Gasieniec, ֒ radio networks, in Proc., 31st International Colloquium on Automata, Languages and Programming (ICALP), 2004, pp. 670 - 682. T. Radzik, and Q. Xin, Faster deterministic gossiping in directed 14. L. Gasieniec, ֒ ad-hoc radio networks, in Proc., 9th Scandinavian Workshop on Algorithm Theory (SWAT), 2004, pp. 397 - 407. 15. D.R. Kowalski, and A. Pelc, Time of radio broadcasting: adaptiveness vs. obliviousness and randomization vs. determinism, in Proc., 10th International Colloquium on Structural Information and Communication Complexity (SIROCCO), 2003, pp. 195 - 210.
L(h,1,1)-Labeling of Outerplanar Graphs⋆ Tiziana Calamoneri1 , Emanuele G. Fusco1 , Richard B. Tan2,3 , and Paola Vocca4 1
Dipartimento di Informatica Universit` a di Roma “La Sapienza”, via Salaria, 113-00198 Rome, Italy {calamoneri, fusco}@di.uniroma1.it 2 Institute of Information and Computing Sciences Utrecht University, Padualaan 14, 3584 CH Utrecht, The Netherlands [email protected] 3 Department of Computer Science University of Sciences & Arts of Oklahoma Chickasha, OK 73018, U.S.A. 4 Dipartimento di Matematica “Ennio de Giorgi” Universit` a diegli Studi di Lecce, via Provinciale Lecce-Arnesano, P.O. Box 193,73100 Lecce, Italy [email protected]
Abstract. An L(h, 1, 1)-labeling of a graph is an assignment of labels from the set of integers {0, · · · , λ} to the vertices of the graph such that adjacent vertices are assigned integers of at least distance h ≥ 1 apart and all vertices of distance three or less must be assigned different labels. The aim of the L(h, 1, 1)-labeling problem is to minimize λ, denoted by λh,1,1 and called span of the L(h, 1, 1)-labeling. As outerplanar graphs have bounded treewidth, the L(1, 1, 1)-labeling problem on outerplanar graphs can be exactly solved in O(n3 ), but the multiplicative factor depends on the maximum degree Δ and is too big to be of practical use. In this paper we give a linear time approximation algorithm for computing the more general L (h, 1, 1)-labeling for outerplanar graphs that is within additive constants of the optimum values.
1
Introduction
In multi-hop radio networks, one of the problems that have been studied extensively is the radio-frequency assignment problem. Each station and its neighbors are assigned frequencies so as to avoid signal collisions. This is equivalent to a graph coloring problem, where vertices are stations and edges represent interferences between the stations. The type of graph coloring problem varies depending on the kinds of frequency collisions that are to be avoided. If the only requirement is to avoid direct collisions between two neighbors, then this coincides with the normal graph coloring problem with its associated chromatic number χ. We call this L(1)-labeling ⋆
This work was partially supported by the Universit` a di Roma “La Sapienza”, Italy.
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 268–279, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
L(h,1,1)-Labeling of Outerplanar Graphs
269
problem of a graph G. Should it be desired that each station and all of its neighbors have distinct frequencies, we have the L(1, 1)-labeling problem. This is also known as the distance-two coloring of a graph or coloring of the square of the graph, and has been well-studied. In [7], Griggs and Yeh introduced a variation of a graph coloring problem which they called λ-coloring problem. In this problem, each vertex is assigned a color from the set of integers {0, · · · , λ} in such a way that adjacent vertices must be assigned colors of at least two apart and vertices of distance two must have distinct colors. This is also known as the L(2, 1)-labeling problem. The motivation of this type of coloring problem comes from radio frequency adjacent-band interference problem, where adjacent frequencies may leak across the frequency bands. Subsequently, the problem has been extended to L(h, k)-labeling, where adjacent vertices must be assigned colors of distance at least h ≥ 0 apart and vertices of distance two must be assigned colors at least k ≥ 0 apart. The L(h, k)-labeling problem has been studied on many different graphs. Of particular interest is the class of planar graphs and its subclass the outerplanar graphs. See [5] for a comprehensive survey. In practice, the distances in some wireless networks can be quite close (for example, the cellular network). Thus it may be necessary that not only stations of distance two apart must have distinct frequencies, but perhaps distance three or more. This motivates the study of L(h, 1, 1)-labeling problem, where adjacent nodes must have frequencies at least h ≥ 1 bands apart and all nodes of distance two or three must also have distinct frequencies. In this paper we only focus on L(h, 1, 1)-labeling of outerplanar graphs. More precisely, we start from L(1, 1, 1)-labeling of outerplanar graphs, i.e. the distance three coloring, where colors are distinct for vertices that are within distance three of each other, then we extend it to L(h, 1, 1)-labeling of outerplanar graphs for any h ≥ 1. 1.1
Our Results
For an outerplanar graph G of maximum degree ∆ we present lower bounds of 3∆ − 3 for the maximum number of colors that are needed to perform the L(1, 1, 1)-labeling. We show that by using a simple greedy approach 4∆−2 colors are necessary in the worst case for L(1, 1, 1)-labeling an outerplanar graph. Then we give a linear time approximation algorithm to L(1, 1, 1)-label an outerplanar graph using no more than 3∆+9 colors for ∆ ≥ 6 and extend it to L(h, 1, 1)-label an outerplanar graph using no more than 3∆ + 2h + 7 colors for ∆ ≥ h + 5. 1.2
Related Results
The distance-d coloring problem, L(1, · · · , 1) = L(1d )-labeling of a graph, where all vertices within distance d ≥ 1 must have distinct colors have been studied in the literature. In [13], Nizisheki et al gave an O(n3 ) time algorithm to L(1d )label a graph of bounded treewidth k. As an outerplanar graph G is a graph of treewidth two, this algorithm can be used to give an optimal L(1, 1, 1)-labeling of G in O(n3 ) time. Let α be the chromatic number of the third power of a graph
270
T. Calamoneri et al. 31
of bounded threewidth 2, then the multiplicative factor of this algorithm is α2 ; a number way too big to be of practical use. In contrast, our approximation algorithm is linear of O(nΔ), and only within an additive constant of the optimum value. For outerplanar graphs G, the L(h, 1)-labeling problem for h ≥ 1 has also been studied. The L(1, 1)-labeling problem appeared in [3, 6] and the L(2, 1)-labeling in [3, 6, 9]. To the best of our knowledge, nothing is known for the L(h, 1, 1)labeling of outerplanar graphs for h ≥ 2. The rest of the paper is organized as follows. The next section gives the preliminary materials on L(h, 1, 1)-labeling and outerplanar graphs. Section 3 describes the techniques and results of L(1, 1, 1)-labeling of outerplanar graphs. The same techniques are then used in section 4 to obtain results for L(h, 1, 1)labeling for h ≥ 1. The final section gives the conclusion and state some open problems.
2
Preliminaries
Let G = (V, E) be a graph with vertex set V and edge set E. The number of vertices of the graph is denoted by n and the maximum degree by Δ. Throughout the paper we assume our graph is connected, loopless and simple. 2.1
L(h,1,1)-Labeling
Definition 1. Let G be a graph and h ≥ 1 be a non-negative integer. A L(h, 1, 1)labeling of G is an assignment of colors (integers) to the vertices of G from the set of integers {0, · · · , λ} such that vertices of distance 1, have colors that differ by at least h and vertices of distance two or three have colors that differ by at least 1. The minimum value λ for which G has a L(h, 1, 1)-labeling is denoted by λh,1,1 and the minimum number of colors is denoted by χh,1,1 = λh,1,1 + 1. In order to make easier the reading, we will deal with χh,1,1 most of the time, even if most of the literature use λh,1,1 . 2.2
Outerplanar Graphs
An outerplanar graph is a graph that has a planar embedding such that all the vertices lie on the exterior face. We first state some known facts about outerplanar graphs, of which the first two are well-known. Characterization by Minors. A graph G is outerplanar iff it does not contain the complete graph K4 nor the complete bipartite graph K2,3 as minors. (A minor of a graph is obtained by edge contractions, edge deletions, or deleting isolated vertices.) Degree 1 or 2. An outerplanar graph G has a node of degree 1 or 2. OBFT(G) [6]. An outerplanar graph G has an ordered breadth first tree graph OBFT(G), constructed in the following manner. Choose a node r and induce a
L(h,1,1)-Labeling of Outerplanar Graphs
271
total ordering on the vertices clockwise on the exterior face of a planar embedding of G. Do a breadth first search starting with the root r and visit the vertices in order of the given ordering. We end up with an OBFT(G) with possibly some non-tree edges which have the following properties. A non-tree edge can only exist between vertices x and y if : 1. they are adjacent vertices on the same level, i.e. x = vl,i and y = vl,i+1 for some level l ≥ 1 and i ≥ 1, where vl,i denotes the vertex at level l and it is the ith vertex from the left, 2. they are vertices on adjacent levels, x = vl,i and y = vl+1,j , and y must be the rightmost child of its parent w = vl,k and k = i − 1, i.e. vertex x must be the next vertex after w on the same level in the OBFT(G). See Fig. 1 for an example of OBFT(G), where dotted lines denote non-tree edges. 14
15
13
16
12 11
1 2
10 9
3 8
4 7
5
6 a
1 2
11
v1,1
14 15
7
10
12
13
4 6 3
8
v2,1
16
v3,1 v4,1
9
5
v2,2 v2,3
v2,4
v3,2
v2,5
v3,4
v3,3 v4,2 v4,3
v4,4
v5,1 v5,2
b
c
Fig. 1. Example of OBFT(G)
Given as input an outerplanar embedding of G, an OBFT(G) can be computed in O(n) time. We prove the following results concerning an OBFT(G) that will be useful to prove the upper bound of our algorithms. Lemma 1. Let G be an outerplanar graph with its associated OBFT(G), and two siblings x and y, x < y, in OBFT(G). Any node u in the subtree of OBFT(G) rooted at x is less than any node w in the subtree of OBFT(G) rooted at y. Proof. First observe that the parent of x and y, say r, can assume three possible relative positions with respect to x and y: r < x < y, x < r < y and x < y < r (see Fig. 2).
272
T. Calamoneri et al.
Œ a
b
c
Fig. 2. Proof of Lemma 1. Lines with double bars are paths while simple lines represent edges.
In the first case (Fig. 2.a), u can lie either between r and x or between x and y, otherwise a crossing would be generated. Assume by contradiction that there exists a w < u. Now, w cannot lie between 1 and r (path w ❀ y would cross path 1 ❀ r); w cannot lie between r and x (path w ❀ y would cross edge (r, x)); so the only feasible interval for w is between x and y. Nevertheless, also in this interval, w < u implies a crossing between paths x ❀ u and y ❀ w. So u < w. In the second case (Fig. 2.b) 1 < u < r as there is necessarily a path connecting root 1 to r, and w > r for similar reasons. So u < w. Finally, in the third case (Fig. 2.c) u is either between 1 and x or between x and y. With similar reasonings as in the first case, we prove again that u < w. ⊓ ⊔ Theorem 1. Any OBFT(G) of an outerplanar graph G is an outerplanar embedding of G. Proof. First observe that if the embedding is not outerplanar, then either there exists some node embedded inside an internal face, or there is some node on the boundary of internal faces only. Given an OBFT(G), let us suppose first that there is a node v embedded inside an internal face f . In fact, if a whole subtree is embedded inside f then we can contract it to its root, say v. We will prove the claim by contradiction. The boundary of f is the cycle created in the OBFT(G) by at least one non-tree edge (u, w) (see fig. 3 a). Let us consider the lower common ancestor of u and w, lca(u, w), and its two children on the boundary of f , let they be x and y. By OBFT(G) construction, it must be x < y. By Lemma 1, we have u < v < w if (i) v is in the subtree rooted at x, ii) v is in the subtree rooted at y and (iii) v is a child of lca(u, w). This configuration leads to an absurdity, as 1 must lie to the left of u and it is impossible to place path 1 ❀ v not passing through u and not crossing edge (u, w). It follows that v does not exists. Let us suppose now that a node v lies on the boundary of internal faces only and consider the simple cycle C constituted by the boundary of the union of all such faces. By construction, if v lies on level l of the OBFT(G), then on C there are necessarily a node w on a level strictly greater than l and a node u on a level strictly less than l such that there exist paths w ❀ v and u ❀ v not
L(h,1,1)-Labeling of Outerplanar Graphs
273
using nodes of C. As u and w both lie on C, then there are two distinct paths inside C connecting u and w both passing through a node at level l. This leads to an absurdity as we can construct the forbidden minor K2,3 : v represents the internal node, u and w are the degree 3 nodes and the two nodes on level l are the remaining degree 2 nodes. ⊓ ⊔ Corollary 1. In an OBFT(G) of an outerplanar graph G, for each node c, there exists at least one of c’s children not having non-tree edges on both sides. (Refer to Fig. 3 b.) Proof. The claim directly follows from Theorem 1 as node c would be internal. ⊓ ⊔
a
b
Fig. 3. a) Proof of Theorem 1. Lines with double bars are paths while simple lines represent edges. b) Proof of Corollary 1.
3
L(1,1,1)-Labeling
In this section we deal with the L(1, 1, 1)-labeling of outerplanar graphs. The technique used here will be generalized in the next section in order to handle the L(h, 1, 1)-labeling. First we give the lower bound. Theorem 2. There exists an outerplanar graph of degree Δ that requires at least 3Δ − 3 colors to be L(1, 1, 1)-labeled. Proof. Consider the graph shown in Fig. 4 a; x, y and z are vertices of degree Δ. As all adjacent vertices of x, y and z are at mutual distance ≤ 3, it is easy to see that it requires at least 3Δ − 3 colors. ⊓ ⊔ The greedy first-fit approach is a frequently used technique for labeling vertices of graphs and usually performs well in practise. This technique consists in considering nodes one by one in any order and assigning them the first color not used by any of their labeled neighbors satisfying the L(1, 1, 1)-labeling condition. If there is a tree-like structure, the followed order is typically the top-down left to right one. In our case, we can state the following theorem.
274
T. Calamoneri et al.
a
b
Fig. 4. a) Lower Bound. b) Greedy Algorithm.
Theorem 3. There exists an outerplanar graph G of degree Δ such that the greedy first-fit approach requires at least 4Δ − 2 colors to L(1, 1, 1)-label G Proof. The worst case occurs when we have the configuration shown in Fig. 4 b where there are 4Δ − 3 vertices that are within distance three of a vertex v. ⊓ ⊔ Since the gap between the lower bound on χ1,1,1 and the guaranteed performance of the greedy first-fit approach is rather large, we now present an algorithm that, given an outerplanar graph G of maximum degree ∆ ≥ 6, finds an L(1, 1, 1)labeling of vertices of G using at most 3∆ + 9 colors, and hence almost optimal as the lower bound is at least 3∆ − 3. Let A contains colors {0, 1, . . . ∆ + 2}, B colors {∆ + 3, ∆ + 4, . . . 2∆ + 5} and C colors {2∆ + 6, 2∆ + 7, . . . , 3∆ + 8}. The first step of the algorithm is to build an OBFT(G), rooted on a node of degree 1 or 2. Then the algorithm proceeds to assign a group of colors to the children of each node. Finally, it colors each node with a color from its color group. Before describing how to assign groups of colors, in order to make easier the comprehension of the algorithm we introduce some definitions. For a node v, let Cv denote the set of all the children of v in the OBFT(G) and G(Cv ) be the color group that is assigned to Cv . At each step we try to assign color groups in such a way as to avoid conflicting groups. By conflicting groups we mean that all the colors in a group may violate the L(1, 1, 1)-labeling condition. For the algorithm refer to Fig. 5 a: Let v be a vertex assigned to a specific group of colors. All grandchildren of v are at distance ≤ 3 from Cv , hence we must forbid group G (Cv ) to all grandchildren of v and, in general, we are free to choose between the two remaining groups. Since v and possibly its left and right siblings (if they are adjacent to v), are at distance ≤ 3 from the grandchildren of v, we prefer to choose the color group different from that one assigned to v and its siblings when possible. Occasionally we will have no choice but to assign a specific color group because it is the only color group left that can be assigned without causing conflicts. This can occur for the grandchildren of a leftmost or rightmost child for a node. We call these color groups fixed (see Fig. 5 b and Fig. 6 b).
L(h,1,1)-Labeling of Outerplanar Graphs
a
275
b
Fig. 5. a) Color group assignment. b) Fixed right color group.
a
b
Fig. 6. a) Alternate color groups. b) Fixed left color group.
We now describe how to assign a color group. The color groups are assigned level by level top down from the root to the leaves and from the left to the right within each level of the tree, except in some special cases that will be explained later. After we have assigned two separate color groups to the root and its children, we have two levels that are fully assigned and we have to assign group colors to the third level. At the general iteration we have already assigned color groups to level h and h + 1, h ≥ 1, we are now ready to assign color groups to level h + 2. Refer to Fig 5 a: suppose v and its children Cv have been assigned groups, to assign color groups to v’s grandchildren we first have to check Cr , where r is the rightmost child of v. The only case in which we do not follow the left to right order is depicted in Fig. 5 b: if there is edge (r, x) (i.e. the distance between any node in Cr and any node in Cx is ≤ 3) and G (Cv ) = G (Cx ) then we have no choice but to assign the only color group available to Cr . Afterwards, we have to check if node r is connected to its left sibling by a non-tree edge. If so, we have to assign groups from right to left, alternating with the only color groups left available (see Fig. 6 a), until there is a missing non-tree edge, which will occur due to Corollary 1. Next, we check the leftmost child l of node v. Again, if the color group to be assigned to Cl is fixed (Fig. 6 b), we have to assign the only available group and then check if node l is connected via a non-tree edge to its right sibling. If so, repeat the alternating group assignment as before (until a missing non-tree edge is encountered). After the two boundary
276
T. Calamoneri et al. Color Group Assignment Algorithm Let A, B and C be the three groups of distinct colors; Construct OBFS(G) tree T of an outerplanar graph G, rooted on a node of degree 1 or 2; Assign G(root)=A and G(Croot)=B; Suppose color groups have been assigned to nodes at levels h and h + 1, h ≥ 1. Visit nodes of T top down, left to right starting from the root; For each node v on level h ≥ 1: If G(Cr ) is fixed (see Fig. 5) then Assign G(Cr ) to the only available color-group; Proceed right to left, assign G(Cx ) (see Fig. 6) switching color-group until there is a missing non-tree edge between x and y or until G(Cl ) is assigned; If G(Cl ) is fixed then Assign G(Cl ) to the only available color-group; Proceed left to right, assign G(Cy ) (see Fig. 6) switching color-group until there is a missing non-tree edge between x,y or until G(Cr ) is assigned; Let z be the leftmost node in Cv such that G(Cz ) is not assigned. While there is such a node z Assign G(Cz ) to the available color-group not used by z ; Proceed from left to right alternating color group as in Fig. 6. Fig. 7. Color group assignment algorithm
groups have been assigned, we try to assign color groups from left to right using a color group that is different from Gv if possible, alternating color groups from left to right for any non-tree edge that is present. A more formal description is given in Fig. 7. Theorem 4. There exists a linear time algorithm that L(1, 1, 1)-labels any outerplanar graph with 3Δ + 9 colors, where Δ ≥ 6. Proof. We have already described the first two steps of the algorithm (i.e. the construction of OBFT(G) and the color group assignment), so it remains to detail how to assign to each node a color from its color group. Given a node group and its assigned color group, we can randomly choose a different color for each node, paying only attention to nodes that are at distance ≤ 3 from a node group having the same color group. So, we first assign colors to such nodes (there are no more than four: the leftmost, its right sibling, the rightmost and its left sibling) avoiding conflicts, and then we proceed with all other nodes. It is straightforward to see that this algorithm correctly labels the graph in linear time. It remains to show that Δ+3 colors in each group are always enough.
L(h,1,1)-Labeling of Outerplanar Graphs
277
Fig. 8. Proof
By scanning in an exhaustive way all possible configurations in an OBFT(G), it is possible to see that the worst case is that in Fig. 8: at most Δ − 1 nodes in Cx must be labeled using colors from a group (A in the figure) avoiding the colors assigned to m, l, w and v all at distance ≤ 3 from nodes in Cx . It follows that Δ + 3 colors in each group are always enough. Furthermore, observe that the color assigned to j cannot be used in p, the color assigned to k cannot be used neither in p nor in q, and similarly the color assigned to o cannot be used in s and the color assigned to n cannot be used neither in r nor in s. It follows that, after removing the 4 colors forbidden by m, l, w and v, the Δ − 1 remaining colors must be at least 4. In the special case in which the color assigned to k is the same as the color assigned to n, one color more is necessary. Hence Δ ≥ 6. ⊓ ⊔
4
L(h,1,1)-Labeling
In this section we show how to generalize to the L(h, 1, 1)-labeling the results obtained for the L(1, 1, 1)-labeling. First, observe that Theorem 2 provides a lower bound of 3Δ − 3 for χh,1,1 , for any h ≥ 1. Also Theorem 3 on the greedy first-fit approach applies to the general case h ≥ 1. In the following we get an L(h, 1, 1)-labeling by exploiting the Color-Group Assignment Algorithm and then by opportunely labeling nodes. Namely, we can prove the following theorem. Theorem 5. For any h ≥ 2, there exists a linear time algorithm that L(h, 1, 1)labels any outerplanar graph with 3∆ + 2h + 7 colors, ∆ ≥ h + 5. Proof. (sketched) The reasonings are exactly the same as those presented in the proof of Theorem 4 with two main changes:
278
T. Calamoneri et al.
1. Colors in a group. Group A contains colors {0, 1, . . . Δ + 2}; group B contains colors {Δ + h + 2, Δ + h + 3, . . . 2Δ + h + 4}; and, group C colors {2Δ + 2h + 4, 2Δ + 2h + 5, . . ., 3Δ + 2h + 6}. The h − 1 colors in the gaps between color groups guarantee that the distance 1 constraint between adjacent group of nodes is respected; 2. Assignment of colors to vertices of a group. It is possible to prove that the number of colors in a group is sufficient to label vertices in a group so as to guarantee the distance 1 constraint between vertices connected to each other in a path. It is straightforward to see that, with an analysis similar to the one used in the proof of Theorem 4, the provided algorithm correctly L(h, 1, 1)-labels the outerplanar graph in linear time and it requires at most 3Δ + 2h + 7 colors, where Δ ≥ h + 5. ⊓ ⊔
5
Conclusion
In this paper we provide very close upper and lower bounds on χh,1,1 for outerplanar graphs, showing also that the greedy first-fit technique does not work well in this case. In the literature, there is a known algorithm that optimally L(1, 1, 1)-labeling outerplanar graphs running in O(n3 ) time, but the multiplicative factor is extremely large to be of practical use. Our algorithm produces an approximate solution that only differs from the optimal solution by a constant additive factor and it is linear. Some open problems arise from this work. First, there is a gap between the upper bound provided by the algorithm and the lower bound shown. It would be nice to close the gaps between the bounds. Furthermore, for L(h, 1d ) = L(h, 1, · · · , 1), we have only studied the case when d = 2. It would be interesting also to study the L(h, 1d)-labeling problem for outerplanar graphs for d ≥ 3 . The same technique of using color group assignments can be applied, but the number of cases to be considered increases quite a bit. The problem here is to find good estimates for f (h, d) and g(h, d) in the d inequality χh,1d ≤ f (h, d)∆⌈ 2 ⌉ + g(h, d).
References 1. G. Agnarsson and M. Halld´ orsson. Coloring Powers of planar graphs. In Proc. 11th Ann. ACM-SIAM Symposium on Discrete Algorithms (SODA 2000): 654– 662, 2000. 2. A.A. Bertossi, C.M. Pinotti and R.B. Tan. Channel assignment with separation for interference avoidance in wireless networks. IEEE Transactions on Parallel and Distributed Systems 14(3): 222–235, 2003. Preliminary version in ACM Workshop DIAL M 2000, 2000. 3. H.L. Bodlaender, T. Kloks, R.B. Tan and J. van Leeuwen. Approximations for λColorings of Graphs. The Computer Journal 47: 193-204, 2004. Preliminary version in Proc. 17th Annual Symp. on Theoretical Aspects of Computer Science (STACS 2000), Lectures Notes in Computer Science 1770: 395–406, 2000.
L(h,1,1)-Labeling of Outerplanar Graphs
279
4. R.J. Bruce and M. Hoffmann. L(p, q)-labeling of outerplanar graphs. Tech. Rep. No. 2003/9, Department of Mathematics and Computer Science, University of Leicester, England. 5. T. Calamoneri. The L(h, k)-labeling problem: an annotated bibliography. Accepted to The Computer Journal, 2006. A continuously updated version is available online at http://www.dsi.uniroma1.it/~calamo/survey.html 6. T. Calamoneri and R. Petreschi. L(h, 1)-Labeling Subclasses of Planar Graphs. Journal on Parallel and Distributed Computing 64(3): 414-426, 2004. 7. J.R. Griggs and R.K. Yeh. Labeling graphs with a Condition at Distance 2. SIAM J. Disc. Math 5:586–595, 1992. 8. W. K. Hale. Frequency assignment: theory and applications. In Proc. IEEE 68:1497–1514, 1980. 9. K. Jonas. Graph Coloring Analogues With a Condition at Distance Two: L(2, 1)Labelings and List λ-Labelings. Ph.D. thesis, University of South Carolina, Columbia, 1993. 10. S.T. McCormick. Optimal approximation of sparse Hessians and its equivalence to a graph coloring problem. Math. Programming 26: 153–171, 1983. 11. R.K. Yeh. A Survey on Labeling Graphs with a Condition at Distance Two. Manuscript. 2004. 12. R.K. Yeh. Labeling Graphs with a Condition at Distance Two. Ph.D. Thesis, University of South Carolina, 1990. 13. X. Zhou, Y. Kanari and T. Nishizeki. Generalized vertex-coloring of partial ktrees. IEICE Trans. Fundamentals of Electronics, Communication and Computer Sciences E83-A: 671-678, 2000.
Combinatorial Algorithms for Compressed Sensing Graham Cormode1 and S. Muthukrishnan2 1
Bell Labs, Lucent Technologies [email protected] 2 Rutgers University [email protected]
Abstract. In sparse approximation theory, the fundamental problem is to reconstruct a signal A ∈ Rn from linear measurements A, ψi with respect to a dictionary of ψi ’s. Recently, there is focus on the novel direction of Compressed Sensing [9] where the reconstruction can be done with very few—O(k log n)— linear measurements over a modified dictionary if the signal is compressible, that is, its information is concentrated in k coefficients with the original dictionary. In particular, these results [9, 4, 23] prove that there exists a single O(k log n) × n measurement matrix such that any such signal can be reconstructed from these measurements, with error at most O(1) times the worst case error for the class of such signals. Compressed sensing has generated tremendous excitement both because of the sophisticated underlying Mathematics and because of its potential applications. In this paper, we address outstanding open problems in Compressed Sensing. Our main result is an explicit construction of a non-adaptive measurement matrix and the corresponding reconstruction algorithm so that with a number of measurements polynomial in k, log n, 1/ε, we can reconstruct compressible signals. This is the first known polynomial time explicit construction of any such measurement matrix. In addition, our result improves the error guarantee from O(1) to 1 + ε and improves the reconstruction time from poly(n) to poly(k log n). Our second result is a randomized construction of O(k polylog(n)) measurements that work for each signal with high probability and gives per-instance approximation guarantees rather than over the class of all signals. Previous work on Compressed Sensing does not provide such per-instance approximation guarantees; our result improves the best known number of measurements known from prior work in other areas including Learning Theory [20, 21], Streaming algorithms [11, 12, 6] and Complexity Theory [1] for this case. Our approach is combinatorial. In particular, we use two parallel sets of group tests, one to filter and the other to certify and estimate; the resulting algorithms are quite simple to implement.
1 Introduction We study a modern twist to a fundamental problem in sparse approximation theory, called Compressed Sensing, recently proposed in the Mathematics community. Sparse Approximation Theory Background. The dictionary Ψ denotes an orthonormal basis for Rn , i.e. Ψ is a set of n real-valued vectors ψi each of dimension n and ψi ⊥ ψj . The standard basis is the traditional coordinate system for n dimensions, P. Flocchini and L. Gasieniec ˛ (Eds.): SIROCCO 2006, LNCS 4056, pp. 280–294, 2006. c Springer-Verlag Berlin Heidelberg 2006
Combinatorial Algorithms for Compressed Sensing
281
namely, for i = 1, . . . , n, the vector ψi = [ψi,j ] where ψi,j = 1 iff i = j.1 A signal vector A in Rn is transformed by this dictionary into a vector of coefficients θ(A) formed by inner products between A and vectors from Ψ . That is, θi (A) = A, ψi and A = i θi (A)ψi by the orthonormality of Ψ .2 From now on (for convenience of reference only), we reorder the vectors in the dictionary so |θ1 | ≥ |θ2 | ≥ . . . ≥ |θn |. In the area of sparse approximation theory [8], one seeks representations of A that are sparse, i.e., use few coefficients. Formally, R = i∈K θi ψi , for some set K of coefficients, |K| = k ≪ n. Clearly, R(A) cannot exactly equal the signal A for all signals. The error is typically taken as R − A22 = i (Ri − Ai )2 . By the classical Parseval’s equality, this is equivalently θ(A) − θ(R)22 . The optimal k representation of A under Ψ , Rkopt , therefore takes k coefficients with the largest |θi |’s. The error then is A − Rkopt 22 = ni=k+1 θi2 . This is the error in representing the signal A in a compressed form using k coefficients from Ψ . In any application (say audio signal processing), one has a “class” of input signals (A’s) (e.g., sinusoidal waveforms comprising the audio signal), one chooses an appropriate dictionary Ψ (say discrete Fourier) so that most of the signals are “compressible” using that dictionary, and represents the signal using the adequate number (k ≪ n) of coefficients (θ1 , . . . , θk ). There are different notions of a signal being compressible in a dictionary. In the past, e.g., in audio applications, researchers focused on the αexponentially decaying case where the coefficients decay faster than any polynomial. That is, for some α, |θi | = O(2−αi ), for all i. More recently, there is focus on the p-Compressible case. Specifically the coefficients have a power-law decay: for some p ∈ (0, 1), and for all i, |θi | = O(i−1/p ). Consequently, A − Rkopt 22 ≤ Cp k 1−2/p for some constant Cp . A simplification of these models is the k-support case, where the signal has at most k non-zero coefficients, so Rkopt = A. Study of sparse approximation problems involves the art of identifying suitable Ψ so the signals from an application are compressible, and studying their mathematical properties. This is a mature area of Mathematics with highly successful applications to signal processing, communication theory and compression [8]. Compressed Sensing. Recently, Donoho posed a fundamental question [9]: Since most of the information in the signal is contained in only a few coefficients and the rest of the signal is not needed for the applications, can one directly determine (acquire) only the relevant coefficients without reading (measuring) each of the coefficients? In a series of papers over the past year, the following result has emerged. Theorem 1. [9, 4, 23] There exists a non-adaptive set V of O(k log(n/k)) vectors in Rn which can be constructed once and for all from the standard basis. Then, for fixed p ∈ (0, 1) and any p-compressible signal A in the standard basis, given only measurements A, vi , vi ∈ V , a representation R can be determined in time polynomial in n such that A − R22 = O(k 1−2/p ). 1
2
√ Examples of other basis are discrete Fourier where ψi,j = √1n exp(−2π −1ij/n); and Haar wavelet where every ψi is a scaled and shifted copy of the same step like function. By applying an appropriate rotation to the basis and signal vectors, our problem can be thought of in the standard basis only. We refer to θi where A is implicitly clear.
282
G. Cormode and S. Muthukrishnan
There are several important points to note. First, since the worst case error for a pcompressible signal is Cp k 1−2/p , the representation above is optimal, up to constant factors for the class of all p-compressible signals, for a fixed p. Second, even if the signal consisted of precisely k nonzero coefficients θi1 , . . . , θik , one needs k measurements A, ψij for j ∈ [1, k]; hence, the set V of measurements is only a log(n/k) factor larger than the naive lower bound of measurements needed. Third, the proof shows existence of V by showing that a random set of V vectors will satisfy the theorem with nonzero probability. The proof immediately gives a Monte Carlo randomized algorithm by using such a random V . This result has generated much interest, and a sequence of papers have improved different aspects of the result [9, 25, 4, 23]; found interesting applications including MR imaging wireless communication [23] and generated implementations [22]; found mathematical applications to coding and information theory [3]; and extended the results to noisy and distributed settings [2]. The interest arises for two main reasons. First, there is deep mathematics underlying the results, with interpretations in terms of high dimensional geometry [23], uncertainty principles [4], and linear algebra [9]. Second, there are serious applications—for example, in going from analog to digital representation of the signals, existing hardware chips can execute measurements A, vi extremely efficiently, so performing O(k log(n/k)) measurements is significantly more efficient than measuring each component of the signal (hence “compressed sensing”). The results have inspired a number of workshops, meetings and talks [15, 18]. Outstanding Problems and Our Results. There are several outstanding questions in Compressed Sensing. The most fundamental issue is to explicitly construct the nonadaptive measurement set of vectors V (or equivalently, a transformation matrix T in which T [i, j] = vi [j]) in the theorem. The existing results first show that if T satisfies certain conditions, the theorem holds; then they show that T chosen from an appropriate random distribution suffices. The necessary conditions are quite involved, such as computing the eigenvalues of every O(k log n) square submatrix of T [9], and testing that each such submatrix is an isometry, behaving like an orthonormal system [4]. No explicit construction is known to produce T ’s with these properties. Instead, algorithms for Compressed Sensing choose a random T , and assume that the conditions are met. Thus, these are Monte Carlo algorithms, with some probability of failure. This is a serious drawback for Compressed Sensing applications motivated by hardware implementations which will sense many, many signals over time. So it is highly desirable that there be an explicit construction of T suitable for Compressed Sensing. A natural approach is to take a random T and test whether it satisfies the necessary conditions. However, this is much too expensive, taking time at least Ω(nk log n ). There are several other outstanding questions. For example, the time to obtain a representation from the measurements is significantly superlinear in n (it typically involves solving a Linear Program [9, 4, 23]). For large signals, this cost is overly burdensome. Since we make a small number of measurements, it is much better to find algorithms with running time polynomial in the number of measurements and hence, sublinear in n. Lastly, the guarantee given by the above theorem is not relative to the best possible for the given signal (i.e., per-instance), but to the worst case over the whole class
Combinatorial Algorithms for Compressed Sensing
283
of p-compressible signals. Clearly per-instance error guarantees (equivalently, true approximation algorithms) are preferable. We address these questions and present the first known explicit algorithms for Compressed Sensing. Our approach is combinatorial, and yields a number of technical improvements such as sublinear time reconstruction, and tolerance to error. Our main results are twofold. 1. We present a deterministic algorithm that in time polynomial in k and n constructs a non-adaptive transformation matrix T of number of rows polynomial in k log n, and present an associated reconstruction algorithm in the spirit of Theorem 1. More specifically, our algorithm outputs a representation R for a compressible signal A such that R − A22 < Rkopt − A22 + εCkopt 2 . Here, Ckopt 2 denotes the optimal error over the whole class of signals considered. This is the first explicit construction known for this problem in polynomial time. In addition, this result leads to the following improvements: (a) the reconstruction time is subquadratic in the number of measurements (and hence sublinear in n), (b) the overall error is optimal up to 1 + ε of the worst case error Ckopt 2 for p-compressible signals, improving the O(1) approximation factor in prior results, and (c) the approach applies to other cases of compressible signals with tighter bounds. For the exponentially decaying and k-sparse family, the size of T is only O(k 2 polylog(n)). The algorithms are simple and easy to implement, without linear programming and without running into precision-issues inherent in the choice of Gaussian random T in prior methods. 2. We address the issue of obtaining per-instance guarantees for each signal. We present a randomized algorithm that on any given A, produces a T with O( ǫk2 polylog(n)) rows such that in time linear in O(k polylog(n)), we can reconstruct a R with A − R22 ≤ 1 (1 + ε)A − Rkopt 22 , with probability at least 1 − nO(1) . Notice crucially that this second result does not produce a T that works for all pcompressible signals, merely, that on any given signal A, we can produce a good R with high probability. In this regime, which is quite different from the regime in earlier papers on Compressed Sensing where a fixed T works for all p-compressible signals, many results in the Computer Science literature apply, in particular, from learning theory [20, 21], streaming algorithms [12, 11] and complexity theory [1]. Some of these results do not completely translate to our scenario: the learning theory approaches assume that the signal can be probed in the light of the results of prior measurements (this is similar to adaptive group testing). Other results can be thought of as producing a T with O(k 2+O(1) polylog(n)) rows which is improved by our result here. An exception is the result in [13] which works by sampling (that is, finding A, vi where vi,j = 1 for some j and is 0 elsewhere) for the Fourier basis, but can be thought of as solving our problem using O(k polylog(1/ε, log n, log A)) measurements. Our result improves [13] in the term polylog(A2 ) which governs the number of iterations in [13]. Finally, we extend to the case when the measurements are noisy—an important practical concern articulated in [14]—and obtain novel results that give per-instance approximation results. Technical Overview. The intuitive way to think about these problems is to consider combinatorial group testing problems. We have a set U = [n] of items and a set D of distinguished items, |D| ≤ k. We identify the items in D by performing group tests on
284
G. Cormode and S. Muthukrishnan
subsets Si ⊆ U whose output is 1 or 0, revealing whether that subset contains one or more distinguished items, that is |Si ∩ D| ≥ 1. There exist collections of O((k log n)2 ) nonadaptive tests which identify each of the distinguished items precisely. There is a strong connection between this problem and Compressed Sensing. We can treat θi ’s as items and the largest (in magnitude) k as the members of D. Each test set Si can be written as its characteristic vector χSi of n dimensions. A difficulty arises in interpreting the outcome of A, χSi . The discussion so far has been entirely combinatorial, but the outcome of this linear-algebraic operation of inner product must be interpreted as a binary outcome to apply standard combinatorial group testing methods. In general, there is no direct connection between A, χSi and presence or absence of the first k coefficients in Si when the signal is from the p-compressible class. This is also the reason that prior work on this problem has delved into the linear-algebraic and geometric structure of the problem. Our approach here is combinatorial. Our first results show that one can focus attention on some k ′ > k coefficients, in order to meet our error guarantees. Then, we show that separating the k ′ coefficients using group testing methods serves as a filter and subsequently, using a different set of group tests serves to certify and estimate the largest k coefficients in magnitude. This use of two parallel sets of group tests is novel. For the second set of results, combinatorial group testing has been applied previously in Learning Theory [20, 21], Streaming Algorithms [11, 12, 6] and Complexity Theory [1]. Here, our contribution is to adapt the approach from our first set of results and provide a tighter analysis of the error in terms of Rkopt − A2 rather than in terms of A2 as is more typical. Note. Preliminary versions of this paper have appeared as technical reports [7], which are superseded by the results here. Several proofs have been omitted, for space reasons.
2 Preliminaries Definition 1. A collection S of l subsets of {1 . . . n} is called k-selective if for any X such that X ⊂ {1 . . . n} and |X| ≤ k, there exists Si ∈ S such that |Si ∩ X| = 1, i.e. there is a member of X which is separated from all other members of X in some Si . Definition 2. A collection S of m subsets of {1 . . . n} is called k-strongly selective if for any X with |X| ≤ k, and for all x ∈ X there exists Si ∈ S such that Si ∩ X = {x}, i.e. every member of X occurs separated from all other members of X in some Si . We note that the k-strongly selectivity is a stronger condition than k-selectivity, and so the former implies the latter. Explicit constructions of both collections of sets are known for arbitrary k and n. Strongly selective sets are used heavily in group testing [10], and can be constructed using superimposed codes [19] with m = O((k log n)2 ). Indyk provided explicit constructions of k-selective collections of size l = O(k logO(1) n), where the power depends on the degree bounds of constructions of disperser graphs [16]. Probabilistic constructions are also possible [5] of near-optimal size O(k log(n/k)), which yield a more expensive Las Vegas-style algorithm for constructing such a set in O(nk poly(k log n)): after randomly constructing a collection of sets, verify the required property holds for all (nk ) choices of X.
Combinatorial Algorithms for Compressed Sensing
285
We will also make use of the Hamming code matrix Hn , which is the ⌈1 + log2 n⌉ matrix whose ith column is 1 followed by the binary representation of i. We will combine matrices together to get larger matrices by (a) concatenating the rows of N to M and get matrix denoted M N , or (b) a Tensor product-like operation we denote ⊗, defined as follows: Definition 3. Given matrices V and W of dimension v × n and w × n respectively, define the matrix (V ⊗ W ) of dimension vw × n as (V ⊗ W )iv+l,j = Vi,j Wl,j .
3 Non-adaptive Constructions We must describe the construction of a set of m (row) vectors Ψ ′ that will allow us to recover sufficient information to identify a good set of coefficients. We treat Ψ ′ as an m×n matrix whose ith row is Ψi′ . When given the vector of measurements Ψ ′ A we must find an approximate representation of A. Ψ ′ is a function of Ψ , and more strongly (as is standard in compressed sensing) we only consider matrices Ψ ′ that can be written as a linear combination of vectors from the dictionary Ψ , i.e., Ψ ′ = T Ψ , for some m × n transform matrix T . Thus Ψ ′ A = T (Ψ A) = T θ. Recall that the best representation under Ψ using k coefficients is given by picking k largest coefficients from θ. We use T to let us estimate k large coefficients from θ, and use these to represent A; we show that the error in this representation can be tightly bounded. Observe that we could trivially use the identity matrix I as our transform matrix T . From this we would have T θ = θ, and so could recover A exactly. However, our goal is to use a transform matrix that is much smaller than the n rows of I, preferably polynomial in k and log n. In general for most classes of signals, the only way to achieve exact recovery of the optimal representation is to take a linear number of measurements: Lemma 1. Any deterministic construction which returns k coefficients and guarantees error exactly Rkopt − A2 requires Θ(n) measurements. 3.1 p-Compressible Signals In the p-compressible case the coefficients (sorted by magnitude) obey |θi | = O(i−1/p ) for appropriate scaling constants and some parameter p. Previous work has focused on n the cases 0 < p < 1 [4, 9]. Integrating shows that i=k+1 θi2 = Rkopt − A22 = O(k 1−2/p ). Our results, like those of [4, 9], are stated with respect to the error due to the worst case over all signals in the class, which we denote Ckopt 2 = O(k 1−2/p ). For any signal that is p-compressible with fixed p and Cp it follows that Rkopt −A2 ≤ Ckopt 2 . We give two results on the p-compressible case, one that applies when p < 12 , the other that applies for all 0 < p < 1 provided the p-compressible case is tight, i.e. |θi | = θ(i−1/p ). The measurements made are the same, but the analysis varies. Our transform collects information based on two collections of strongly separating sets. The first ensures that sufficient separation occurs, allowing all large coefficients to be recovered. The second allows accurate estimates of the weight of each coefficient to be made.
286
G. Cormode and S. Muthukrishnan
Transform Definition. We define our transform matrix as follows. Let k ′ and k ′′ be functions of k, ε, log n to be defined later. Let S be a k ′ -strongly separating collection of sets (so that the number of sets in the collection is k ′′ ), and write T1 as the matrix formed by the concatenation of χSi for all Si in S. Similarly, let R be a k ′′ -strongly separating collection of sets, andwrite T2 as its characteristic matrix. We form our transform matrix Tp as (T1 ⊗ H) T2 . The intuition is that rather than ensuring separation for just the k largest coefficients, we will guarantee separation for the top-t coefficients (even though we do not know a priori which those top-t coefficients are), where t is chosen so that the remaining coefficients are so small that even if taken all together, the error introduced to the estimation of any coefficient is still within our allowable error bounds. Reconstruction Algorithm. Our algorithm for recovering a representation from the results of the measurements Tp Ψ A is as follows: for each set of ⌈1+log n⌉ measurements due to Si ⊗ H, we recover x0 . . . x⌈log n⌉ = (Si ⊗ H)Ψ A, and decode identifier ji as ji =
log n b=1
2b−1
|xb | − min{|xb |, |x0 − xb |} . max{|xb |, |x0 − xb |} − min{|xb |, |x0 − xb |}
This generates a set of coefficients J = {j1 , j2 . . . jk′′ }. We then use the measurements due to T2 to estimate the weight of each coefficient named in J: for each j ∈ J, we set θˆj = χRi Ψ A for J ∩ Ri = {j}. The strong separation properties of R ensure that there will be at least one such Ri , and if there is more than one, then we can pick one arbitrarily. Our output is the set of k pairs (j, θˆj ) with the k largest values of |θˆj |. Lemma 2. Consider the case when the p-compressible case is tight within constant 2 factors for all coefficients, i.e. |θi | = Θ(i−1/p ). Let k ′ = c′ (kε−p )1/(1−p) and k ′′ = log n 2 ′ ′′ c′′ (k ′ log k′ ) for appropriately chosen c and c . ′ ′1−p Let K denote the set of the k largest coefficients. 2
ε 1. ∀1 ≤ j ≤ n : θj2 ≥ 25k Ckopt 22 ⇒ j ∈ K ′ ′ 2. ∀j ∈ K : j ∈ J. 3. ∀j ∈ J : |θˆj − θj | ≤ 5√ε k Ckopt 2 .
Proof. Observe the square of the (absolute) sums of coefficients after removing that n the top t is ( i=t+1 |θi |)2 = O(t2−2/p ). Over the whole class of p-compressible signals, this is bounded by O(t2−2/p /k 1−2/p )Ckopt 22 . Substituting in t = k ′1−p ≥ n ε2 Ckopt 22 ; C(kε−p )1/(1−p) for an appropriate constant C ensures ( i=k′ +1 |θi |)2 ≤ 25k n ′1−p . This shows (1). Further, we have |θj | ≥ i=k′ +1 |θi |, provided j < k Now consider θj that satisfies the condition in the lemma. Although K ′ is unknown, we can be sure that, since R is k ′ -strongly separating, there is at least one set Ri such that K ′ ∩ Ri = {j}, and more strongly, K ′′ ∩ Ri = {j}, where K ′′ is the set of the involving this set, x = k ′ largest coefficients. Consider the vector of measurements (χRi ⊕ H)Ψ A. When Hj,b = 1, |xb | ≥ |θj | − l=j∈Ri Hl,b |θl | and |x0 − xb | ≤ n 2 2 l=j∈Ri Hl,b |θl |+ l=j∈Ri (1−Hl,b )|θl |. Since θj > ( l=k′ +1 |θl |) we have |θj | > (1−Hl,b )|θl |. Hence min{|xb |, |x0 −xb |} = |x0 −xb |, and max{|xb |, |x0 −xb |} = |xb |.
Combinatorial Algorithms for Compressed Sensing
287
|xb |−min{|xb |,|x0 −xb |} max{|xb |,|x0 −xb |}−min{|xb |,|x0 −xb |} = 1 = Hj,b . Symmetrically, the results are b |−min{|xb |,|x0 −xb |} reversed when Hj,b = 0, where max{|xb|x|,|x = 0 = Hj,b . Thus 0 −xb |}−min{|xb |,|x0 −xb |} log n b−1 the decoded identifier ji = b=1 2 Hj,b = j and so j ∈ J, showing (2). For (3), observe that |J| ≤ k ′′ , since each Ri ∈ R generates at most one j ∈ J, ′′ ′
Thus
and k is chosen as the number of sets forming the collection of k -strongly separating sets. Hence, we can guarantee for each j ∈ J there is at least one Si such that J ∩ Si = j. We chose our k ′ to be sufficiently large that we can identify the k ′1/(1−p) = O(kε−p )1/1−p ) largest coefficients. Since J contains the identities of the (kε−p )1/1−p largest coefficients, we can choose the estimate of θj as any measurement of θj that avoids sure that |θˆj − θj | = |χRi Ψ A − θj | = n of J. Thus, we can be all other members ε | l∈Ri ,l=j θl | ≤ l=(kε−p )1/1−p +1 |θl | ≤ 5√k Ckopt 2 . Lemma 3. Consider the p-compressible case with p < 21 . Let k ′ = c′ (kε−p )1/(1−2p) log n 2 ′ ′′ and k ′′ = c′′ (k ′ log k′ ) for appropriately chosen c and c . ′ ′ Let K denote the set of the k largest coefficients. 2
ε Ckopt 22 ⇒ j ∈ J 1. ∀1 ≤ j ≤ n : θj2 ≥ 25k 2. ∀j ∈ K ′ : θj2 > ck k ′2−2/p ⇒ j ∈ J, for appropriate scaling constant ck . 3. ∀j ∈ J : |θˆj − θj | ≤ 5√ε k Ckopt 2 .
Proof. Consider j ≤ k ′ . We know that R is k ′ -strongly separating, so there is some set Ri so that K ′ ∩ Ri = {j}. From the vector of measurements involving this set, we know that the identity j will be recovered, as in the previous lemma, provided that j is the majority items in this set, i.e. if |θj | > l=j∈Ri |θl |. This can be at most ′1−1/p ′1−1/p . Provided |θj | > ck k , j will be found and so j ∈ J, l>k′ |θl | ≤ ck k showing (2). By our choice of k ′ , ck k ′2−2/p ≥ 5√ε k Ckopt 2 , so (2) implies (1). |θl |, For (3), we consider the error in the estimation of θj . We have |θˆj − θj | ≤ l∈J
and from (2), we have that l ∈ J ⇒ θj2 ≤ k ′2−2/p ∨ l > k ′ (for p ≥ 12 , this bound is not useful). Hence, |θl | + |θl | ≤ ck (k ′ − 1)k ′1−1/p + ck k ′1−1/p ≤ ck k ′2−1/p . |θˆj − θj | ≤ lk′
By our choice of k ′ and ck , we ensure that ck k ′2−1/p ≤
ε √ Ckopt 2 , 5 k
as required.
ˆ Lemma 4 (Reconstruction accuracy). Given θ(A) = {θˆi (A)} such that (θˆi − θi )2 ≤ ε2 ε2 k 2 2 k 2 ˆ 25k Copt 2 if θi ≥ 25k Copt 2 , picking the k largest coefficients from θ(A) gives an 2 k 2 k error Ropt − A2 + εCopt 2 k-term representation of A. Proof. As stated in the introduction, nthe error from picking the k largest coefficients exactly is θ(A) − θ(Rkopt )22 = i=k+1 θi2 (where we index the θi s in decreasing order of magnitude). We will write φˆi for the ith largest approximate coefficient, and φi for its exact value. Let π(i) denote the mapping such that φi = θπ(i) , and let σ(i) denote a bijection satisfying σ(i) = j ⇒ (i > k ∧ π(i) ≤ k ∧ j ≤ k ∧ π(j) > k). Picking the k largest approximate coefficients has energy error
288
G. Cormode and S. Muthukrishnan
R − A22 = =
k
(φi − φˆi )2 +
(φi − φˆi )2 +
i=1
i≤k
n
φ2i
i=k+1
φ2i +
i≤k
φ2i
i>k,π(i)≤k
i>k,π(i)>k
ε2 ≤ Ck 2 + 25k opt 2
φ2i +
i>k,π(i)>k
φ2i
i>k,π(i)≤k
Consider i such that i > k but π(i) ≤ k: this corresponds to a coefficient that belongs ε2 Ckopt 22 , in the top-k but whose estimate leads us to not choose it. Then either φ2i ≤ 2k i.e. the top-k coefficient is small compared to the optimal error, or else our estimate of φ2σ(i) was too high. In this case φˆ2i < φˆ2σ(i) but φ2σ(i) ≤ φ2i . Assuming this, we can write φ2i − φ2σ(i) = (φi + φσ(i) )(φi − φσ(i) )
= (|φi | + |φσ(i) |)(|φi | − |φσ(i) |)
= (2|φσ(i) | + |φi | − |φσ(i) |)(|φi + φˆi − φˆi | − |φσ(i) + φˆσ(i) − φˆσ(i) |) ≤ (2|φσ(i) | + |φi | − |φσ(i) |)(|φi − φˆi | + |φσ(i) − φˆσ(i) | + |φˆi | − |φˆσ(i) |) 2ε ε ≤ (2|φσ(i) | + √ Ckopt 2 )( √ Ckopt 2 ) 5 k 5 k
ε2 k 2 25k Copt 2 we can immediately write k ε C 2 ε Ck opt 2 ε √ Ck 2 ) φ2i − φ2σ(i) ≤ φ2i ≤ 5√optk · 5√ ≤ (2|φσ(i) | + 5√ Ckopt 2 )( 52ε opt k k k Substituting this bound into the expression above, we use the facts that kj=1 |aj | ≤ √ k k( j=1 a2j )1/2 and i>k,π(i)≤k φ2σi = j≤k,π(j)>k φ2j , to bound R − A22 by
In the case that φ2i ≤
i≤k,π(i)≤k
ε Ck 2 + 25k opt 2
φ2i
i>k,π(i)>k
ε 2ε (φ2σ(i) + (2|φσ(i) | + √ Ckopt 2 )( √ Ckopt 2 )) 5 k 5 k i>k,π(i)≤k √ √ ε k 2ε ε ) √ Ckopt 22 + φ2i ≤ Ckopt 22 + (2 k + 25 5 5 k π(i)>k 23ε k 2 2 Copt 2 + ≤ θi < Rkopt − A22 + εCkopt 22 25 i>k Theorem 2. We can construct a set of measurements for a signal A in time polynomial in k and n and return a R for A of at most k coefficients θˆ under Ψ such that θˆ − θ22 = R − A22 < Rkopt − A22 + εCkopt 22 , and (i) if p < 12 , then the number of measurements is O((kεp )4/(1−2p) log4 n) and the time to produce the coefficients from the measurements is O((kεp )6/(1−2p) log6 n). (ii) if the p-compressible case is 2 tight, then the number of measurements is O((kεp )4/(1−p ) log4 n) and the time to find 2 coefficients is O((kεp )6/(1−p) log6 n). +
Combinatorial Algorithms for Compressed Sensing
289
Combining the above lemmas shows that the result of the algorithm has the desired accuracy. The reconstruction time can be broken down into the time to build J from the coefficients and the time to estimate the weight of each j in J. Building J takes time O(k ′′ log n), since it requires a linear pass over the results of the measurements. To choose the location to find estimates quickly, we can build a vector y = T2 χTJ in time O(|J|(k ′′ log n)2 ), by selecting and summing the necessary columns. Then for each j ∈ J, we find some i such that yi = T2 j,i = 1 and return the measurement (T2 Ψ A) as θˆj . This takes O((k ′′ log n)2 ) time per coefficient. Lastly, picking the k largest of the estimated coefficients can be done with a linear pass over them. The dominating cost is O(|J|(k ′′ log n)2 ) = O((k ′′ log n)3 ) The number of measurements is polynomial in k, log n (recall that p is fixed independent of n and A). We have not fully optimized the various polynomial factors, but still, our methods will not yield less than k 4 measurements, due to the use of the two collections of k-strongly separating sets. It is an open problem to further improve the number of measurements in explicit non-adaptive constructions. Note although we need to use p to define the measurements, we do not need the exact value of p. Rather, we need an upper bound on the true value of p (recall, the smaller the value of p, the faster the coefficients must reduce) — this is because our construction will simply take more coefficients than is necessary to get the required approximation accuracy. 3.2 Exponential Decay As in the p-compressible case we state our results for the exponential decay case relative to the worst case errorin the class for given α and Cα . In the case that |θi | ≤ Cα 2−αi , n we write Ckopt 22 = i=k+1 θi2 as the worst case error over the class.
Measurements. The set of measurements we make is similar to the p-compressible n)/ε) ), case at the high level, but differs in the details. We set k ′ = k + O( log((k log α ′′ ′ 2 ′ and k = O((k log n) ) As before, we build S, a k -strongly separating collection of sets, and write T3 as the concatenation of χsi for all Si ∈ S (k ′′ is chosen as the number of sets in the collection). However, we set Q to be a k ′′ -separating collection of sets (not strongly separating), and write T4 as its characteristic matrix. We form Tα = (T3 ⊗ H) T4 , and use Tα Ψ as the measurement matrix.
Reconstruction Algorithm. We recover a representation from the measurements from T3 ⊗ H as before, to build a set J of identifiers. To make our estimates, we proceed ˆ the vector of approximate coefficients. Initially θˆ = 0, and M = ∅. iteratively to build θ, Let j1 ∈ (J\M ) satisfy (J\M ) ∩ Qi = {j1 } (there will be at least one such Qi and ˆ and M = M ∪ {j1 }. We now proceed to find a new j1 ). We set θˆj = χQi (Ψ A − θ) j2 ∈ (J\M ) with (J\M ) ∩ Qi′ = {j2 } as the next coefficient to estimate, and proceed until J = M . We then return the k highest estimated coefficients as before. ′ Lemma 5. Let K ′ denote the set nof the k 2largest coefficients. 2 1. ∀1 ≤ j ≤ n : θj > ( l=k′ |θl |) ⇒ j ∈ J 2
ε Ckopt 2 ⇒ j ∈ J 2. ∀j ∈ K ′ : θj2 ≥ 25k 3. ∀j ∈ J : |θˆj − θj | ≤ 5√ε k Ckopt 2 .
290
G. Cormode and S. Muthukrishnan
Proof. To show (1) and (2), we must bound the tail sums coefficients of α-exponenof n 2 −2αk tially decaying signals. One can easily show that and i=k+1 θi ≤ cα 2 n 2 ′ −αk′ ( i=k′ +1 |θi |) ≤ cα 2 . Over the class of α-exponentially decaying signals, n ′ ( i=k′ |θi |)2 ≤ Cα 2−α(k −k) Ckopt 22 . Setting k ′ = k + O( α1 log kε ) gives ε2 Ckopt 22 . The remainder of the proof of (2) continues as in Lemma 2 ( ni=k′ |θi |)2 ≤ 25k (2), and (1) follows immediately as a consequence of the identification process. To show (3), we scale ε by a factor of O(kk ′′ ). Note that this does not affect the ask ′′ . This now ensures that the first coefficient j1 is estimated with ymptotic sizes of k ′ or n ε error |θˆj1 − θj1 | ≤ k ′ l=k′ +1 |θi | ≤ k5/2 Ckopt 2 . Now consider the estimation of the next coefficient j2 : it is possible that j2 and j1 occur in the sameset Qi′ , in which case the error is bounded by |θˆj2 − θj2 | ≤ |( l=j2 ,l∈Qi θl ) − θˆj | ≤ l=j1 ,l=j2 ,l∈Qi |θl | + 2 2 |θˆj − θj | ≤ ′ 2ε 5/2 Ck 2 ; else the error is bounded by ′ ε 5/2 Ck 2 as 1
1
(k log n)
opt
(k log n)
opt
mε before. One can therefore show inductively that |θˆjm − θjm | ≤ 5(k′ log Ckopt 2 , n)5/2 ε Ck 2 , as and so, since |J| ≤ k ′′ = O((k ′ log n)2 ), we have ∀j ∈ J.|θˆj − θj | ≤ √
required.
5 k
opt
Theorem 3. We can construct a set of O(k 2 polylog(n)) measurements in time polynomial in k and n. For any α-exponentially decaying signal A, from these measurements of A, we can return a representation R for A of at most k coefficients θˆ under Ψ such that θˆ − θ22 = R − A22 < Rkopt − A22 + εCkopt 22 . The time required to produce the coefficients from the measurements is O(k 2 polylog(n)) Proof. Using the results of Lemma 5 allows us to apply Lemma 4 and achieve the main theorem. For the time cost, we must first generate J, which takes time O(k ′′ log n), and then iteratively build the estimates. This can be done efficiently in time O(k ′′ polylog(n)) per coordinate, a constant number of operations on each of the O(k ′′ polylog(n)) measurements. For constant α and ε = O(poly(1/n)), we have k ′ = O(k), k ′′ = O((k log n)2 ) and the total number of measurements = k ′′ polylog(n) = O(k 2 logO(1) n). k-Support Case. We note that the same approach can be used to give an explicit con˜ 2 ) measurements for signals that have Rk − A2 = 0, i.e., there struction with O(k opt are at most k non-zero coefficients. This “k-support” case is a simplification of realistic signals, but has attracted interest in prior work (see [24] and references therein). The same approach outlined above, of using a combination of measurements based on k ′ -strongly separating sets and k ′′ -separating sets, with an appropriate setting of ˜ ˜ 2 ), is sufficient to recover the signal exactly. and k ′′ = O(k k ′ = O(k)
4 Randomized Constructions Here we focus on providing per-instance error estimates. For compressible signals (this section also works for arbitrary signals) one can give randomized constructions which guarantee to return a near-optimal representation for that signal, with high probability for each signal.
Combinatorial Algorithms for Compressed Sensing
291
Transform Definition. Instead of using collections of sets with guaranteed separating properties, we make use of sets defined implicitly by hash functions to give a randomized separation property. We also use a random ±1 valued vector to improve the accuracy of estimation of the coefficients. The necessary components are as follows: Separation Matrix M . M is a 0/1 s×n matrix with the property that for every column, exactly one entry is 1, and the rest are zero. We will define M based on a randomly chosen function g : [n] → [s], where Pr[g(i) = j] = 1/s for i ∈ [n], j ∈ [s]. Hence, Mi,j = 1 ⇐⇒ g(i) = j, and zero otherwise. The effect is to separate out the contributions of the coefficients: we say i is separated from a set K if ∀j ∈ K.g(i) = g(j). For our proofs, we require that the mapping g is only three-wise independent, and n we set s = O( k log ε2 ). This will ensure sufficient probability that any i is separated from the largest coefficients. Estimation Vector E. E is a ±1 valued vector of dimension n so Pr[Ei = 1] = Pr[Ei = −1] = 12 . We will use the function h : [n] → {−1, +1} to refer to E, so that Ei = h(i). For our proofs, we only require h to be four-wise independent. Lastly, we compose T from M , Hamming matrix H and E by: T = M ⊗ H ⊗ E. Reconstruction Procedure. We consider each set of inner-products generated by the row Mj . When composed with (H ⊗ E), this leads to 1 + log2 n inner products, ′ x0 . . . xlog n = (T Ψ A)j(1+log n) . . . θ(j+1)(1+log n)−1 . From this, we attempt to recover log n b−1 x2b −min {x2b ,(x0 −xb )2 } , and add a coefficient i by setting i = b=1 2 max {x2b ,(x0 −xb )2 }−min {x2b ,(x0 −xb )2 } ˆ We estimate θˆi = h(i)x0 , and output the k i to our set of approximate coefficients, θ. approximate coefficients obtaining the k largest values of |θˆi |. 2
ε Rkopt − Lemma 6 (Coefficient recovery). (1) For every coefficient θi with θi2 > 25k 2 A2 , there is constant probability that the reconstruction procedure will return i (over the random choices of g and h). ε2 Rkopt − A22 with (2) We obtain an estimate of θi as θˆi such that (θi − θˆi )2 ≤ 25k constant probability.
Proof. The outline of the proof is as follows: for each coefficient θi with θi2 > ε2 2 k constant probability that it is correctly re25k Ropt − A2 , we show that there is covered. Let xb = (Ψ ′ A)g(i)(1+log n)+b = g(j)=g(i) Hj,b h(j)θj . One can show that 2
ε 2 k (i) E(x2b ) ≤ Hi,b θi + O( k log n )Ropt − A2 and 2
4
ε ε 2 k 2 k 4 (ii) Var(x2b ) ≤ O( k log n θi Hi,b Ropt − A2 + k2 log2 n Ropt − A2 ). Using the Chebyshev inequality on both x2b and (x0 − xb )2 , and rearranging it can
then be shown that Pr[θi2 − Hi,b (x2b ) − (1 − Hi,b )(x0 − xb )2 ≤
Pr[(1 − Hi,b )x2b + Hi,b (x0 − xb )2 ≥ ables us to show that Pr[
θi2 2
]≤
2 9 log n .
θi2 2 ]
≤
2 9 log n
and
Combining these two results en-
x2b −min {x2b ,(x0 −xb )2 } max {x2b ,(x0 −xb )2 }−min {x2b ,(x0 −xb )2 } 5 9.
= Hi,b ] ≤
4 9 log n .
Thus,
the probability that we recover i correctly is at least For (2), we consider θˆi = h(i)x0 = h(i) g(j)=g(i) h(j)θj . One can easily verify θ2 ). We argue that with constant that E(θˆi ) = θi and Var(θˆi ) = E( g(j)=g(i),j =i
j
292
G. Cormode and S. Muthukrishnan
probability none of the k largest coefficients collide with i under g, and so in expectation assuming this event Var(θˆi ) = 1s Rkopt − A22 . Applying the Chebyshev inequality to this, we show (2) with (better than) constant probability: ˆ 2 ˆ Pr[|θi − θi | > ε Rk − A2 ] < 2 Var(θi ) ≤ 1 . 9k
opt
9 log n
ε k 2 9k Ropt −A 2 3
n ) measurements we obtain a set Lemma 7 (Failure probability). By taking O( ck log ε2 2 ε 2 ˆ ˆ of estimated coefficients θi such that (θi − θi ) ≤ 25k Rkopt − A22 with probability at least 1 − n1c .
Proof. In order to increase the probability of success from constant probability per coefficient to high probability over all coefficients, we will repeat the construction of T several times over using different randomly chosen functions g and h to generate the entries. We take O(c log n) repetitions: this guarantees that the probability of not ε2 Rkopt − A22 is n−c , polynomially small. We also obtain returning any i with θi2 > 25k O(c log n) estimates of θi from this procedure, one from each repetition of T . Each is within the desired bounds with constant probability at least 78 ; taking the median of these estimates amplifies this to high probability using a Chernoff bounds. T has 2 n m = s(log n + 1) = O( k log ) rows, O(c log n) repetitions gives the stated bound. ε2 3
n Theorem 4. We can construct a dictionary Ψ ′ = T Ψ of O( ck log ) vectors, in time ε2 2 ′ O(cn log n). For any signal A, given the measurements Ψ A, we can find a representation R of A under Ψ such that with probability at least 1 − n1c R − A22 ≤
(1 + ε)Rkopt − A22 . The reconstruction process takes time O( c
2
k log3 n ). ε2
The proof follows by combining the results of Lemma 6 with those of Lemma 4 to get the main result. We modify Lemma 4 to use Rkopt − A2 in place of Ckopt 2 ; the proof is essentially the same. It is easy to verify that the number of coefficients identified 2 n ) (taking time linear in m). by the first part of the reconstruction process is O( ck log ε We find an accurate estimate of each recovered coefficient by taking the median of O(c log n) estimates of each one. If we spend linear time or more on reconstruction, we can work with fewer measurements: n ) vectors, in time Theorem 5. We can construct a dictionary Ψ ′ = T Ψ of O( ck εlog 2 2 ′ O(cn log n). For any signal A, given the measurements Ψ A, we can find a representation R of A under Ψ such that with probability at least 1 − n1c R − A22 ≤ (1 + ε)Rkopt − A22 . The reconstruction process takes time O(cn log n).
The construction is similar to our main randomized result, but we do not use H and reduce s by a log n factor. Using only the separation and estimation matrices, we estimate each of the n coefficients, and take the k largest of them as before. By a similar ε2 Rkopt −A22 , argument to Lemma 6 (2), each coefficient is estimated with accuracy 25k and we can again apply Lemma 4. Tolerance to Error. Several recent works have shown that compressed sensing-style techniques allow accurate reconstruction of the original signal even in the presence of
Combinatorial Algorithms for Compressed Sensing
293
error in the measurements (i.e. omission or distortion of certain θi′ s). We adopt the same model of error as [3, 23]3 and show: Lemma 8. 1. If a fraction ρ = O(1) of the measurements are chosen at random to be corrupted in an arbitrary fashion, we can still recover a representation R with error R − A22 ≤ (1 + ε)Rkopt − A22 in time O(cn log n). 2. If only a ρ = O(log−1 n) fraction of the measurements are corrupted we can recover 2 n a representation R with error R − A22 ≤ (1 + ε)Rkopt − A22 in time O( kc εlog ). 2 Proof. 1. Consider the estimation of each coefficient in the process outlined in Theorem 5. Estimating θi takes the median of O(log n) estimates, each of which is accurate with constant probability. If the probability of an estimate being inaccurate or an error corrupting it is still constant, then the same Chernoff bounds argument guarantees accurate reconstruction. As long as ρ is less than a constant (say, 1/10) then every coefficient is recovered with error εRkopt − A2 , with high probability. 2. Consider the recovery of θi from T . We will be able to recover i provided the previous conditions hold, and additionally the some set of log n measurements of θi are not corrupted (we may still be able to recover i under corruption, but we pessimistically assume that this is not the case). Provided ρ ≤ 1/(3 log n) then each set of log n measurements are uncorrupted with constant probability at least 2/3 and with high probability i is recovered, and θi is estimated accurately (as in case (1)).
5 Concluding Remarks We have presented a simple combinatorial approach of two sets of group tests with different separation properties that yields the first known polynomial time explicit construction of a non-adaptive transformation matrix and a reconstruction algorithm for the Compressed Sensing problem. The polynomial dependency is large, but we emphasize that no other construction with polynomial creation time is known, and the cost may be improved in future work. Our approach yields other results including sublinear reconstruction, improved approximation in error and others. Given the excitement about Compressed Sensing in the Applied Mathematics community, we expect many new results soon. The main open problem is to reduce the number of measurements used by explicit algorithms: our result here gives a cost polynomial in k, which is not close to the linear factor k in the existential results of [4, 9, 23]. For the case of k-sparse signals, (which have no more than k nonzero coefficients) Indyk recently developed a set of measurements, near linear in k in number (but has other superlogarithmic factors in n) [17]. Another outstanding question is to tease apart other properties of Compressed Sensing results—such as their ability to measure in one basis and reconstruct in another—and study their algorithmics. Acknowledgments. We thank Ron Devore, Ingrid Daubechies, Anna Gilbert and Martin Strauss for explaining compressed sensing. 3
These consider the exact recovery of a signal by taking Ω(n) measurements, and so do not compare to our result above of approximately recovering a signal using o(n) measurements.
294
G. Cormode and S. Muthukrishnan
References 1. A. Akavia, S. Goldwasser, and S. Safra. Proving hard-core predicates by list decoding. In FOCS, pages 146–157, 2003. 2. E. Candès, J. Romberg, and T. Tao. Stable signals recovery from incomplete and inaccurate measurements. Unpublished Manuscript, 2005. 3. E. Candès, M. Rudelson, T. Tao, and R. Vershynin. Error correction via linear programming. In FOCS, 2005. 4. E. Candès and T. Tao. Near optimal signal recovery from random projections and universal encoding strategies. http://arxiv.org/abs/math.CA/0410542, 2004. 5. A. Clementi, A. Monti, and R. Silvestri. Selective families, superimposed codes, and broadcasting on unknown radio networks. In SODA, 2001. 6. G. Cormode and S. Muthukrishnan. What’s hot and what’s not: Tracking most frequent items dynamically. In ACM PODS, 2003. 7. G. Cormode and S. Muthukrishnan. Towards an algorithmic theory of compressed sensing. DIMACS Tech Report 2005-25, 2005. 8. R. Devore and G. G. Lorentz. Constructive Approximation, volume 303. Springer Grundlehren, 1993. 9. D. Donoho. Compressed sensing. Unpublished Manuscript, 2004. 10. D-Z Du and F.K. Hwang. Combinatorial Group Testing and Its Applications, volume 3 of Series on Applied Mathematics. World Scientific, 1993. 11. A. Gilbert, S. Guha, P. Indyk, Y. Kotidis, S. Muthukrishnan, and M. Strauss. Fast, smallspace algorithms for approximate histogram maintenance. In STOC, 2002. 12. A. Gilbert, S. Guha, P. Indyk, S. Muthukrishnan, and M. Strauss. Near-optimal sparse Fourier representation via sampling. In STOC, 2002. 13. A. Gilbert, S. Muthukrishnan, and M. Strauss. Improved time bounds for near-optimal sparse Fourier representations. In SPIE Conference on Wavelets, 2005. 14. J. Haupt and R. Nowak. Signal reconstruction from noisy random projections. Unpublished Manuscript, 2005. 15. IEEE International Conference on Acoustics, Speech, and Signal Processing, 2005. 16. P. Indyk. Explicit constructions of selectors and related combinatorial structures, with applications. In SODA, 2002. 17. P. Indyk. Personal communication, 2005. 18. Integration of Sensing and Processing, Workshop at IMA, 2005. 19. W.H. Kautz and R.R. Singleton. Nonrandom binary superimposed codes. IEEE Transactions on on Information Theory, 10:363–377, 1964. 20. E. Kushilevitz and Y. Mansour. Learning decision trees using the fourier spectrum. SIAM Journal on Computing, 22(6):1331–1348, 1993. 21. Y. Mansour. Randomized interpoloation and approximation of sparse polynomials. SIAM Journal of Computing, 24(2), 1995. 22. Compressed sensing website. http://www.dsp.ece.rice.edu/CS/. 23. M. Rudelson and R. Vershynin. Geometric approach to error correcting codes and reconstruction of signals. Unpublished Manuscript, 2005. 24. J. Tropp and A. Gilbert. Signal recovery from partial information via orthogonal matching pursuit. Unpublished Manuscript, 2005. 25. Y. Tsaig and D. Donoho. Extensions of compressed sensing. Unpublished Manuscript, 2004.
On the Existence of Truthful Mechanisms for the Minimum-Cost Approximate Shortest-Paths Tree Problem⋆ Davide Bil`o1 , Luciano Gual` a1 , and Guido Proietti1,2 2
1 Dipartimento di Informatica, Universit` a di L’Aquila, Italy Istituto di Analisi dei Sistemi ed Informatica, CNR, Roma, Italy {davide.bilo, guala, proietti}@di.univaq.it
Abstract. Let a communication network be modeled by a graph G = (V, E) of n nodes and m edges, where with each edge is associated a pair of values, namely its cost and its length. Assume now that each edge is controlled by a selfish agent, which privately holds the cost of the edge. In this paper we analyze the problem of designing in this non-cooperative scenario a truthful mechanism for building a broadcasting tree aiming to balance costs and lengths. More precisely, given a root node r ∈ V and a real value λ ≥ 1, we want to find a minimum cost (as computed w.r.t. the edge costs) spanning tree of G rooted at r such that the maximum stretching factor on the distances from the root (as computed w.r.t. the edge lengths) is λ. We call such a tree the Minimum-cost λ-Approximate Shortest-paths Tree (λ-MAST). First, we prove that, already for the unit length case, the λ-MAST problem is hard to approximate within better than a logarithmic factor, unless NP admits slightly superpolynomial time algorithms. After, assuming that the graph G is directed, we provide a (1 + ε)(n − 1)approximate truthful mechanism for solving the problem, for any ε > 0. Finally, we analyze a variant of the problem in which the edge lengths coincide with the private costs, and we provide: (i) a constant lower bound (depending on λ) to the approximation ratio that can be achieved -approximate truthful by any truthful mechanism; (ii) a 1 + n−1 λ mechanism. Keywords: Algorithmic Mechanism Design, Bicriteria Network Design Problems, Broadcasting Tree, Truthful Mechanisms.
1
Introduction
Mechanisms are a classical concept of the theory of non-cooperative games [15]. In these games there are several independent agents that have to work together in order to optimize a global objective function. However, each agent has its ⋆
Work partially supported by the Research Project GRID.IT, funded by the Italian Ministry of Education, University and Research, and by the European Union under IST FET Integrated Project 015964 AEOLUS and COST Action 293 GRAAL.
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 295–309, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
296
D. Bil` o, L. Gual` a, and G. Proietti
own valuation function and may lie in the hope of getting a higher profit. This leads to economically suboptimal resource allocation and is therefore undesirable. The main objective of mechanism design theory is to study how to incentive the agents in order to cooperate with the solving algorithm. A mechanism is a pair M = g(·), p(·), where g(·) is an algorithm computing a solution, and p(·) specifies the payments provided to the agents. Informally, a mechanism is truthful if its payments guarantee that agents are not stimulated to lie. Recently, there was a growing attention towards the question of designing a truthful mechanism by taking into account the computational complexity issues concerned with the underlying problem. This is exactly the topic of algorithmic mechanism design (AMD) for selfish agents. In their seminal paper concerned with AMD [14], Nisan and Ronen addressed the classic shortest path problem. This problem enjoys the property of being utilitarian. For utilitarian problems, there exists a well-known class of truthful mechanisms, i.e., the Vickrey-ClarkeGroves (VCG) mechanisms [20, 4, 6], and therefore the shortest path problem can be solved optimally. Another well-known class of truthful mechanisms is the class of one-parameter mechanisms [2]. Informally, a one-parameter mechanism applies to mechanism design problems where the information held by each agent can be expressed by a single parameter. Recently, in [11] the authors provided a general framework for designing truthful mechanisms for a subclass of oneparameter problems, called binary demand games, in which the agents’ only available actions are to take part in the a game or not to. By exploiting the results in [14, 2], in a sequel of papers efficient truthful mechanisms have been designed for solving several network design problems [1, 7, 8, 10, 14, 18]. In this paper we continue in this direction, by focusing on the following problem: Given a graph G = (V, E) with n nodes and m edges, and with two functions c(·) and l(·) mapping edges to positive real numbers, called the cost and the length of an edge, respectively, we want to design a broadcasting tree network balancing total cost and distances from the source node. More precisely, given a root node r ∈ V and a real value λ ≥ 1, we want to find a minimum cost (w.r.t. to c(·)) spanning tree of G rooted at r such that the maximum stretching factor on the distances (w.r.t. to l(·)) from the root is λ. We call such a tree the Minimum-cost λ-Approximate Shortest-paths Tree (λMAST). We will address the problem under the assumption that each edge of G is controlled by a selfish agent, which privately holds the cost of the edge, while edge lengths are supposed to be public. This setting reflects a realistic scenario in which distances (i.e., transmission delays) between nodes are public, since induced by the everybody known physical layer of the network, while effective costs of transmission are unknown, since the various network components may be given in concession to private managers. Leaving aside the non-cooperativeness aspect, our problem falls within the class of bicriteria network design problems [13]. In this class of problems, we are given a graph and two minimization objectives (under different edge-weight functions), with a budget specified on the first, and we have to find a subgraph – from a given set of feasible solutions – that minimizes the second objective
Truthful Mechanisms for the Min-cost Apx Shortest-Paths Tree
297
subject to the budget on the first. In our specific case, the budget is defined by the parameter λ on the distances. To the best of our knowledge, despite of its apparent naturalness, the λ-MAST has been addressed in the past only when the two edge-weight functions coincide [12]. In the rest of the paper, we will refer to this special case as to the single-weighted case. With this restriction, in [12] the authors studied the more general (α, β)-Light Approximate Shortest-path Tree ((α, β)-LAST) problem, namely the problem of finding, given two values α, β ≥ 1 and a node r ∈ V , a spanning tree of G rooted at r such that: (i) for every vertex v ∈ V , the distance between r and v in T is at most α times the shortest distance from r to v in G, and (ii) the weight of T is at most β times 2 , the weight of a minimum spanning tree (MST) of G. For α > 1 and β ≥ 1 + α−1 this problem has been shown to be polynomial-time solvable. On the other hand, 2 , the authors proved that deciding whether a for α > 1 and 1 ≤ β < 1 + α−1 given graph contains an (α, β)-LAST rooted at a given vertex is NP-complete. From these results, it immediately follows that: (i) the λ-MAST problem is NPhard, and (ii) in its single-weighted formulation, it can be approximated within 2 ), for any λ > 1. a factor of (1 + λ−1 In this paper, we first show that in our biweighted formulation, the λ-MAST problem is considerably hard. Indeed, we show that it has no polynomial time O(log log n λ) . (1−o(1)) ln n−2 λ -approximate algorithm, unless NP ⊆ DTIME (n/λ) Afterwards, we turn our attention to the problem of designing a truthful mechanism for it, and we point out the existence of a polynomial time approximate oneparameter truthful mechanism, with a performance guarantee of (1 + ε)(n − 1), for any ε > 0. Unfortunately, such mechanism applies to directed graphs only. Due to lack of space, we defer the detailed presentation of such mechanism to the full version of this paper. Finally, we also study the problem of designing a truthful mechanism for the single-weighted case, but also here we obtain rather negative results. Indeed, we prove a lower bound (depending on λ) to the approximation ratio that can be achieved by any (even exponential time) truthful mechanism. On a positive side, after showing that the algorithm in [12] cannot -approximate be used to design a truthful mechanism, we present a 1 + n−1 λ truthful mechanism which can be computed in O(m + n log n) time. The paper is organized as follows: in Section 2 we give the definition of the problem and we recall some basic notions from the mechanism design theory. In Section 3 we present an inapproximability result for the problem, while in Section 4 we provide an approximate truthful mechanism for directed graphs. Finally, in Section 5 we analyze the existence of truthful mechanisms for the single-weighted version of the problem.
2 2.1
Preliminaries Problem Definition and Notation
Let G = (V, E) be a (either undirected or directed) graph, with n nodes and m edges, and with two different functions c(·) and l(·) mapping edges to positive real numbers. We will call c(e) the cost of e, and l(e) the length of e. A graph
298
D. Bil` o, L. Gual` a, and G. Proietti
H = (V (H), E(H)) is called a subgraph of G if V (H) ⊆ V and E(H) ⊆ E. If V (H) = V then H is called a spanning subgraph of G. A simple path P (or a path for short) from v1 to vk in G is a subgraph with V (P ) = {v1 , . . . , vk | vi = vj for i = j} and E(P ) = {ei = (vi , vi+1 ) | 1 ≤ i < k}, and it is denoted by (v1 , . . . , vk ). Given a source node r and a destination node s, a path in G from r to s is a shortest path, say PG (r, s), if the sum of its edge lengths (called distance, and denoted by dG (r, s)) is minimum. We define the total cost of a spanning subgraph H of G as c(H) = e∈E(H) c(e). In this paper, we will focus on the following problem: Given a source node r, and a real value λ ≥ 1, the λ-MAST problem asks for computing a cheapest (i.e., of minimum total cost) spanning tree T of G which satisfies the following distance constraint: for each node v ∈ V , the distance from r to v in T is at most λ times the distance in G between the same nodes, i.e., dT (r, v) ≤ λ dG (r, v). 2.2
Algorithmic Mechanism Design
Algorithmic mechanism design deals with algorithmic problems in a noncooperative setting, in which part of the input is owned by selfish agents. As such agents may lie about their parts of input, they are capable of manipulating the algorithm. The main task of the mechanism design theory is the study of how to pay the agents in order to convince them to cooperate with the algorithm. We will deal with the case in which each agent controls a single link of a communication network. We provide a simplified formalization below, and we refer the interested reader to [14, 2]. For an edge e of G owned by a selfish agent ae , we denote by te the private information held by ae . We call te the (private) type of the agent ae . Each agent has to declare a (public) bid be to the mechanism. We will denote by t the vector of private types, and by b the vector of bids. For a given optimization problem defined on G, let F denote the corresponding set of feasible solutions. For each feasible solution x ∈ F, some measure function μ(x, t) is defined, which depends on the true types. A mechanism is a pair M = g(b), p(b), where g(b) is an algorithm that, given agents’ bids, computes a solution, and p(b) is a scheme which describes the payments provided to the agents. A mechanism has a runtime of O(f (n)) if g(·) and p(·) are computable in O(f (n)) time. For each solution x, ae incurs a cost νe (te , x) (sometimes called valuation of ae w.r.t. x). The utility of an agent is defined as the difference between the payment provided by the mechanism and its cost w.r.t. the computed solution. Each agent tries to maximize its utility, while an exact mechanism aims to compute a solution which optimizes μ(x, t), but of course it does not know t directly. Similarly, if we denote by ε(n) a positive real function of the input size n, an ε(n)-approximate mechanism returns a solution g(b) whose measure comes within a factor ε(n) from the optimum. In a truthful mechanism this tension between the agents and the system is resolved, since each agent maximizes its utility when it declares its type, regardless of what the other agents do. Moreover, a mechanism design problem is called utilitarian if its measure function satisfies μ(x, t) = e∈E νe (te , x). For utilitarian problems, there
Truthful Mechanisms for the Min-cost Apx Shortest-Paths Tree
299
exists a well-known class of truthful mechanisms, i.e., the Vickrey-Clarke-Groves (VCG) mechanisms [20, 4, 6]. Basically, VCG-mechanisms handle arbitrary valuation functions, but only utilitarian problems. In [2], Archer and Tardos have shown how to design truthful mechanisms for non-utilitarian problems under the assumption that the problem is one-parameter. A problem is said one-parameter if: (i) the type of each agent ae can be expressed as single parameter te ∈ R, and (ii) each agent’s valuation has the form νe (te , x) = te we (b), where we (b) is called work curve for agent ae , i.e., the amount of work for ae depending on the output specified by the mechanism algorithm, which in its turn is a function of the bid vector b. In [2], it is shown that for one-parameter problems, a sufficient condition for truthfulness is given by a particular monotonicity property of the mechanism algorithm. Let b be the vector of the bids of the agents, and let b−e denote the vector of all bids besides c(e); the pair (b−e , c(e)) will denote the vector b. If we fix b−e , a monotone algorithm defines a threshold value θe such that if ae bids no more than θe , then e will be selected, while if ae bids above θe , e will not be selected. Then, the following holds: Theorem 1 ([2]). A one-parameter mechanism M = g(·), p(·) is truthful if and only if g(·) is monotone and the payment for each agent is defined as its threshold value if it owns a selected edge, and 0 otherwise. We will consider the case in which the type of each agent ae represents the true cost incurred for forwarding a message through the link e, denoted by cˆ(e) ∈ R+ . Under these assumptions, the non-cooperative λ-MAST problem can be handled through a one-parameter mechanism. Indeed, for each agent ae , we can rewrite c(e), g(b)) = cˆ(e) we (b), where we (b) is equal to 1 if e the valuation of ae as νe (ˆ belongs to the solution computed by the mechanism, 0 otherwise. Notice that this assumption on the work curve also implies that the λ-MAST problem is a binary optimization demand game [11].
3
Hardness of the λ-MAST Problem
In this section we prove an inapproximability result for the λ-MAST problem. This result is obtained by a reduction (preserving the approximation) from the Set Cover Problem (SCP). An instance I = O, S for the SCP consists of a set O = {o1 , . . . , oh } of h objects, and a set S = {S1 , . . . , Sℓ } of ℓ subsets of O. The objective is to find a minimum-size collection of subsets in S whose union is O. In [5] it is shown that SCP cannot be approximated within (1 − o(1)) ln h, unless NP ⊆ DTIME(hO(log log h) ). The same result holds even for the case ℓ ≤ h [5]. The following holds: Theorem 2. Let λ > 1 be a real. Then the λ-MAST problem has no polynomialtime approximate algorithm with a performance guarantee better than (1 − O(log log n λ ) , even o(1)) ln n−2 λ , where n ≥ λ + 2, unless NP ⊆ DTIME (n/λ) for the unit length case.
300
D. Bil` o, L. Gual` a, and G. Proietti r 1
1 ′
si1
si1
si⌊L/2⌋−1 si⌊L/2⌋
0
′
p
0
0
0
v1j
0
0
si⌊L/2⌋−1 ′
si⌊L/2⌋
j v⌊L/2⌋−1 j v⌊L/2⌋
Fig. 1. The reduction of Theorem 2 when L is odd. Edges with cost greater than ℓ are omitted. Note that here oj belongs to Si , but not to Si′ .
Proof. Let L = ⌊λ⌋ and let I = O, S be an instance for the SCP with ℓ ≤ h, and h such that L ≤ hk for some integer k. From I we build an instance I = G, c, l, r, λ for the λ-MAST problem in the following way (see Figure 1). Graph G is complete and its node set is defined as follows: – – – –
a node r, which is the source; ⌊L/2⌋ nodes si1 , . . . , si⌊L/2⌋ , for each Si ∈ S; j , for each oj ∈ O; ⌊L/2⌋ nodes v1j , . . . , v⌊L/2⌋ a node p only if L is odd.
The costs of the edges in G are defined as follows: i c(r, i s1 )i = 1 for each Si ∈ S; c sk , sk+1 = 0, k = 1, . . . , ⌊L/2⌋ − 1 , for each Si ∈ S; j j c vk , vk+1 = 0, k = 1, . . . , ⌊L/2⌋ − 1 , for each oj ∈ O; c si⌊L/2⌋ , v1j = 0, for each Si and for each oj such that oj ∈ Si ; if L is even then c si⌊L/2⌋ , sj⌊L/2⌋ = 0, for each Si , Sj ∈ S, otherwise i s⌊L/2⌋ , p = 0, for each Si ∈ S; – all other edges have a cost greater than ℓ.
– – – – –
Every edge has length 1 and the stretch factor is λ. Notice that, in any λMAST, the distance between any node v and r must be less or equal than L. We claim that G has a λ-MAST of cost k if and only if the original instance of the SCP has a solution of size k. It is easy to see that a solution C for the SCP instance provides a solution for I with the same total cost. Indeed, the feasible solution is given by the spanning tree T defined as follows: – begin with H = (V (G), ∅); – for each set Si ∈ C, add to H the path r, si1 , si2 , . . . , si⌊L/2⌋ , and all the j paths si⌊L/2⌋ , v1j , v2j , . . . , v⌊L/2⌋ , for each oj ∈ Si ;
Truthful Mechanisms for the Min-cost Apx Shortest-Paths Tree
301
– for each set Sj ∈ / C, add to H either the path si⌊L/2⌋ , sj⌊L/2⌋ , sj⌊L/2⌋−1 , . . . , sj1 if L is even, or the path si⌊L/2⌋ , p, sj⌊L/2⌋ , sj⌊L/2⌋−1 , . . . , sj1 if L is odd, where Si ∈ C. – Let T be a shortest-paths tree (SPT) of H. Now, let T be a solution for I of total cost k ≤ ℓ (notice that such a solution j always exists). It is not hard to see that for each v⌊L/2⌋ , T must have a path j j j i i i r, s1 , s2 , . . . , s⌊L/2⌋ , v1 , v2 , . . . , v⌊L/2⌋ , for some Si ∈ S such that oj ∈ Si , oth-
erwise T has a total cost greater than ℓ. Hence, C = {Si ∈ S | (r, si1 ) ∈ E(T )} is a solution for I of size no more than the total cost of T . Since ℓ ≤ h, the number of nodes n is at most 2⌊L/2⌋h + 2. The claim now follows from the inapproximability result for the SCP proved in [5]. ⊓ ⊔ We conclude the section by noticing that Theorem 2 holds for directed graphs as well.
4
An Approximate Mechanism in Directed Graphs
In this section we claim the existence of an approximate one-parameter mechanism for the λ-MAST problem in directed graphs. Due to lack of space, we only provide the monotone algorithm representing the core of the mechanism, while we defer the formal proof of the approximation guarantee and the time complexity of the mechanism to the full version of the paper. Our algorithm uses the monotone algorithm in [3] (denoted by A) for the constrained shortest path problem. In such a problem one looks for a cheapest path from a source node r to a destination node s among paths of length L or less. This problem is (weakly) NP-hard, and it admits a pseudo-polynomial time algorithm, which is transformed by scaling techniques to a fully polynomial-time approximation scheme for the problem [9, 17]. Moreover, in [3] it is shown how to make the algorithm in [17] monotone. The algorithm computes a set Π = {πv : v ∈ V \{r}} of “light” paths, meaning that πv is a (1+ξ)-approximation of a cheapest path of length at most λ dG (r, v), for any ξ > 0. Then, it considers the subgraph H of G consisting of the union of all these paths. As H may not be an arborescence, then the algorithm needs to remove edges from H so that a feasible arborescence of G is returned. We point out that the removal steps (Lines 5–7) must be defined in order to guarantee both the monotonicity property and the feasibility of the solution. Indeed, for instance, computing a SPT of H yields to a non-monotone algorithm, since the composition of monotone algorithms is not necessarily monotone. In the full version of the paper, we will show that Algorithm 1 can be used to prove the following: Theorem 3. Given any ε > 0, there exists a (1 + ε)(n − 1)-approximate truthful mechanism for the λ-MAST problem on directed graphs, running in n n mn4 · log log(1+ε) · log 2−√n1+ε time. · log √1+ε−1 ⊓ ⊔ O √1+ε−1
302
D. Bil` o, L. Gual` a, and G. Proietti
Algorithm 1 Input: G = (V, E, c, l), r ∈ V , λ > 1, ξ > 0. Output: An arborescence T of G rooted at r. 1: for each v ∈ V do 2: find a (1 + ξ)-apx πv of a cheapest path from r to v with l(πv ) ≤ λdG (r, v); 3: end for 4: Let T be the digraph made up of the union of all edges in πv , ∀v ∈ V 5: for each v ∈ V do 6: remove all edges in T entering in v but that belonging to the shortest path in Π from r to v 7: end for 8: return T
5
The Non-cooperative Single-Weighted λ-MAST Problem
In this section we analyze the problem of designing a truthful mechanism for the single-weighted λ-MAST problem. 5.1
A Constant Lower Bound
We start by proving the following negative result: Theorem 4. Let λ > 1, and let p > x > 0. Then, it does not exist any truthful σ-approximate mechanism for the single-weighted λ-MAST problem, for any σ < p−x x L(λ, p, x) = 1 + min λ (x+p)+p−x , λ (p+x) . Proof. Let 0 < ε < x. Suppose by contradiction that M is a σ-approximate mechanism for the single-weighted λ-MAST problem, with σ < L(λ, p, x), and consider the instance of Figure 2, where all the edges on the path joining u and v have a small enough cost. It is easy to see that the MST M of G consists of all the edges of G except e2 and e3 . Note that M is not a feasible solution because the node v is unfeasible in M , i.e., dM (r, v) = λ (x + p) + (λ − 1) ε > λ (x + p) = λ dG (r, v). In fact, any feasible solution must contain at least one of the edges e2 or e3 . Since x > ε, the optimal solution is given by the tree T¬e1 , obtained from M by adding the edge e2 and by removing e1 . The following lemma shows that the mechanism must compute T¬e1 as a solution. Lemma 1. The mechanism M returns T¬e1 as solution. Proof. Let T be a feasible solution containing e1 , and suppose by contradiction that M computes T as solution. It is easy to see that c(T ) ≥ λ (x + p) + p. Then, the approximation ratio achieved by the mechanism is ρ=
λ (x + p) + p c(T ) ≥ , c(T¬e1 ) λ (x + p) + (λ − 1)ε + p − x
x which goes to 1 + λ (x+p)+p−x for ε that goes to 0. This means that by choosing ε x small enough, we can make ρ arbitrary close to the value 1 + λ (x+p)+p−x . Since x σ < L(λ) ≤ 1 + λ (x+p)+p−x , we obtain a contradiction (since M was supposed to be σ-approximate), and the lemma follows. ⊔ ⊓
Truthful Mechanisms for the Min-cost Apx Shortest-Paths Tree
303
r e1 x u e2 p λp − x − ε p e3 λx + λε v
Fig. 2. The scheme of the instance of Theorem 4
Consider now the same instance in which the cost of e1 becomes x′ = x+ε. Since g(·) is monotone, the solution computed by the mechanism remains T¬e1 , while the optimal solution is changed. Indeed, M is now a feasible solution. Thus, the approximation ratio achieved by the algorithm is ρ=
λ (x + p) + (λ − 1)ε + p − x c(T¬e1 ) = , c(M ) λ (x + p + ε)
p−x which goes to 1 + λ (p+x) for ε that goes to 0. Once again, we can choose ε small enough to make ρ > σ, which contradicts the σ-approximation assumption, and the claim follows. ⊔ ⊓
By choosing x and p in order to maximize the function L(λ, x, p), we obtain the following: Corollary 1. Let λ ≥ 1. Then, it does not exist any truthful σ-approximate mechanism for the single-weighted λ-MAST problem, for any σ < L(λ), where
L(λ) = 1 +
λ (9λ + 8) . λ (3λ − 4 + λ (9λ + 8)) 5λ −
⊔ ⊓
2 threshold Since it can be shown that L(λ) remains constantly below the 1 + λ−1 of approximability established in [12] for the single-weighted λ-MAST problem, we cannot conclude that the mechanism design version of the problem is harder than its corresponding optimization version. However, we stress the fact that our inapproximability result holds unconditionally, i.e., even for exponential time mechanisms. Besides, we want to point out an interesting peculiarity of the non-cooperative single-weighted λ-MAST problem: the set of feasible solutions depends on the agents’ types. For this reason, even if in this problem the objective function is the sum of the agents’ costs, as in utilitarian problems, it cannot be handled by VCG-mechanisms. Indeed, the algorithm of a VCG-mechanism is exactly the optimal algorithm of the corresponding optimization problem, but from Theorem 4 this algorithm cannot be monotone. It is also interesting to
304
D. Bil` o, L. Gual` a, and G. Proietti
notice that this reasoning does not apply to the biweighted formulation of the λMAST problem, which in fact might be solved optimally by a (computationally unfeasible) VCG-mechanism. 5.2
An Approximate Truthful Mechanism
We start by pointing out the following: Fact 1. The algorithm given in [12] does not enjoy the monotonicity property. Proof. The high-level description of the algorithm in [12] is the following. The algorithm computes a MST M of G, then it performs a depth-first search of M by starting from the root r and in such a way, it fixes an ordering of the nodes. Then, at each step it maintains a current tree T . Initially, T is equal to M . The algorithm visits the nodes by following the (depth-first) fixed order. When a node v which is unfeasible in T is visited, the algorithm adds the shortest path PG (r, v) to T , and yields a new current tree by computing a SPT of the graph consisting of all the edges of M and all the edges of every added shortest path. Then the algorithm goes on to visit nodes by following the fixed ordering. r
r 10 10
14
e4 u 5 v (a)
10 10
12 14
12
e 4+ǫ u 5 v (b)
Fig. 3. A counterexample to the monotonicity of the algorithm in [12]. Bold edges are edges in the solution. In (a) it is shown the solution computed by the algorithm when e has cost 4, while in (b) e raises its cost of ε.
Consider now the instance in Figure 3. Let λ = 2, and let ε be a tiny positive value. Clearly, the (unique) MST is the line joining r and v. When the cost of the edge e is 4, the node u is feasible, and the algorithm does not select e (see Figure 3.a), while when e raises its cost to 4 + ε, the node u becomes unfeasible and the algorithm adds the shortest path PG (r, u) (instead of PG (r, v)), and e enters into the solution (see Figure 3.b). This contradicts the monotonicity. ⊓ ⊔ Thus, for an approximate mechanism, we need a different approach, as described in the following.
Truthful Mechanisms for the Min-cost Apx Shortest-Paths Tree
305
A monotone algorithm. The algorithm starts by computing a MST Mb and a SPT Sb of the graph, and then it looks at the set of unfeasible nodes in Mb , i.e., all the nodes v ∈ V for which dMb (r, v) > λ dG (r, v). For each unfeasible node, say v, it adds to Mb the winning edge e∗v for v of the path PSb (r, v), i.e., the (unique) edge of PSb (r, v) incident to v, in order to make v feasible. As Mb may be cyclic, then in Lines 6–8 edges are removed until there is no cycle left. Algorithm 2 Input: G = (V, E), r ∈ V , λ ≥ 1, b = (c(e1 ), . . . , c(em )) Output: A spanning tree T 1: Let Sb be a SPT of G, b, r 2: Let Mb be a MST of G, b 3: Let U be the set of unfeasible nodes in Mb 4: F = {e∗v | v ∈ U} 5: Let H be the digraph obtained as follows − edges of Mb are directed from r towards the leaves − every winning edges e∗ v is directed towards v 6: while ∃ v ∈ V with in-degree 2 in H do 7: delete from H all edges entering in v but the winning one e∗v 8: end while 9: Let T be the undirected version of H 10: return T
From now on, we will assume that edge costs are distinct.1 It is easy to see that the computed solution satisfies the following property: Lemma 2. Algorithm 2 returns a (1 + n−1 λ )-approximate solution for the singleweighted λ-MAST problem. Proof. First of all, we prove that Algorithm 2 returns a feasible solution. Hence, we must prove that T is a spanning tree satisfying the distance constraints. Since T has n − 1 edges, then it suffices to prove that for each node v, dT (r, v) ≤ λ dSb (r, v), which implies T to be connected. The proof is by induction on the number k of the edges on the path PSb (r, v). The basic case is k = 0, which is trivial. Now assume that for every node u ∈ V such that PSb (r, u) is made up of h < k edges, the claim is true. Let v be an unfeasible node in Mb such that PSb (r, v) consists of k edges. Consider the winning edge e∗v = (u, v) for node v. From the fact that PSb (r, u) has k − 1 edges, by the inductive hypothesis u is feasible in T and thus dT (r, v) = dT (r, u)+c(e∗v ) ≤ λ dSb (r, u)+c(e∗v ) ≤ λ (dSb (r, u)+c(e∗v )) = λ dSb (r, v), where the last inequality holds because λ ≥ 1. Now we show that Algorithm 2 returns a (1 + n−1 λ )-approximate solution. Let T be an optimal solution, and let v1 , v2 , . . . , vk be the unfeasible nodes in Mb . Then, the algorithm adds the winning edge e∗vi whose cost is at most 1
This is not a restrictive hypothesis, as we can suppose that each edge e has a unique index ie , and we can assume that for every pair of distinct edges e, e′ , c(e) ≺ c(e′ ) iff c(e) < c(e′ ), or c(e) = c(e′ ) and ie < ie′ .
306
D. Bil` o, L. Gual` a, and G. Proietti
dSb (r, vi ), for each i = 1, . . . , k. Moreover, as vi is unfeasible in Mb , we have that λ dSb (r, vi ) < dMb (r, vi ). Summing over i, we can bound the cost of the added edges as follows: λ
k
i=1
dSb (r, vi )
λ dSb (r, v). Then e exits from the solution T if either e exits from the SPT, or e still remains in the SPT but v becomes feasible. This latter condition holds whenever e declares a value xe which satisfies dMb (r, v) ≤ λ dSb (r, u) + λ xe . By solving this inequality for xe and by taking the minimum, we obtain dMb (r, v) − dSb (r, u) . (1) θe = min θe (S), λ 2. e ∈ E(Mb ) \ E(Sb ). W.l.o.g. assume that u is closer to r than v in Mb . It is easy to see that v must be feasible, i.e., dMb (r, v) ≤ λ dSb (r, v). Then e exits from T if either e exits from the MST, or v becomes unfeasible, which happens whenever e declares a value xe such that dMb (r, u)+xe > λ dSb (r, v). By taking the minimum value for xe satisfying the latter inequality, we have that (2) θe = min {θe (M ), λ dSb (r, v) − dMb (r, u)} . 3. e ∈ E(Sb ) ∪ E(Mb ). We have two subcases: (a) u is closer to r than v in Mb but not in Sb . It is easy to see that v feasible implies u feasible, and u unfeasible implies v unfeasible. Let u and v be feasible. Since dMb (r, u) does not depend on e, u remains feasible when ae raises its bid. This implies that e exits from T if either e exits from the MST, or v becomes unfeasible. Hence, θe is defined as in (2). Now assume u, v are unfeasible. Since dSb (r, v) does not depend on e, node v remains unfeasible when ae raises its bid and e remains in the MST. This implies that e exits from T if either e exits from the SPT, or u becomes feasible. Hence, similarly to (1), θe is defined as follows: dMb (r, u) − dSb (r, v) . θe = min θe (S), λ (b) u is closer to r than v both in Mb and Sb . Note that, since in H the unique edge entering in v is e, it is easy to see that min{θe (M ), θe (S)} ≤ θe ≤ max{θe (M ), θe (S)}. We have three subcases: i. θe (M ) = θe (S). Clearly, θe = θe (M ) = θe (S). ii. θe (M ) < θe (S). Let M−e be the (unique) MST when ae declares a value xe > θe (M ). The only case of interest is when xe ≤ θe (S). It is easy to see that v is feasible in M−e iff xe ≥
dM−e (r,v) λ
− dSb (r, u).
308
D. Bil` o, L. Gual` a, and G. Proietti
Then e exits from T if either v becomes feasible or e exits from Sb . We obtain: dM−e (r, v) − dSb (r, u) θe = min θe (S), max θe (M ), . λ iii. θe (M ) > θe (S). Let S ′ be the SPT when ae declares a value xe > θe (S). Notice that dS ′ (r, v) = dSb (r, u) + θe (S). The only case of interest is when xe ≤ θe (M ). It is easy to see that v is unfeasible in M iff xe > λ (dSb (r, u) + θe (S)) − dM (r, u). Then e exits from T if either v becomes unfeasible or e exits from Mb . We obtain:
θe = min θe (M ), max θe (S), λ dSb (r, u) + θe (S) − dM (r, u) . The mechanism. By using the results in [8, 16, 19], we can finally prove the following: Theorem 5. There exists a 1 + n−1 -approximate truthful mechanism for the λ single-weighted λ-MAST problem running in O(m + n log n) time. Proof. Truthfulness and approximation ratio follow from Lemma 3 and Lemma 2, respectively. Concerning the time complexity, the algorithm first computes a SPT of G in O(m + n log n) time, next it computes a MST of G in O(m α(m, n)) = O(m + n log n) time [16], where α(m, n) is the classical inverse of Ackermann’s function [19]. The other steps of the algorithm takes O(n + m) time. Concerning the payments, the mechanism first computes θe (M ), θe (S) for each selected edge e. This can be done in O(m α(m, n)) time [8]. Next, for each selected edge e = (u, v) ∈ E(Mb ), it computes dM−e (r, v), where v is farther to r than u and M−e is the (unique) MST computed in G − e. Once again, this can be accomplished in O(m α(m, n)) time by using the algorithm for the sensitive analysis [19]. Indeed, such algorithm computes the swap edge fe for each edge e ∈ E(Mb ), where fe = (u′ , v ′ ) is the unique edge belonging to M−e but not to Mb . It is not hard to prove that dM−e (r, v) = dMb (r, u′ ) + c(fe ) + dMb (r, v ′ ) − dMb (r, v) , where u′ is closer to r than v ′ in M−e . From this, the claim follows.
⊓ ⊔
Acknowledgements. The authors would like to thank the anonymous referees for their very helpful comments.
References 1. C. Amb¨ uhl, A. Clementi, P. Penna, G. Rossi, and R. Silvestri, Energy consumption in radio networks: selfish agents and rewarding mechanisms, Proc. 10th Int. Colloquium on Structural Information Complexity (SIROCCO’03), Proceedings in Informatics 17, Carleton Scientific, 1–16, 2003.
Truthful Mechanisms for the Min-cost Apx Shortest-Paths Tree
309
´ Tardos, Truthful mechanisms for one-parameter agents, Proc. 2. A. Archer and E. 42nd IEEE Symp. on Foundations of Computer Science (FOCS’01), 482–491, 2001. 3. P. Briest, P. Krysta, and B. V¨ ocking, Approximation techniques for utilitarian mechanism design, Proc. 37th Ann. ACM Symp. on Theory of Computing (STOC’05), 39–48, 2005. 4. E. Clarke, Multipart pricing of public goods, Public Choice, 8:17–33, 1971. 5. U. Feige, A threshold of ln n for approximating set cover, J. of the ACM, 45(4): 634-652, 1998. 6. T. Groves, Incentives in teams, Econometrica, 41(4):617–631, 1973. 7. L. Gual` a and G. Proietti, A truthful (2-2/k)-approximation mechanism for the Steiner tree problem with k terminals, Proc. 11th Int. Computing and Combinatorics Conference (COCOON’05), Vol. 3595 of Lecture Notes in Computer Science, Springer-Verlag, 390–400, 2005. 8. L. Gual` a and G. Proietti, Efficient truthful mechanisms for the single-source shortest paths tree problem, Proc. 11th Int. Euro-Par Conf. (Euro-Par’05), Vol. 3648 of Lecture Notes in Computer Science, Springer-Verlag, 941–951, 2005. 9. R. Hassin, Approximation schemes for restricted shortest path problems, Math. Oper. Res., 17(1):36–42, 1992. 10. J. Hershberger and S. Suri, Vickrey prices and shortest paths: what is an edge worth?, Proc. 42nd IEEE Symp. on Foundations of Computer Science (FOCS’01), 252–259, 2001. 11. M.-Y. Kao, X.-Y. Li, and W. Wang, Towards truthful mechanisms for binary demand games: a general framework, Proc. 6th ACM Conference on Electronic Commerce (EC’05), 213–222, 2005. 12. S. Khuller, B. Raghavachari, and N.E. Young, Balancing minimum spanning trees and shortest-path trees, Algorithmica, 14(4):305–321, 1995. 13. M.V. Marathe, R. Ravi, R. Sundaram, S.S. Ravi, D.J. Rosenkrantz, and H.B. Hunt III, Bicriteria network design problems, J. Algorithms 28(1):142–171, 1998. 14. N. Nisan and A. Ronen, Algorithmic mechanism design, Games and Economic Behaviour, 35:166–196, 2001. 15. M.J. Osborne and A. Rubinstein, A Course in Game Theory, MIT Press, 1994. 16. S. Pettie and V. Ramachandran, An optimal minimum spanning tree algorithm, J. of the ACM, 49(1):16–34, 2002. 17. C.A. Phillips, The network inhibition problem, Proc. 25th Ann. ACM Symp. on Theory of Computing (STOC’93), 776–785, 1993. 18. G. Proietti and P. Widmayer, A truthful mechanism for the non-utilitarian minimum radius spanning tree problem, Proc. 17th ACM Symp. on Parallelism in Algorithms and Architectures (SPAA’05), 195–202, 2005. 19. R.E. Tarjan, Sensitivity analysis of minimum spanning trees and shortest path problems, Inform. Proc. Lett., 14:30–33, 1982. 20. W. Vickrey, Counterspeculation, auctions and competitive sealed tenders, J. of Finance, 16:8–37, 1961.
Dynamic Asymmetric Communication Travis Gagie Department of Computer Science University of Toronto Toronto, Canada [email protected]
Abstract. We present four new asymmetric communication protocols, with which a server with high bandwidth can help clients with low bandwidth send it messages. Three of our protocols are the first to use only a single round of communication for each message. Unlike previous authors, we do not assume the server knows the messages’ distribution.
1
Introduction
Internet users usually download more than they upload, and many technologies have asymmetric bandwidth — greater from servers to clients than from clients to servers. Adler and Maggs [3] considered whether a server can use its greater bandwidth to help clients send it messages. They proved it can, assuming it knows the messages’ distribution. We argue this assumption is often both unwarranted and, fortunately, unnecessary. Suppose a number of clients want to send messages to a server. At any point, the server knows all the messages it has received so far; each client only knows its own messages and does not overhear communication between other clients and the server. Thus, the server may be able to construct a good code but the clients individually cannot. Adler and Maggs assumed the server, after receiving a sample of messages, can accurately estimate the distribution of all the messages. This assumption let them simplify the problem: Can the server help a single client send it a message drawn from a distribution known to the server? Given a representative sample of messages and a protocol for this simpler problem, the server can just repeat the protocol for each remaining message. In fact, it can even do this in parallel. Adler and Maggs gave protocols for the simpler problem in which the server uses its knowledge to reduce the expected number of bits the client sends to roughly the entropy of the distribution. Their work has been improved and extended by several authors [17, 10, 13, 5], whose results are summarized in Table 1,1 and used in the Infranet anti-censorship system [7, 8]. However, while 1
Table 1 does not include a recent paper by Adler [1], in which he considered a harder version of the original problem with many clients: Can the server take advantage of correlations between messages? He showed it can, but used the even stronger assumption that the server knows the probability distribution over entire sequences of messages.
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 310–318, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
Dynamic Asymmetric Communication
311
Table 1. Suppose a server tries to help a client send it one of N messages, chosen according to a distribution with entropy H that is known to the server but not the client. Adler and Maggs [3], Watkinson, Adler and Fich [17], Ghazizadeh, Ghodsi and Saberi [10] and Bose, Krizanc, Langerman and Morin [5] gave protocols for this problem whose expected-case upper bounds appear above; the last three protocols take a parameter k ≥ 1. This table is based on one given by Bose et al. but, to be consistent with the data compression literature (particularly [4]), we use a different notation. References [3, 13] [3] [17] [17] [10] [5]
Bits sent by Server 3⌈log N ⌉ O(log N ) (H + 2)⌈log N ⌉ O(2k H log N ) kH⌈log N ⌉ + 1 (k + 2)⌈log N ⌉
Bits sent by Client 1.09H + 1 O(H + 1) H +2 H +2 H log k−1 k + 1 H log(k+2) + log(k + 2) log(k+2)−1
Rounds 1.09H + 1 O(1) H +2 (H + 1)/k + 2 H/ log k + 1 H +1 log(k+2)−1
implementing Infranet, Wang [16] found the distribution of the messages (webpage requests) changed over time — the sample was unreliable. We return to the original problem but without the assumption of a representative sample. We present and analyze four asymmetric communication protocols based on techniques from data compression for handling changing and unknown distributions. Our results are summarized in Table 2. To make it easier to compare our results and previous results, we show the average cost of each message; notice H is same in both tables, because the distribution of messages in a representative sample is the same as in the whole sequence. In Section 2 we give a dynamic version of Watkinson, Adler and Fich’s Bit-Efficient Split protocol [17]. In Section 3, we present and analyze our TreeQuery and ListQuery protocols, which are the first to use only a single round of communication for each message. This is desirable because, as Adler, Demaine, Harvey and Pˇ atra¸scu [2] wrote: Any time savings obtained from reducing the number of bits sent by the client could easily be lost by the extra latency cost induced by multiple rounds in the protocol, particularly in long-distance networks, such as satellites, where communication has very high latency. Finally, in Section 4 we show how Bentley, Sleator, Tarjan and Wei’s Moveto-Front compression algorithm [4] can be turned into an elegant single-round asymmetric communication protocol, QueueQuery. Our protocols can be implemented so that each party’s computation is proportional to the number of bits it sends and receives. Consider an everyday example of asymmetric communication — placing a call on a cellular telephone. Because reading information from the phone’s display is much faster than typing that information on its keypad, we can say the phone has greater bandwidth than the user. One of the ways the phone helps the user place calls faster is by storing a list of recently called numbers. This feature is common and frequently used, even though the phone may only store the 10 most recently called numbers, which demonstrates the advantage of dynamic
312
T. Gagie
Table 2. Suppose a server tries to help clients send it m messages whose distribution — known to neither the server nor the clients — has entropy H; of N possible distinct messages, n occur. We present four protocols for this problem and prove upper bounds on the average cost of sending each message, which appear above; the last two protocols take a parameter k > 1. Protocol DBES TreeQuery ListQuery QueueQuery
Bits sent by Server (H + O(1)) log N 2N − 1 ⌊N 1/k ⌋⌈log N ⌉ ⌊N 1/k ⌋⌈log N ⌉
Bits sent by Client N H + n log + O(1) m n log N H + m + O(1) N kH + n log + O(1) m n log N kH + m + O(1)
Rounds H + O(1) 1 1 1
asymmetric communication protocols; it would be difficult or impossible to accurately estimate the called numbers’ distribution from a preliminary sample because, for most users, that distribution changes over time. Let m be the number of calls made from the phone, n be the number of distinct phone numbers called, H be the entropy of the called numbers’ distribution, and N be the number of phone numbers in the world. If the phone only stores the 10 most recently called numbers, then it displays about 10 log10 N digits per call. To call the ith number in this list, the user types about log10 i digits and, to call a number not stored, he or she types about log10 N digits. Notice this takes a single round. We speculate this protocol is, in practice, so efficient that many users type far fewer than H/ log10 2 + n logm10 N digits on average per call. Unfortunately, in theory, it is almost useless — if the user calls 11 numbers in turn over and over, then H/ log10 2 = log10 11 ≈ 1.04 but he or she has to type every number in full. The drawback of our single-round protocols is the large bound on the number of bits the server sends; this seems unavoidable if we want to prove good upper bounds. For the simpler problem with a single client and message and the distribution known to the server, Adler and Maggs showed that single-round protocols in which the client sends O(H + 1) bits cannot have an N o(1) upper bound on the number of bits the serversends. Adler, atra¸scu Demaine, Harvey and Pˇ showed that protocols that use o logloglogloglogNN rounds with high probability and in which the client sends O(H + 1) bits cannot have a 2(log N ) on the number of bits the server sends, for any ǫ > 0.2
2
1−ǫ
upper bound
Dynamic Bit-Efficient Split
Let S = s1 , . . . , sm be a sequence of messages some clients want to send a server. Let N be the number of possible distinct messages and let n be the number that occur in S. Let H = a∈S #am(S) log #am(S) , where a ∈ S means message a occurs 2
This does not contradict the second row of Table 1; Adler and Maggs’ second protocol uses O(1) rounds in the expected case but not with high probability.
Dynamic Asymmetric Communication
313
in S, #a (S) is a’s frequency in S and log means log2 ; i.e., H is the entropy of the messages’ distribution (sometimes called the 0th-order empirical entropy of S). We now present Watkinson, Adler and Fich’s Bit-Efficient Split protocol [17]. For the moment, assume the server has a representative sample and uses it to build a leaf-oriented binary search tree T on the distinct messages in S; the jth leaf of T stores the jth lexicographically largest message a ∈ S, at depth at most log #am(S) + 1; each internal node has exactly two children (i.e., T is strictly binary) and stores the lexicographically largest message in its left subtree. Gilbert and Moore’s algorithm [11], for example, will build such a tree in linear time. For each message si , the server starts at the root of T and descends to the leaf v of T storing si , as follows. At each proper ancestor u of v, the server sends the active client the message a stored at u; if a ≥ si , then the client responds with 0 and the server descends to u’s left child; if a > si , then the client responds with 1 and the server descends to u’s right child. By active we mean the client currently sending its message to the server. Without loss of generality, assume messages are ⌈log N ⌉ bits long; otherwise, we use their indices. For a ∈ S, the server descends #a (S) times to the leaf storing a. Thus, there are at most
a∈S
#a (S)
log
m + 1 < (H + 2)m #a (S)
rounds. During each round, the server sends ⌈log N ⌉ bits and the active client sends 1 bit. In contrast, our Dynamic Bit-Efficient Split (DBES) protocol does not require the server to know the distribution beforehand. Next, we give a simple implementation of DBES; for each message, the server sends (H + O(1)) log N bits, on average, and performs O(N ) computations. It is possible to reduce the number of computations the server makes to O((H + 1) log N ) using a technique developed for dynamic alphabetic coding [9].3 For each message si , the server builds a leaf-oriented binary search tree Ti on all N possible distinct messages; the jth leaf of Ti stores the jth lexicographically largest possible message a, at depth at most log #a (s1 ,...,sii−1 )+1/N + 1. (Notice
a #a (s1 , . . . , si−1 ) + 1/N = i.). a #a (s1 , . . . , si−1 ) = i − 1, so The server starts at the root of Ti and descends to the leaf v storing si . If v is high in the tree, the server descends as in Bit-Efficient Split; however, if the server reaches an internal node at depth ⌈log i⌉ + 1, then it knows the active client’s message must be one it has not seen before. In the latter case, to cut short the protocol and save rounds, the server signals the client by sending the same message twice (notice it never does this otherwise); the client responds with si . Our analysis relies on the following technical lemma. 3
Gilbert and Moore’s algorithm builds T as a binary trie, with the path to the leaf # ′ (S) a (S) storing a labeled by a prefix of the binary representation of a′ log
Notice
m! log(#a (S)!) . log i − = a∈S #a (S)! i=1 a∈S
log(#a (S)!)
a∈S
=
(S)−1 #a j=1
a∈S
= =
a∈S si =a m i=1
(H + 1)m > a∈S
log #a (S)
a∈S
log #a (S) log max #si (s1 , . . . , si−1 ), 1 +
m i=1
Since
a∈S
log max #si (s1 , . . . , si−1 ), 1 +
so
log j +
log
log #a (S) ,
a∈S
i
− log #a (S) . max #si (s1 , . . . , si−1 ), 1 a∈S
log #a (S) ≤ n log m n < m, the claim follows.
⊓ ⊔
Using Lemma 1, it is easy to bound the number of bits the server sends, the number the clients send and the number of rounds in DBES. Theorem 1. Suppose some clients send S to a server using DBES. On average, each message takes H + O(1) rounds, during which the server sends N + O(1) bits. (H + O(1)) log N bits and the active client sends H + n log m Proof. There is one round for each level the server descends in a tree. For each message si , the server descends at most
i min log + 1, ⌈log i⌉ + 1 #si (s1 , . . . , si−1 )
i = log +1 max(#si (s1 , . . . , si−1 ), 1) times so, by Lemma 1, there are a total of (H +O(1))m rounds for all m messages. The server sends ⌈log N ⌉ bits during each round. If si has occurred before, then the client sends 1 bit during each round; otherwise, it sends 1 bit during each round except the last, when it may send ⌈log N ⌉ bits. ⊓ ⊔
Dynamic Asymmetric Communication
315
As an aside, we note DBES can easily be modified so the trees are only based on the distribution of recent messages — a data compression technique for increasing robustness. The server maintains a queue of messages; for each message si , it builds a tree based on the distribution of messages in the queue; after receiving si , it dequeues the oldest message and enqueues si . Knuth [12] discusses “sliding windows” such as this.
3
TreeQuery and ListQuery
Our next protocol, TreeQuery, is a simple modification of DBES. Instead of querying the active client repeatedly to find a path in a tree, the server encodes and sends the whole tree; the client finds the path and sends back all of what would have been its responses. To encode the tree, the server performs a preorder traversal, recording each internal node as a 1 and each leaf as a 0. Since Gilbert and Moore’s algorithm is linear, both the server and the client perform O(N ) computations. Theorem 2. Suppose some clients send S to a server using TreeQuery. For each message, the server sends 2N − 1 bits and, on average, the active client N + O(1) bits. sends H + n log m Proof. For each message, the server encodes and sends a strict binary tree on N leaves, which takes 2N − 1 bits; the number of bits the clients send is bounded as in Theorem 1. ⊓ ⊔ For ListQuery, the server keeps a list of the possible messages, in non-increasing order by their frequency in the prefix of S it has received so far. If the server stores the list in a standard balanced binary-search tree implementation of a priority-queue, then updating it takes O(log N ) time after each message. For each message si , the server sends the active client the first ⌊N 1/k ⌋ messages in the list, where k > 1 is a parameter. The client makes a single pass through this sublist and, if si is rth in the sublist, responds with 1 followed by the codeword for r in Elias’ delta code [6]; if si is not in the sublist, the client responds with 0 followed by si . The codeword for r ≥ 1 in the delta code consists of a selfdelimiting, (2⌊log(log r + 1)⌋ + 1)-bit encoding of ⌊log r⌋ + 1 followed by the (⌊log r⌋ + 1)-bit binary representation of r with the leading 1 removed. Theorem 3. Suppose some clients send S to a server using ListQuery with parameter k > 1. For each message, the server sends at most ⌊N 1/k ⌋⌈log N ⌉ bits N + O(1) bits. and, on average, the active client sends kH + n log m Proof. Suppose the client’s message si appears rth in the sublist it receives from the server; then r ≤ N 1/k and #si (s1 , . . . , si−1 ) ≤ (i − 1)/r. Since k > 1, the length of the codeword for r in the delta code — i.e., ⌊log r⌋+2⌊log(log r+1)⌋+1 — is bounded by i−1 , log N + O(1) . k log r + O(1) ≤ min k log #si (s1 , . . . , si−1 )
316
T. Gagie
Now suppose si does not appear in the sublist; then #si (s1 , . . . , si−1 ) ≤ (i − 1)/N 1/k , so log N ≤ k log #s (s1i−1 ,...,si−1 ) . Again, the number of bits the client i sends is bounded by i−1 , log N + O(1) . min k log #si (s1 , . . . , si−1 ) Therefore, by Lemma 1 and straightforward calculation, the average number of N + O(1). ⊓ ⊔ bits a client sends is kH + n log m
4
QueueQuery
ListQuery is reminiscent of Bentley, Sleator, Tarjan and Wei’s Move-to-Front (MTF) compression algorithm [4]. To encode S, MTF keeps a list of the possible messages in increasing order by the time since their last occurrence; e.g., the most recent message is first in the list. For each message si , if si is the rth message in the list, then MTF records the codeword for r in the delta code and moves si to the front of the list. Bentley et al. proved MTF encodes S using (H + o(H))m + n log N bits. In fact, if the messages’ distribution changes, MTF may use significantly fewer than H bits. Notice MTF’s list is essentially a reversed queue; the tail is first, the head is last and when messages occur, they move to the tail. Inspired by MTF and our cell phone example in the introduction, we modify ListQuery to obtain QueueQuery. The server keeps a queue of the ⌊N 1/k ⌋ most recent distinct messages, where k > 1 is a parameter. This is the only thing the server stores, so QueueQuery is more space-efficient than our previous protocols. For each message si , the server sends the active client this queue. The client makes a single pass through the queue and, if si is rth from the tail, responds with 1 followed by the codeword for r in the delta code; if si is not in the queue, it responds with 0 followed by si . The server then puts si at the tail and, if that lengthens the queue, dequeues the message at the head. Notice that, if si is in the queue, then apart from the leading 1 indicating si ’s presence the client sends as many bits as MTF would use to encode si . If si is not in the queue, then apart from the leading 0 indicating si ’s absence the client sends at most about k times as many bits as MTF would use; i.e., ⌈log N ⌉ instead of at least ⌊log N 1/k ⌋ + 2⌊log(log N 1/k + 1)⌋ + 1 bits. Thus, although our analysis below of QueueQuery is self-contained, it is naturally very similar to that of MTF. Theorem 4. Suppose some clients send S to a server using QueueQuery with parameter k > 1. For each message, the server sends ⌊N 1/k ⌋⌈log N ⌉ bits and, N + O(1) bits. on average, the active client sends kH + n log m Proof. Suppose the client’s message si is the first occurrence of that distinct message a in S; then it responds with log N + O(1) bits. Now suppose si is not the first occurrence of a and let sh be the preceding occurrence. If the number
Dynamic Asymmetric Communication
317
of distinct messages in sh , . . . , si−1 is greater than N 1/k , then si is no longer in the queue and the client responds with log N + O(1) bits; since i − h must be greater than N 1/k , this is bounded by k log(i − h) + O(1). Otherwise, si is still in the queue and the client responds with log(i − h) + 2 log log(i − h) + O(1) bits which, since k > 1, is also bounded by k log(i − h) + O(1). Let si1 , . . . , si#a (S) be the occurrences of a in S. The clients with these messages send a total of #a (S)
log N +
j=2
k log(ij − ij−1 ) + O(#a (S))
≤ log N + #a (S)k log
m + O(#a (S)) #a (S)
bits to communicate them to the server. Summing over the distinct messages in S, the clients send kHm + n log N + O(m) bits in total; the average number of N + O(1). ⊓ ⊔ bits a client sends is kH + n log m
Acknowledgments Many thanks to Faith Ellen Fich, Giovanni Manzini and Charlie Rackoff, who supervised this research, and to the anonymous referees, for helpful comments.
References 1. M. Adler. Collecting correlated information from a sensor network. In Proceedings of the 16th Symposium on Discrete Algorithms, pages 479–488, 2005. 2. M. Adler, E.D. Demaine, N.J.A. Harvey, and M. Pˇ atra¸scu. Lower bounds for asymmetric communication complexity and distributed source coding. In Proceedings of the 17th Symposium on Discrete Algorithms, pages 251–260, 2006. 3. M. Adler and B.M. Maggs. Protocols for asymmetric communication channels. Journal of Computer and System Sciences, 64(4):573–596, 2001. 4. J.L. Bentley, D.D. Sleator, R.E. Tarjan, and V.K. Wei. A locally adaptive data compression scheme. Communications of the ACM, 29(4):320–330, 1986. 5. P. Bose, D. Krizanc, S. Langerman, and P. Morin. Asymmetric communication protocols via hotlink assignments. Theory of Computing Systems, 36(6):655–661, 2003. 6. P. Elias. Universal codeword sets and representations of the integers. IEEE Transactions on Information Theory, 21(2):194–203, 1975. 7. N. Feamster, M. Balazinska, G. Harfst, H. Balakrishnan, and D. Karger. Infranet: Circumventing web censorship and surveillance. In Proceedings of the 11th USENIX Security Symposium, pages 247–262, 2002. 8. N. Feamster, M. Balazinska, W. Wang, H. Balakrishnan, and D. Karger. Thwarting web censorship with untrusted messenger discovery. In Proceedings of the 3rd International Workshop on Privacy Enhancing Technologies, pages 125–140, 2003. 9. T. Gagie. Dynamic Shannon coding. In Proceedings of the 12th European Symposium on Algorithms, pages 359–370, 2004.
318
T. Gagie
10. S. Ghazizadeh, M. Ghodsi, and A. Saberi. A new protocol for asymmetric communication channels: Reaching the lower bounds. Scientia Iranica, 8(4):297–302, 2001. 11. E.N. Gilbert and E. Moore. Variable-length binary encodings. Bell System Technical Journal, 38:933–968, 1959. 12. D.E. Knuth. Dynamic Huffman coding. Journal of Algorithms, 6(2):163–180, 1985. 13. E.S. Laber and L.G. Holanda. Improved bounds for asymmetric communication protocols. Information Processing Letters, 83(4):205–209, 2002. 14. C.E. Shannon. A mathematical theory of communication. Bell System Technical Journal, 27:379–423, 623–656, 1948. 15. D.D. Sleator and R.E. Tarjan. Self-adjusting binary search trees. Journal of the ACM, 32:652–686, 1985. 16. W. Wang. Implementation and security analysis of the Infranet anti-censorship system. Master’s thesis, Massachusetts Institute of Technology, 2003. 17. J. Watkinson, M. Adler, and F. Fich. New protocols for asymmetric communication channels. In Proceedings of the 8th International Colloquium on Structural Information and Communication Complexity, pages 337–350, 2001.
Approximate Top-k Queries in Sensor Networks⋆ (Extended Abstract) Boaz Patt-Shamir and Allon Shafrir Dept. of Electrical Engineering Tel Aviv University Tel Aviv 69978, Israel [email protected], [email protected]
Abstract. We consider a distributed system where each node has a local count for each item (similar to elections where nodes are ballot boxes and items are candidates). A top-k query in such a system asks which are the k items whose sum of counts, across all nodes in the system, is the largest. In this paper we present a Monte-Carlo algorithm that outputs, with high probability, a set of k candidates which approximates the top-k items. The algorithm is motivated by sensor networks in that it focuses on reducing the individual communication complexity. In contrast to previous algorithms, the communication complexity depends only on the global scores and not on the partition of scores among nodes. If the number of nodes is large, our algorithm dramatically reduces the communication complexity when compared with deterministic algorithms. We show that the complexity of our algorithm is close to a lower bound on the cell-probe complexity of any non-interactive top-k approximation algorithm. We show that for some natural global distributions (such as the Geometric or Zipf distributions), our algorithm needs only polylogarithmic number of communication bits per node.
1
Introduction
Possibly one of the clearest examples of the difference between “global” and “local” can be seen in elections: each ballot box has a local score for each candidate, but the result we care about is the global scores, i.e., how many votes does each candidate have overall. A top-k query in this case is “Which are the k globally most popular candidates?”. Other examples for the top-k task abound: in peerto-peer file-sharing networks (such as Gnutella), users may wish to find which are today’s most popular downloads; in sensor networks, a sensor may count the number of occurrences of different species of birds, and a user might be interested in the most frequent species observed over the whole instrumented area; in a server farm with several gateways, denial-of-service (DoS) attacks are a major concern. The first question to be answered in this case is which are the most frequent sources of requests; and many others. ⋆
This research was supported in part by Israel Ministry of Science and Technology contract 3-941.
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 319–333, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
320
B. Patt-Shamir and A. Shafrir
In general, a top-k query returns the k items having largest global score in a distributed system, where each item has a set of local scores. The global score of an item is just the sum of its local scores, over all locations. The main difficulty is that the scores may be divided arbitrarily among the different locations. In elections, for example, it may be the case that the most popular global candidate has the lowest (positive) count in each ballot box. When computing top-k queries in a distributed system, a key question is how to minimize the communication complexity required to provide an answer. This issue is particularly important in sensor networks, where the communication subsystem is by far the largest energy consumer at the nodes. An algorithm which allows us to trade communication for local computation may have a decisive effect on the longevity of node batteries and hence on the usability of the system (see, e.g. [14]). This observation has established the measure of individual communication complexity as a key performance criterion in sensor networks [14, 16, 24, 7, 20]. In this work, we adopt this measure to evaluate the complexity of top-k computation. Observe that deterministic algorithms are sensitive to the way scores are partitioned among the different nodes and for some partitions they may communicate all scores to a single node. Our Results. In this paper we propose a simple and effective way to overcome the problem of adversarial partition of the scores among the nodes. Our algorithm is Monte Carlo (it may err with some arbitrarily small probability), and its results are only approximate: using very little communication, the algorithm can tell, roughly, which items are in the top-k set. We focus on the worst-case individual communication complexity, i.e., our goal is to minimize the maximal number of bits communicated (sent or received) by any single node. Our basic tool is random sampling. Done in the right way, sampling strips away the difficulties due to geographical distribution of scores which are the main difficulties for deterministic and Las Vegas algorithms. The basic idea is compounded with techniques adapting it to the specific input at hand. The performance of the algorithm depends on how popular are the top-k items, and on how “flat” is the distribution of scores. Specifically, suppose that the global scores adhere to the Zipf distribution with parameter a > 1 (namely the relative popularity of the ith popular item is proportional to i−a ). Then our Algorithm R guarantees that the communication complexity is bounded by O( εk2 ) times a polylogarithmic factor, where ε is the required approximation accuracy. This case is quite important, as it is widely believed that the statistics of many phenomena are well approximated by the Zipf distribution (see, e.g., [3, 12]). We note that the communication complexity of our algorithms scales very well compared with previous algorithms [11, 6]. Our simulations demonstrate that the performance of our algorithm is significantly superior to the best previously known algorithms. We give some evidence showing that our algorithm is close to optimal. In particular, we demonstrate the optimality of its cell-probe complexity [23, 13] among a limited class of single-round Monte Carlo algorithms.
Approximate Top-k Queries in Sensor Networks
321
Previous Work. In [11], Fagin, Lotem and Naor introduced the Threshold Algorithm (TA) in the context of databases. They define a notion of ‘instanceoptimality,’ and prove that TA incurs at most n accesses times the optimum, where n is the number of nodes in the system (they also show that an Ω(n) factor blowup is unavoidable for any deterministic or Las-Vegas algorithm). In [6], Cao and Wang propose the TPUT algorithm to reduce latency and save communication for the case where the local inputs are generated by Zipf-like distributions. As expected from deterministic algorithms, the performance of TPUT and TA depend crucially on the partition of scores to nodes. Other related work include variations of TA and TPUT optimized for certain network models [17, 25, 5]. From the sensor networks perspective, top-k queries are viewed as a special case of aggregate queries (see, e.g., [16, 24]). Typically, it is assumed that data is routed on a spanning tree, and each node does some aggregation en-route. Simple aggregates (such as counting the number of items, summing numbers etc.) can be done with O(log n) bits per node. Considine et al. [7], and Gibbons et al. [18], present methodologies for robust approximation of aggregates in sensor networks. In [18] they also present a sketch of a top-k-approximation algorithm that appears promising, but the algorithm is not fully specified, and no formal statement or analysis is given. Techniques for efficient monitoring of aggregates in sensor networks are studied by [21, 4, 8, 2]. The main question in these works is how to efficiently update the results under some assumptions on the way the input changes. Paper Organization. The remainder of the paper is organized as follows. Section 2 describes our model, problem definition and a few known results about efficient counting. Section 3 presents our algorithms with formal analysis results. Simulation results are presented in Sect. 4. In Sect. 5, we present our lower bound, and we conclude in Sect. 6. Due to lack of space, proofs are omitted from this extended abstract.
2
Model and Preliminaries
System Model. The system is modeled as a communication graph G(V, E) with n |V |, where each node models a classical RAM machine with access to its local input and to an infinite tape of random bits. A distinguished node v ∗ ∈ V is the root node and is assumed to have a special write-once output register. The system executes distributed algorithms according to the standard asynchronous message passing model (see, e.g., [1, 15]). Very briefly, in this model an event (such as arrival of a message to node u) triggers a state-transition (e.g., u computes a response message and inserts it to the link buffer). An execution in our model is considered terminated when the root-node has written the result to the output register. Let M denote some finite string of bits. We assume that the system contains a message passing infrastructure supporting the following facilities: – Each node u ∈ V may send a message M to any other node v ∈ V . This causes each node along a path from u to v to send and receive Θ (|M |) bits.
322
B. Patt-Shamir and A. Shafrir
– Each node u ∈ V can broadcast a message M to all other nodes. This causes every node in V to send and receive Θ (|M |) bits. While the particular way in which these actions are implemented is immaterial for our purposes, we note that these assumptions can be justified by the existence of a spanning-tree of constant degree for message passing (see, e.g., [14, 16, 24, 7, 20]). Input Model and Problem Statement. Let I denote the set of possible items. We assume I is finite. An instance of the problem, denoted by X, is a vector of multisets of I: one multiset, denoted Xv , for each node v ∈ V. We sometimes slightly abuse notation and use X to also denote the multiset v∈V Xv . It is convenient to imagine each multiset as a set of cells, where each cell contains a single item, so that an item with multiplicity w has w replicas, one in a cell. The weight of item i in node v, denoted wv (i), is the multiplicity of i in Xv . The weight of a node v is the total number of cells in v, formally Wv |Xv |. The weight of an item i ∈ I, is the sum of its multiplicities over all nodes, i.e., w(i) v∈V wv (i). The input size is defined to be the total number of cells, W (X) v∈V |Xv |. The empirical probability, or frequency, of an item i ∈ I in X, is defined by pX(i) w(i) W . When the context is clear we omit the subscript. Using this notation, we define the top-k set of X as follows. Definition 1. Let k be a natural number, and suppose that |I| ≥ k. The top-k set of X, denoted top(k, X), is a subset of I of size k containing the items with the maximal weights. Following [11], we extend Definition 1 to the concept of approximate top-k sets. Definition 2. Let ε ≥ 0. An ε-approximation of the top-k set of X is a set / topε , we have pX(j) ≤ topε of k items, such that for all items i ∈ topε and j ∈ (1 + ε)pX(i). We will mainly be interested in small values of ε so without loss of generality, we assume henceforth that ε ≤ 1. It turns out that the following quantity has a central role in the complexity of computing top-k (and approximate top-k) queries. For a given input, the critical frequency of the instance, denoted p∗ (X, k), is the empirical probability of the least popular item in top(k, X), i.e., given input X and a natural number k, we define p∗ (X, k) min {pX(i) | i ∈ top(k, X)}. Throughout the paper, we assume instances having n nodes, total weight W , and critical frequency p∗ . We denote the set of all such instances by X (W, n, p∗ ). Complexity Measures. We evaluate the performance of certain algorithms using a worst-case measure per node. Specifically, the communication complexity of an algorithm is the maximum, over all inputs and over all nodes, of the total number of bits transmitted and received by a node throughout the execution of the algorithm. Formally, cA (X, v) denotes the total number of bits transmitted and received by node v, throughout the execution of algorithm A, for the input
Approximate Top-k Queries in Sensor Networks
323
X; cA (X) denotes the maximal node-communication of algorithm A on input X, i.e., cA (X) max {cA (X, v) | v ∈ V }. Finally, given a collection X of possible inputs, CA (X ) denotes the worst-case communication complexity of algorithm A over all inputs in X , i.e., CA (X ) max {cA (X) | X ∈ X }. Note that our communication complexity measure is individual in the sense that we measure the maximal number of bits communicated by any single node. The motivation for such a measure is that in sensor networks, each node has an individual energy source, and the longevity of the system often depends on the longevity of the weakest sensors (see, e.g., [14]). Furthermore, assuming a spanning tree of bounded degree, we can disregard many aspects of wireless communication and focus on the net communication used by the algorithm. Loglog Counting. Let us present a known result which we use. First we define the following concept. Definition 3. Let Z be a positive number we wish to estimate, let ε ≥ 0 and σ ≥ 0 be real numbers. A random variable Zˆ is a (ε, σ 2 )-estimate of Z if 1 1 2 ˆ ˆ Z |E[Z] − Z| ≤ ε, and Z 2 Var[Z] ≤ σ . Durand and Flajolet [10] prove a result which, specialized to our system model, can be stated as follows. Fact 4 ([10]). There exists an algorithm Aloglog which outputs an (ε, σ 2 )-estimate of W with ε = 10−6 and σ = 1, using O (log log W ) bits of communication. To get bounds that hold with high probability, we iterate Algorithm Aloglog and use Bernstein’s Inequality (see, e.g., [9]). Algorithm BoundCount ( Input: ε, δ, i ) 1. M ← (6/ε2 ) ln 1/δ. 2. Broadcast a filtering message indicating that only input cells holding item i should be considered in Step 3. ˆℓ of w(i). 3. for ℓ = 1 to M , run Aloglog obtaining an independent estimate w M 1 w ˆ . 4. Output w ˆ M ℓ ℓ=1
Corollary 5 (high-probability estimates). For 10−5 ≤ ε ≤ 1 and δ > 0, 1 |w ˆ − w(i)| < ε ≥ the output w ˆ of Algorithm BoundCount satisfies Pr w(i) 1− complexity of the algorithm is of order δ. The individual communication O log |I| + ε12 log δ1 log log w(i) . Also, if the algorithm ran M iterations in Step 1 −5 3, then for any ζ > 10 , Pr w(i) |w ˆ − w(i)| < ζ ≥ 1 − exp −Ω M ζ 2 .
3
Algorithms
In this section we present our main result, namely a randomized algorithm for computing top-k. In our algorithm, the basic idea is to view each cell (representing a unit of weight, or score) as a “vote,” and to sample each vote independently.
324
B. Patt-Shamir and A. Shafrir
Thus, the expected number of sampled votes for candidate i is proportional to the total number of votes candidate i has in the input regardless of their partition into nodes. The sampling results provide a good indication which items are globally popular, so that counting can be applied only to these items. Next, we need to determine the sample size. Let p∗ denote the frequency of the least popular of the top-k items. Clearly, if we sample once, the sample size should be proportional to O(1/p∗ ) (or else the sample will fail to find all top k items). A more refined analysis shows what should be the sample size as a function of p∗ , the approximation parameter ε, and the confidence parameter δ. To deal with unknown p∗ , we augment the basic sampling algorithm with a technique to find the right sample size. Intuitively, we have a simple test which can prove whether the sample size is sufficiently large; if it isn’t, we double the sample size. Finally, we address the issue of very small p∗ values: while Ω(1/p∗ ) sample size cannot be avoided for worst-case inputs, a much better bound can be obtained if the popularity of items decreases relatively rapidly. Consider, for example, the case where the global scores are close to the geometric distribution, e.g., when the frequency of the ℓth popular element is about 2−ℓ . Then we have p∗ = 2−k , and therefore the sample size should be Ω(2k ). This cost can be reduced exponentially by utilizing the following simple idea: Whenever a sample is taken, the top item in the sample is by far the most popular (it is expected to have half of the weight in the sample). Therefore it is safe to add the top item to the output list, remove it from further consideration, and take another sample of the same size. In the geometric case, this approach has communication cost linear in k. This intuition leads us to our final algorithm, called Algorithm R. In essence, the idea is to iteratively discover the very top items, “shave them off,” and to continue recursively with the remainder of the population. The algorithm combines this idea with an additional way to verify that the top-k items have been discovered. Algorithm R is far better than naive sampling for some common input distributions, such as Zipf distribution. We start, in Sect. 3.1, by describing the basic algorithm we later use as a building block. Section 3.2 presents Algorithm S which uses adaptive sample size. Section 3.3 presents Algorithm R, which is our main result. 3.1
Algorithm B: Basic Sampling
Consider basic sampling: if the top-k items occupy a constant fraction of the total weight, then a log-size sample is sufficient to detect them for any input size (the logarithm is of the inverse of the error probability). It is convenient to first analyze the following sampling routine. Algorithm A ( Input: PSAMPLE ) 1. The root sends PSAMPLE to all other nodes. 2. Each node sends each cell to the root with probability PSAMPLE .
Approximate Top-k Queries in Sensor Networks
325
Lemma 6. There exists a function S ∗ (p∗ , ε, δ) = Θ p∗1ε2 · ln p∗1 δ , such that for any input X ∈ X (W, n, p∗ ), the top-k elements of a random sample of size at least S ∗ (p∗ , ε, δ) is a top-k ε-approximation of X with probability at least 1 − δ. The proof (like all others) is omitted from this extended abstract. Intuitively, the argument is as follows. Define a ‘swap’ to be a pair of items i, j such that i is more popular than j in the input but less popular than j in the sample. We identify which item-pairs may not be swapped in an ε-approximation, and bound the probability that such a swap occurs using the Chernoff-like bound for selfweakening random variables presented in [19]. The probability bound is used to deduce the required sample exact definition of S ∗ used by our algo size. The ln(1+ε) g(ε) 1+ε ∗ ∗ . rithms is S (p , ε, δ) p∗ · ln p∗ δ + 4 , where g(ε) ε ln (1+ε) ε )+ln(1+ε)−ε ( ln(1+ε) Algorithm B, presented below, first determines the sampling probability PSAMPLE using the function S ∗ from Lemma 6. Each cell (i.e., unit of weight) is then sent to the root with probability PSAMPLE , and the root outputs the top k items in the sample as an approximation of the top k items in the complete input. Algorithm B ( Input: W, p∗ , k, ε, δ ) 1. The root computes PSAMPLE ← 2 · S ∗ (p∗ , ε, 2δ )/W . 2. Execute Algorithm A with parameter PSAMPLE to get a sample S. 3. Output top(k, S).
When running Algorithm B as described above, each sampled vote is sent to the root separately incurring communication log |I|. An obvious optimization is to aggregate votes for the same candidate along the way, for example by sending the count of votes for each candidate. While such optimization is very worthwhile to implement, it would not help much when the partition of votes to nodes is adversarial. We therefore ignore such optimizations in our upper bounds. Theorem 7. Let X ∈ X (W, n, p∗ ) be an instance. Provided that p∗ , ε, δ and W are known, Algorithm B outputs with probability at a top-k ε-approximation 1 1 least 1 − δ and communication O p∗ ε2 · ln p∗ δ · log |I| . The proof is rather standard; we omit it due to lack of space. Note the 1/p∗ factor: It is unavoidable because if the sample is to contain the top k elements, it should contain the least popular of them, and hence the sample size must be Ω(1/p∗ ). A stronger bound is proved in Sect. 5. 3.2
Algorithm S: Adaptive Sample Size
Algorithm B requires knowing the values of W and p∗ . While estimating W is straightforward and cheap (by deterministic or randomized counting, at the cost of O(log W ) or O(log log W ) communication, respectively), obtaining a lower bound on p∗ seems less trivial. We solve this problem as follows.
326
B. Patt-Shamir and A. Shafrir
First, we note that by counting the weight of any k items, we obtain a lower bound on p∗ : the least popular among any k items is certainly no more popular than the least popular among the top-k items. Second, we note that exact counting is not necessary: we can use high-probability estimates as described in Corollary 5 to get a lower bound on p∗ that holds with high probability. However, if we simply use an arbitrary set of k items to bound p∗ , that value can be smaller than the true value of p∗ by an arbitrary factor, resulting in communication cost that is higher than the bound in Theorem 7 by an arbitrary factor. Our solution, in Algorithm S below, combines the ideas described above with an iterative approach that avoids unbounded ‘overshoots.’ The algorithm uses a variable pˆ as an estimate of p∗ . The algorithm repeatedly halves pˆ while improving its lower bound on p∗ , stopping when pˆ is smaller than the lower bound. Algorithm S ( Input: k, ε, δ ) ˆ ← BoundCount(ε = 1, δ/5, ‘ALL’) 1. W 2. pˆ ← 1 (ˆ p is the current estimate of p∗ ) 3. Repeat (a) pˆ ← p2ˆ ˆ /2, pˆ, ε, δ/5), to get a candidate (b) Execute Algorithm B with parameters (W top-k-set T . (c) For each item i ∈ T , w(i) ˆ ← BoundCount(ε = 1, δ/5, i) 1 ˆ ˆ W |i∈T . Until pˆ < min w(i)/ 8
4. Output the set T computed at Step 3b of the last iteration.
Theorem 8. For any input X ∈ X (W, n, p∗ ), with probability at least 1 − δ, Algorithm complexity S outputs a top-k ε-approximation with communication CS = O p∗1ε2 · log p∗1 δ · log |I| + k log p1∗ log δ1 log log W . Note that when |I| ≥ log W and k < O (1/(−p∗ log p∗ )), the communication complexity of Algorithm S is within a constant factor of the complexity of Algorithm B. The general idea in the proof is that the high-probability estimates ensure that we run approximately log p1∗ iterations. As a result, the last iteration is similar to an execution of Algorithm B with the correct parameters and its communication complexity is as specified in Theorem 7. 3.3
Algorithm R: Sample and Remove
As already mentioned above, it appears that the 1/p∗ factor is unavoidable when we want all the top-k items to be included in the sample (because p∗ is the empirical probability of the k th popular item). However, when the popularity of the popular items is far from uniform, one can do much better, as mentioned for the geometric distribution example in the beginning of this section: the 1/p∗ factor in the communication complexity can be replaced by a factor of k. Algorithm R
Approximate Top-k Queries in Sensor Networks
327
Algorithm R ( Input: k, ε, δ ) 1. Q ← ∅ (Q holds all items whose weights were already estimates) 2. pˆ ← 1, ℓ ← 0. (ˆ p is the current estimate of p∗ , ℓ is the iteration index) 3. Repeat ˆ ← BoundCount(ε = 1, δ/7, ‘ALL’). (a) W ˆ [ℓ] ← W ˆ. (b) ℓ ← ℓ + 1 ; W 1 ˆ (c) pˆ ← pˆ · 2 · W [ℓ − 1]/Wˆ[ℓ]. ˆ. (d) PSAMPLE ← 2S ∗ (ˆ p, ε/4, δ/7) / W (e) Execute Algorithm A with parameter PSAMPLE to get sample S. ˆ )); (f) η ← (δ/7) · (1/ − log plo (top(k, Q), W ˆ ), S). T S ← top(|S| log |I| /(log |I| + log log W S ˆ ← BoundCount(ε = 1, η, i). (g) For each i ∈ T , w(i) (h) Q ← Q ∪ T S ; remove elements of T S from the input. ˆ , Q, S, pˆ, ε, δ). Until safe(W S ˆ ← BoundCount(ε = 1, η, i) and 4. If |T | < k, then for each i ∈ top(k, S), do w(i) add i to Q. ˆ > plo (top(k, Q), W ˆ) ˆ W 5. Q ← i ∈ Q | w(i)/ δ , i). 6. For each i ∈ Q, w(i) ˆ ← BoundCount(ε/4, 5|Q| 7. Output the top k items in Q according to the new estimates.
Function plo ( Input: Q, W ) 1. Return
1 4W
min {w(i) ˆ | i ∈ Q}.
Predicate safe ( Input: W, Q, S, pˆ, ε, δ ) 1. If pˆ · (W [ℓ]/W [1]) < plo (top(k, Q), W ) return true. 2. rhi ← plo (S ∩ Q, W ) 3. q ← (1 + ε/2) · plo(top(k, Q), W ); α ← q/rhi . 4. If α > 1 and exp −|S|q
α−1 2 α
0 has communication complexity cR (X) = O εk2 log p∗1 δ (log |I| + log log W ) . For the important case of Zipf distribution, we have the following corollary. Corollary 12. Let X be an instance where item frequencies have Zipf distribution i−a , where a > 1 and h is the normalization with parameter a > 1, i.e., pX(i) h
Approximate Top-k Queries in Sensor Networks
329
factor. Then Algorithm R, when runon input X with parameters δ, ε > 0 has coma+1 · εk2 · log p∗1 δ · (log |I| + log log W ) . munication complexity cR (X) = O a−1
The results in this section analyze the behavior of R for asymptotically large inputs. As described in the next section, we have tested our algorithms on realisticsize inputs to study the effect of the hidden constants. We have also compared R with other known algorithms from the literature. We remark that Algorithm R turns out to have significantly superior performance.
4
Simulations Results
To evaluate the performance of our algorithm in more realistic scenarios, we ran simulations examining the actual number of bits communicated throughout the execution. We compared our algorithm R with the best known algorithms, namely TA [11] and TPUT [6]. We compared the performance of the algorithms when the input is partitioned randomly and when it is partitioned adversarially. Finally, we evaluated the performance of R for various values of p∗ (popularity of the k th most popular item) and various values of ǫ (the approximation parameter). Informally, we find that Algorithm R offers a dramatic improvement over TA and TPUT unless the system is very small and the distribution is particularly favorable to TA and TPUT. Moreover, for typical inputs, R behaves better than predicted by our analytical bounds. Simulated Instances. We used randomly generated inputs of various sizes, and our main focus was on inputs generated by Zipf distribution with exponent between 0.8 and 3; all shown charts used Zipf distribution with exponent 1.5 (different exponent values showed qualitatively similar behavior). Typical other parameters were k = 5, ε = 0.5 and δ = 0.05. The total number of votes (W ) was either 106 or 107 and the varying parameter is the number of nodes (n). The number of candidate-items was equal to the number of nodes (|I| = n). All simulations measured the worst-case individual communication (in bits).
10
Log (Communication in bits)
Comparison with Existing Algorithms. In Fig. 2 we compare algorithms R, TA and TPUT. We used the approximation version of the TA algorithm. We note 7 6 5
TA TPUT R
4 3 2 1 0
1
2
Log10(n)
3
4
Fig. 2. Communication costs of algorithm R compared to TA and TPUT for random partition of scores in various system scales
B. Patt-Shamir and A. Shafrir 6
TA
Log (Communication in bits)
opt
Ropt 5 4 3 2 1
5
0 2.5
3
3.5
4
4.5
5
TAopt Ropt
4
3
2
10
Log10(Communication in bits)
330
1
0 2.5
Log (n)
3
3.5
4
4.5
5
5.5
6
Log (n)
10
10
Fig. 3. Communication costs of optimized algorithms for various system scales. Left: with an adversarial partition of scores among nodes. Right: with a random partition of scores among nodes.
that TPUT has no approximation version, but in all simulations we ran, TPUT appeared less efficient than TA, even for high accuracy such as ε = 0.01. Results for adversarial and random partition of scores were similar. As shown in Fig. 2, the performance of TA and TPUT for a random partition is rather poor for large systems and Algorithm R is superior even for a system of 100 nodes. R is overwhelmingly superior (by more than two orders of magnitude) for n > 10000. Next, we modified the deterministic algorithms by using loglog counting and allowing them to err. We also assumed the existence of a bounded degree spanning tree, and used unlimited memory at each node (which allows simple aggregation while traversing the tree). These modifications resulted in drastic improvement in TA performance: see Fig. 3. The optimized version of TPUT is not shown because it performed far worse than the optimized version of TA. Note that when the input is adversarially partitioned, R beats TA for n > 2000. But even when the input is partitioned randomly (which is close to the best case of TA), R performs better for n large enough, where large enough means n > 200000 in this case.
Algorithm S
← W log|I|
Algorithm R 6
10
4
10
−5
10
−4
10
−3
10
−2
10
−1
10
p* (probability of k−heaviest item in X)
0
10
c(X) (communication in bits)
c(X) (communication in bits)
The Effect of Accuracy and Critical Frequency on Performance. We examined the performance of Algorithms R and algorithm S while varying ε and p∗
←
Algorithm S
W log|I|
Algorithm R 6
10
4
10
0
0.5
1
1.5
2
2.5
3
ε (required approximation level)
3.5
4
Fig. 4. Communication costs of algorithms S and R. Left: as a function of p∗ . Right: as a function of ε. The communication cost of reading the entire input is W log |I|, (W is the input size and |I| is the number of items).
Approximate Top-k Queries in Sensor Networks
331
(for n fixed). The results are given in Fig. 4. Obviously, Algorithm R was always superior to Algorithm S. The results for p∗ (Fig. 4, left) show that Algorithm R is less sensitive to p∗ when the input is generated by Zipf distribution. We note that the flat left segment in the graph of S is due to the fact that for small values of p∗ , the sample of Algorithm S consists of the entire input. The effect of the approximation factor ε (Fig. 4, right) on the communication 2 of both algorithms is proportional to 1+ε , as suggested by our upper bounds. ε Algorithm R is more efficient due to its improved termination criterion.
5
A Lower Bound on the Total Cell-Probe Complexity
In this section we give a lower bound on the total cell probe complexity [23, 13] of randomized algorithms for the top-k problem. For a restricted settings, we can deduce a lower bound on the individual communication complexity of such randomized algorithms. We define the total cell probe complexity of an algorithm as the total number of input cells accessed by a all nodes for the worst-case input. Formally, cpA (X, v) denotes the number of input cells accessed by node v, throughout the execution of T A for input X; cp A (X) denotes the total number of cell-probes for an instance X, T i.e., cpA (X) v∈V cpA (X, v). The total cell-probe complexity of A is defined
by CPTA (X ) max cpTA (X) | X ∈ X . Note that the set of all probed cells can be viewed as a sample whose size is the total number of cell-probes. 1 ∗ Theorem 13. For some natural k, let ε > 0, 0 < p ≤ 2k , 0 < δ < 0.014, and 2 (1+ε) and let A be any Monte Carlo algorithm. If A outputs a W = Ω δ(p1∗ )2 · ε4
∗ top-k ε-approximation with probability at least 1−δ for any input in X (W, n, p ), then its total cell-probe complexity satisfies E CPTA = Ω p∗1ε2 · log δ1 .
The proof (omitted from this extended abstract) applies Yao’s Minimax Principle to obtain a lower bound on Monte Carlo algorithms. To this end, we prove a lower bound on the expected sample size used by any deterministic algorithm when the input is drawn from a certain distribution we construct, so that there is a single correct output to the top-k ε-approximation query. Furthermore, under our distribution, the local view of each node is just a random subset of the items. We show that any algorithm which does not output the top-k set of its sample is doomed to err with probability at least 1/2. Finally, we bound the required sample size for other algorithms. Star Topology and “Smart Dust” Systems. Theorem 13 demonstrates the optimality of Algorithm B with respect to the total cell-probe complexity but not the individual cell-probe complexity. Consider a setting where the system has star topology, i.e., all nodes are connected to a root node, and suppose that each node holds a single cell. This model is a reasonable abstraction of the setting in sensor networks using passive communication. In these systems, the only communication is between a powered base-station and a sensor, forming a star topology
332
B. Patt-Shamir and A. Shafrir
(as opposed to the common spanning tree). Passive communication is suitable for very small devices, such as “smart dust” systems (see e.g., [22]). Now, for these systems, Theorem 13 says that any algorithm that satisfies theconditions of the theorem has individual communication complexity at least Ω p∗1ε2 · log 1δ . We stress that while our model assumes certain routing capabilities, our algorithms only use a broadcast-convergecast scheme rooted by the root node. Such communication is suitable for star topology.
6
Conclusions and Future Work
In this paper we have proposed algorithms solving the top-k problem by adaptive sampling. The communication complexity of our algorithms does not depend on the way the input is partitioned in the network: only the global statistics affect the complexity. Our final algorithm performs particularly well when the global statistics are far from flat. We have tested our algorithm by simulation and found empirical support for our analytical claims. Although our study is mainly theoretical, simulation results indicate that our algorithm is rather practical and can be very useful in real-life scenarios. Future work may extend our algorithm to specific models, where spatial and temporal dependence among different sensors holds (e.g., nearby nodes have similar readings). From the theoretical viewpoint, we think that it is very interesting to extend our lower bound to the case of interactive algorithms. We conjecture that our Algorithm R is nearly optimal in this more general model.
References [1] H. Attiya and J. Welch. Distributed Algorithms. McGraw-Hill Publishing Company, UK, 1998. [2] B. Babcock and C. Olston. Distributed top-k monitoring. In Proc. 2003 ACM SIGMOD. [3] P. Bak. How Nature Works: The science of self-organized criticality. SpringerVerlag, New York, 1996. [4] W.-T. Balke, W. Nejdl, W. Siberski, and U. Thaden. Progressive distributed top k retrieval in peer-to-peer networks. In Proc. 21st Int. Conf. on Data Engineering, 2005. [5] N. Bruno, L. Gravano, and A. Marian. Evaluating top-k queries over webaccessible databases. In Proc. 18th Int. Conf. on Data Engineering, 2002. [6] P. Cao and Z. Wang. Efficient top-k query calculation in distributed networks. In Proc. 23rd Ann. ACM Symp. on Principles of Distributed Computing, 2004. [7] J. Considine, F. Li, G. Kollios, and J. Byers. Approximate aggregation techniques for sensor databases. Apr. 2004. [8] G. Cormode, M. N. Garofalakis, S. Muthukrishnan, and R. Rastogi. Holistic aggregates in a networked world: Distributed tracking of approximate quantiles. In Proc. 2005 ACM SIGMOD, 2005. [9] P. Dagum, R. M. Karp, M. Luby, and S. Ross. An optimal algorithm for Monte Carlo estimation. SIAM J. Comput., 29(5), 2000.
Approximate Top-k Queries in Sensor Networks
333
[10] M. Durand and P. Flajolet. Loglog counting of large cardinalities (extended abstract). In Algorithms: ESA 11th Ann. European Symp., 2003. [11] R. Fagin, A. Lotem, and M. Naor. Optimal aggregation algorithms for middleware. In Proc. 20th ACM Symp. on Principles of Database Systems, 2001. [12] M. Faloutsos, P. Faloutsos, and C. Faloutsos. On power-law relationships of the internet topology. In Proc. SIGCOMM ’99, New York, NY, USA. ACM Press. [13] M. Fredman and M. Saks. The cell probe complexity of dynamic data structures. In Proceedings of the 21st Annual ACM Symposium on Theory of Computing, May 1989. [14] M. Greenwald and S. Khanna. Power-conserving computation of order-statistics over sensor networks. In Proc. 23rd ACM Symp. on Principles of Database Systems, 2004. [15] N. Lynch. Distributed Algorithms. Morgan Kaufmann, San Mateo, CA, 1995. [16] S. Madden, M. J. Franklin, J. M. Hellerstein, and W. Hong. The design of an acquisitional query processor for sensor networks. In Proc. 2003 ACM SIGMOD. [17] S. Michel, P. Triantafillou, and G. Weikum. Klee: A framework for distributed top-k query algorithms. In Proc. 31st Int. Conf. on Very Large Data Bases, 2005. [18] S. Nath, P. B. Gibbons, S. Seshan, and Z. R. Anderson. Synopsis diffusion for robust aggregation in sensor networks. In SenSys ’04: Proc. 2nd international conference on Embedded networked sensor systems, 2004. [19] A. Panconesi and A. Srinivasan. Fast randomized algorithms for distributed edge coloring (extended abstract). In Proc. 11th Ann. ACM Symp. on Principles of Distributed Computing, 1992. [20] B. Patt-Shamir. A note on efficient aggregate queries in sensor networks. In Proc. 23rd Ann. ACM Symp. on Principles of Distributed Computing, 2004. [21] A. Silberstein, R. Braynard, C. Ellis, K. Munagala, and J. Yang. A samplingbased approach to optimizing top-k queries in sensor networks. In Proc. 22nd Int. Conf. on Data Engineering, 2006. [22] B. Warneke. Miniaturizing sensor networks with mems. In M. Ilyas and I. Mahgoub, editors, Handbook of Sensor Networks: Compact Wireless and Wired Sensing Systems. CRC Press, 2004. [23] A. C.-C. Yao. Should tables be sorted? J. ACM, 28(3), 1981. [24] Y. Yao and J. Gehrke. The Cougar approach to in-network query processing in sensor networks. ACM SIGMOD Record, 31(3):9–18, Sept. 2002. [25] D. Zeinalipour-Yazti, Z. Vagena, D. Gunopulos, V. Kalogeraki, V. Tsotras, M. Vlachos, N. Koudas, and D. Srivastava. The threshold join algorithm for top-k queries in distributed sensor networks. In Proc. 2nd Int. Workshop on Data Management for Sensor Networks, 2005.
Self-stabilizing Space Optimal Synchronization Algorithms on Trees Doina Bein, Ajoy K. Datta, and Lawrence L. Larmore University of Nevada, Las Vegas, USA {siona, datta, larmore}@cs.unlv.edu
Abstract. We present a space and (asymptotically) time optimal self-stabilizing algorithm for simultaneously activating non-adjacent processes in a rooted tree (Algorithm SSDST ). We then give two applications of the proposed algorithm: a time and space optimal solution to the local mutual exclusion problem (Algorithm LMET ) and a space and (asymptotically) time optimal distributed algorithm to place the values in min-heap order (Algorithm HEAP). All algorithms are self-stabilizing and uniform, and they work under any unfair distributed daemon. In proving the time complexity of the heap construction, we use the notion of pseudo-time. Pseudo-time is similar to logical time introduced by Lamport [12]. Keywords: heap, local mutual exclusion, self-stabilization.
1
Introduction
Fault-tolerance is the ability of a system to withstand transient faults. A faulttolerant system is guaranteed to continue to perform its function when a number of transient errors has occurred. In 1973 [8], Dijkstra defined a distributed system to be self-stabilizing when, “regardless of its initial state, it is guaranteed to arrive at a legitimate state in a finite number of steps.” Self-stabilizing algorithms aim to achieve performance comparable to that of non-stabilizing distributed algorithms when transient faults or arbitrary initialization cause the system to enter a state where a non-stabilizing algorithm cannot continue to perform its task properly. In this paper, we propose a general synchronization scheme for a rooted tree, and use this scheme to solve two fundamental problems: heap construction and local mutual exclusion. Related Work. The self-stabilizing heap problem has been studied in [1, 4, 5, 10, 13]. The first self-stabilizing binary-search tree construction algorithm was proposed in [4]. In [1], the self-stabilizing algorithm for a min-heap construction improves the algorithm of [5] in three ways: no global reset is required, the time complexity is reduced from O(nh) to O(h) (h is the height of the tree with n nodes), and the space complexity per node is reduced from O(degL) to O(deg + L) (deg is the degree of the process and L is the maximal size of the initial values in the tree). Synchronization among the nodes is achieved by using the global rooted synchronizer defined in [2], plus two additional bits. In P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 334–348, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
Self-stabilizing Space Optimal Synchronization Algorithms on Trees
335
[13], the self-stabilizing max-heap protocol that uses a neighborhood synchronizer protocol [11] reduces the memory requirement further to 2L + 3 bits; its time complexity is O(h). A heap construction that supports insert and delete operations in arbitrary states of a variant of the standard binary heap [7] with capacity K is proposed in [10]. It takes O(m log K) heap operations to stabilize (m is the initial number of items in the heap). The space complexity per node i is O(hi ), where hi is the height of the subtree Ti rooted at i. Bein et al. [4] proposed the first snap-stabilizing binary search tree (BST) and the first snap-stabilizing heap construction algorithm. (A snap-stabilizing algorithm is a self-stabilizing algorithm with stabilization time of 0 rounds). The algorithms use a PIF scheme [6] to synchronize the nodes in the tree. The space complexity of the snap-stabilizing heap construction algorithm is 3L + 3. Contributions. We propose a space and (asymptotically) time optimal selfstabilizing algorithm for simultaneously activating non-adjacent processes in a rooted tree (Algorithm SSDST ). It uses 1+⌈log(deg)⌉ bits in each node (deg is the node degree); during the first 2h + 2t − 1 rounds, every node is enabled at least t times, i.e., on the average, once every second round. For a synchronous system, after at most 2h steps, every node is enabled every second step. If the synchronous network starts in a normal starting configuration, then a node is active every other step from the beginning. We then give two applications on rooted trees of the proposed algorithm: a time and space optimal solution to the local mutual exclusion problem (Algorithm LMET ), and a space and (asymptotic) time optimal solution to the heap problem (Algorithm HEAP). Algorithm LMET uses only 2+⌈log(deg)⌉ bits per node and stabilizes in 0 rounds (it is snap-stabilizing). During the first 2h+2t−1 rounds, a node enters its CS at least t times. Algorithm HEAP arranges n values, not necessarily distinct, in non-decreasing order from top to bottom (min-heap), in at most 4(7h/2 − 4) rounds (h = height). Each process holds only one value at any moment, and uses a total of 1+⌈log(deg)⌉ bits per node, not counting the bits needed to store the value being sorted (deg = node degree) which is optimal, thus an improvement over [13, 4]. In proving the time complexity of heap-building, we use the notion of pseudotime. Each node in the network has a “local clock” which has the property that when any action must be executed between the node and its children, the local clocks of all the nodes involved in the action have the same value. Outline of the Paper. In Section 2, we briefly introduce self-stabilization and the topological models used by the proposed algorithms. Section 3 contains a description of Algorithm SSDST , followed by a sketch of its proof of correctness. Algorithm LMET is presented in Section 4. In Section 5 we first present a minheap algorithm for an abstract model of communication (Algorithm A HEAP), and then show how the min-heap will be built using the usual shared-memory model of communication (Algorithm HEAP). A sketch of correctness proof of Algorithm A HEAP is given in 5.3. The reduction of Algorithm A HEAP to Algorithm HEAP is given in 5.4. We finish with concluding remarks in Section 6.
336
2
D. Bein, A.K. Datta, and L.L. Larmore
Computational Models
We consider an asynchronous, rooted tree of n processors, with height h. The root node is denoted by R. We assume that an underlying self-stabilizing spanning tree construction protocol maintains the parent pointer pv and the set of children Dv of a node v. For the root node R, pR = ⊥. For a leaf node v, Dv = ⊥. If the topology of the network that is given as the input to the spanning tree construction algorithm changes, the spanning tree may change. This will change the input to our protocols (local mutual exclusion and heap). In that sense, the proposed protocols can deal with dynamic trees. The model of communication among the neighboring nodes is shared memory — a process can read and write its own memory, but can only read the memory of its neighbors. The program of every processor consists of a finite set of guarded actions of the form: < label >::< guard >→< action >, where each guard is a function of the variables of the processor and its direct neighbors. The state of a process is defined by the values of its variables. The system state (configuration) is the Cartesian product of all the nodes’ states. If an action has its guard, a Boolean expression, evaluated to true, then it is called enabled. A node with at least one enabled guard is called enabled. A daemon will non-deterministically select a non-empty subset of enabled nodes to execute one of its enabled actions. Guard evaluation and execution of the its action are done in one atomic step. We assume an asynchronous system. In order to compute the time complexity, we use the definition of round [9]. A round is a minimal sequence of computation steps during which each processor that was enabled in the first configuration of the sequence executes at least once during this sequence. We consider the strongest distributed daemon, the unfair daemon. The unfair daemon does not have a fairness mechanism: a continuously enabled process will not necessarily be selected for execution unless it is the only enabled process. Let C, the set of all possible states, and a predicate P over C. We denote by LP ⊆ C the set of all legitimate states with respect to P. Let C1 , C2 ⊆ C. C2 is a closed attractor for C1 if (i) every execution starting in C1 eventually reaches a configuration in C2 , and (ii) every execution starting in C2 remains in C2 . Definition 1 (Self-stabilization). If P is a predicate, a protocol S is called self-stabilizing to P if LP is a closed attractor for C.
3
Self-stabilizing Distributed Simultaneous Execution of Non-adjacent Nodes in a Rooted Tree SSDST
Each node v holds a variable S ∈ {A, B} and a pointer i ∈ 0..|Dv | − 1 to some child of v. Thus, the total memory requirement of node v is 1 + ⌈log (deg)⌉ bits (deg is the node degree). (For a binary tree, Algorithm HEAP uses at most three bits per node.) For simplicity we write S = S.v. The predicate check(v, s) means that the node v exists and has the value s for its variable S. Let execute(v) denote a generic action.
Self-stabilizing Space Optimal Synchronization Algorithms on Trees
337
Algorithm 3.1. Algorithm SSDST
Predicate check(v, s) ≡ (v = ⊥ ∨ S.v = s) Actions for any node v ABB S = B ∧ check(pv , A) ∧ ∀i, 0 ≤ i < |Dv | : check(Dv [i], B) −→ execute(v) ; S = A BAA S = A ∧ check(pv , B) ∧ ∀i, 0 ≤ i < |Dv | : check(Dv [i], A) −→ execute(v) ; S = B
Actions ABB and BAA are enabled at node v when the following two conditions are true: (i) either it has no parent, or its parent’s S-value is different from its S-value, and (ii) all its children’s S-values are the same as its S-value. For example, given a network of eight nodes starting in a so-called normal starting configuration (Figure 1(a)), the only enabled nodes are of even depth (the root and the children of the root’s children). If we assume a synchronous system, the next execution step brings the system into the configuration in Figure 1(b), in which the only enabled nodes are of odd depth. The next configuration is shown in Figure 1(c), followed by the one in Figure 1(d). Then the system returns to the configuration illustrated in Figure 1(a). The cycle repeats forever. A
B
B A
B
A
A B
B
B
A B
A
A
B
A
B A
A
A A
B
B
(a) A configuration
B
B
(b) After one step
A
A
(c) After two steps
B A
B
B
A
(d) After three steps
Fig. 1. Four steps in a synchronous system
3.1
Proof of Correctness for SSDST
In this section, we show that Algorithm SSDST stabilizes in at most 2h + 2k − 1 rounds, to the global predicate k-Exec: ≡ {∀ node v, v has executed macro execute at least k times } and works under the unfair distributed daemon. We extend the notions of configuration-string and difference-string to the tree network. We show that in every configuration, during execution of SSDST : - No node is enabled if any of its neighbors is enabled (local mutual exclusion) (Property 1) - At least one node is enabled (no deadlock); after it executes, a node becomes disabled until all its neighbors execute (Property 2) - During the first 2h + 2k − 1 rounds every node executes at least k times (no starvation) (Lemma 1).
338
D. Bein, A.K. Datta, and L.L. Larmore
We then show that SSDST works under the unfair distributed daemon (Property 3, Section 3.2). Henceforth, n > 1, as the case n = 1 is trivial. Let the configuration tree be the tree in which every node is represented by its S-value only. A normal starting configuration is a configuration in which each branch of the configuration tree is a prefix of (AABB)n (the string of length 4n obtained by concatenating AABB n times). Starting from a normal starting configuration, the enabled nodes are alternately of even and odd depth (Figure 1). The binary edge labeling is the labeling where an edge between nodes with the same S value is labeled 0 and other edges are labeled 1. Definition 2. Given a configuration tree C, we let DTC , the difference tree, be the tree in which every node v is represented by a two-bit string DTC (v) = b0 b1 such that: b0 =
1, if pv = ⊥ or the link (pv , v) is labeled 1 0 otherwise
b1 =
1, if ∃w ∈ Dv s.t. the link (v, w) is labeled 1 0 otherwise
If C is understood, write DT instead of DTC . Given a binary edge labeling and the S-value of some node, the corresponding configuration tree C is uniquely defined. Given a difference tree DT and the S-value of some node, the corresponding configuration tree C is uniquely defined. For example, for the configuration in Figure 1(a), the binary edge labeling is given in Figure 2(a) and the difference tree is given in Figure 2(b). A
10 0
0
A A
1 1
01 1
00
B
10
0
0
B
B
B
B
(a) Binary edge labeling
10 00
10
00
(b) Difference tree
Fig. 2. Some configuration
Given any configuration tree C, a node v is enabled if and only if DTC (v) = 10. Property 1. For any configuration tree C and for any node v, if node v is enabled to execute, then no neighbor of v is enabled. Property 2. (i) In any configuration tree C there exists at least one enabled node. (ii) For any node v, if node v is enabled and is selected to execute, then after the execution is completed, its actions are disabled. Given a node v and its parent pv where S.pv = a and S.v = b, the notation “a ← b” denotes that state b does not block state a from being enabled (for pv
Self-stabilizing Space Optimal Synchronization Algorithms on Trees
339
to be enabled in state a, S.v must be b). The notation a → b indicates that state a does not block state b from being enabled (for v to be enabled in state b, S.pv needs to be a). We use the above notation to define layers as follows. We start defining the layers of nodes from node R and going down the tree until we reach the leaf nodes. Node R is placed on some layer. If node v is an internal node on a certain layer, then for any child node w ∈ Dv : – if S.v → S.w then w is one layer higher – if S.v ← S.w then w is one layer lower. We can represent a configuration tree using this notation in a level ordering, where the peak nodes are the enabled nodes. The binary edge labeling is consistent with the orientation of the arrows between a node and its parent, and a node and its children (1 for ր, 0 for տ). For example, the sawtooth-like arrangement of the configuration tree in Figure 3(a) is given in Figure 3(b). A
root R 0
1
0
1
B
A
1
1
A 0
A
0
1
B 0
B
1
1 1
A
root R
(a) A configuration tree
1
B
B 0
A 0
A
B
A
2
2
A
B 3
3
0
A A
B
4
3
A A
A
0
A
B
A
A
(b) Layered arrangement
5
A
(c) Delay values
Fig. 3. Calculating the delay values
Definition 3 (Node Delay). For each node v we define delay[v] to be a nonnegative integer characterized as follows: (i) there exists at least one node whose delay is 0, and (ii) if delay[u] = d and node v is a neighbor of node u such that S.v → S.u then delay[v] = delay[u] + 1, and (iii) if S.v ← S.u then delay[v] = delay[u] − 1. The delay of some node is in fact the layer on which the node is arranged in the layered arrangement. The delay values of the nodes in Figure 3(a) are given in Figure 3(c). An enabled node has all the adjacent arrows pointing towards it. For a tree of height h, for any node v, delay[v] is a value between 0 and 2h. The number of rounds that a node waits before it becomes enabled cannot exceed its delay value. Let d0 be the array of the delay values in the starting configuration and D0 be the maximal value of d0 over all nodes: 1 ≤ D0 ≤ 2h. Lemma 1. For any node v and any value t > 0 node v executes t times within the first d0 [v] + 2t − 1 rounds.
340
D. Bein, A.K. Datta, and L.L. Larmore
Proof. We define the predicate P(q) as follows: For any node v, for any t ≥ 1, node v executes t times within the first q rounds if q ≥ d0 [v] + 2t − 1. For any q ≥ 1, Predicate P(q) holds (induction on q). Corollary 1. For any node v and any value t > 0 node v executes t times within the first 2h + 2t − 1 rounds. Proof. Follows from Lemma 1: for any node v, 2h ≥ d0 [v]. 3.2
The Unfair Distributed Daemon
In this section we show that Algorithm SSDST works under the unfair distributed daemon. A sufficient condition to prove that a certain algorithm works under the unfair daemon is to show that a continuously enabled node which is never selected eventually becomes the only enabled node. If a node v is enabled to execute but not selected by the distributed daemon, it remains enabled. Since the unfair daemon must select a non-empty subset of the enabled nodes in every computation step, it will be forced to select v (Property 3). Property 3. If a node v is enabled to execute but is not selected by the daemon, it remains enabled until it gets selected. Every continuously enabled node will be eventually selected by the unfair distributed daemon.
4
Self-stabilizing Local Mutual Exclusion Algorithm on Rooted Trees LMET
Each node holds three variables: variable S that takes values in the set {A, B}, a pointer i ∈ 0..|Dv | − 1 to some child of v, and a Boolean variable request that is true whenever the process requests access to its critical section CS. Thus, the total memory requirement of node v is 2 + ⌈log (deg)⌉ bits per node (deg is the node degree). For some node v, let S = S.v and request = request.v. The predicate check(v, s) is defined in Section 3. A protocol solves the local mutual exclusion problem if any configuration of the system running the protocol has two properties ([3]): (i) safety - no two neighboring nodes can be simultaneously enabled to execute their critical sections (CS), and (ii) liveness - a node requesting to execute its CS will eventually do so. Algorithm 4.1. Algorithm LMET Actions for any node v ABB S = B ∧ check(pv , A) ∧ ∀i, 0 ≤ i < |Dv | : check(Dv [i], B) −→ if request then CS; request = f alse S=A BAA S = A ∧ check(pv , B) ∧ ∀i, 0 ≤ i < |Dv | : check(Dv [i], A) −→ if request then CS; request = f alse S=B
Self-stabilizing Space Optimal Synchronization Algorithms on Trees
341
Property 1 shows that LMET has the safety property. Lemma 1 shows that LMET has the liveness property.
5
Self-stabilizing Min-heap Algorithms for a Rooted Tree
In this section we present two algorithms for min-heap problem in a rooted tree: A HEAP (Section 5.1), and HEAP (Section 5.2). Algorithm A HEAP is implemented in an abstract model. Algorithm HEAP is implemented in the shared-memory model. Let x and y be two values to be swapped. Swapping can be done in three steps without using an extra variable, as follows: 1. x = x + y
2. y = x − y
3. x = x − y
Alternatively, we could use “⊕, bit-wise exclusive or, instead of addition and subtraction. 5.1
Heap Construction in a Rooted Tree
Algorithm A HEAP (Figure 5.1) is a particular case of Algorithm SSDST , in which the macro execute(v) is replaced by the macro heap(v) that sets IV.v to the minimal value among itself and its children’s IV -values. Consider an abstract model, different from the shared-memory model, in which a node v, in order to have the heap property locally, can modify the variable IV.J of some child J. Intuitively, since by executing Algorithm SSDST , local mutual exclusion is satisfied in any configuration (see Property 1), a node can synchronize the swap of values with some child. We assume for now that the swap is done in an atomic step (macro heap), and we show in Section 5.2 how this is done in the shared-memory model. Each node, besides the variable IV to be sorted, holds a variable S ∈ {A, B}, a pointer i ∈ 0 . . . |Dv | − 1, and a variable j ∈ {−1, 0, . . . , |Dv | − 1} that either points to some child of node v that holds a value smaller than node v, or has the value −1 if either node v is a leaf or all its children have larger values. Thus, the total memory requirement of node v is 1 + 2⌈log (deg)⌉ bits per node (deg is the node degree). For some node v, let S = S.v and IV = IV.v. Predicate check(v, s) is defined in Section 3. If all children of v hold values greater than or equal to IV , then min(v) returns the default value −1. Otherwise, min(v) returns the index in the array Dv of a child of node v which holds the minimum value. The guards C1-C3 “correct” the variable S of the node to some value in the set {A, B} (a result of a fault or arbitrary initialization). 5.2
Heap Construction in the Shared-Memory Model
In Algorithm HEAP (Figure 5.2), each node v holds, besides the variable IV to be sorted, a variable S ∈ {A, B, X, Y }, a pointer i, a variable j, a variable J which is a pointer to some child, and a variable tmpS ∈ {A, B}. Variable tmpS
342
D. Bein, A.K. Datta, and L.L. Larmore
Algorithm 5.1. S-S. Min-Heap in a Rooted Tree in the Abstract Model A HEAP Macro heap(v) :: j = min(v) if (j ≥ 0) then J = Dv [j]; IV.v=IV.v+IV.J; IV.J=IV.v- IV.J; IV.v=IV.v-IV.J Function min(v) :: if Dv = ⊥ then return -1 else j=0 forall l ∈ {0, |Dv | − 1} do if (IV.Dv [j] > IV.Dv [l]) then j = l if (IV.Dv [j] < IV.v) then return j else return −1 Heap actions for any node v ABB BAA
S = B ∧ check(pv , A) ∧ ∀i, 0 ≤ i < |Dv | : check(Dv [i], B) −→ heap(v); S = A S = A ∧ check(pv , B) ∧ ∀i, 0 ≤ i < |Dv | : check(Dv [i], A) −→ heap(v); S = B
stores the value of S temporarily while the swap is performed between node v and its child J. Thus, the total memory requirement of node v is 3 + 2⌈log (deg)⌉ bits per node (deg is the node degree). For any node v, let S = S.v, IV = IV.v, J = J.v, tmpS = tmpS.v, Sp = S.pv , Jp = J.pv , IVp = IV.pv , SJ = S.(J.v), and IVj = IV.(J.v). The macro heap′ (v, value) executes the first step of swapping between node v and the child J = Dv [j], and the value value to be given to variable S.v after the swap is performed is stored in variable tmpS.v. Predicate check(v, s) has been defined in Section3. Function min(v) is defined in Section 5.1. In order to perform the swap, nodes v and Jv must change their S-value (from either A or B to either X or Y ). Since node v will change its S-value after the swap, the value to-be for S.v and the value of SJ are stored in variables tmpS.v, respectively tmpS.J, by each node. Node v changes its S-value to X (macro heap′ ) and node J changes its S-value to Y (Guard S1). The swap started by node v already in macro heap′ is continued by node J in Guard S1, and finished by node v in Guard S2 (where also node v restores its S). Once the swap is done, the S-values are restored back to A or B, node v in Guard S2, node J in Guard S3. In Figure 4, nodes v and J swap their IV -values (a state of is a triple S; IV ; tmpS). v w
A;5;_ A;1;_
heap’(v,B)
X;6;B S1(w)
S2(v)
Y;5;A
B;1;_ S3(w)
A;5;_
Fig. 4. Nodes v and J swap their IV values
Self-stabilizing Space Optimal Synchronization Algorithms on Trees
343
Algorithm 5.2. Self-stabilizing Heap in a Rooted Tree in the Shared-Memory Model HEAP Macro heap′ (v, tS) :: j = min(v) if (j ≥ 0) then J = Dv [j]; tmpS.v = tS; IV.v = IV.v + IV.J; S.v = X Heap actions for any node v ABB BAA
S = B ∧ check(pv , A) ∧ ∀i, 0 ≤ i < |Dv | : check(Dv [i], B) −→ heap′ (v, A) S = A ∧ check(pv , B) ∧ ∀i, 0 ≤ i < |Dv | : check(Dv [i], A) −→ heap′ (v, B)
Synchronizing actions for any node v S1 S2 S3 C1 C2 C3
5.3
S S S S S S
∈ {A, B} ∧ pv = ⊥ ∧ Sp = X ∧ Jp = v −→ IV =IVp -IV ; tmpS = S ; S = Y = X ∧ J = ⊥ ∧ SJ = Y −→ IV = IV − IVJ ; S = tmpS = Y ∧ pv = ⊥ ∧ Sp = X −→ S = tmpS = Y ∧ pv = ⊥ −→ S = tmpS = X ∧ Dv = ⊥ −→ S = tmpS = X ∧ Dv = ⊥ ∧ ∃w ∈ Dv : S.w = X −→ S = tmpS
Proof of Correctness of A HEAP
The root node R has level 1. Besides local mutual exclusion, heap-building requires synchronization between neighboring nodes. Each node has a local clock measuring pseudo-time such that the comparison between the node and its child with the minimal IV value (and eventual swapping) is done when the two nodes have the same pseudo-time values. For each configuration, the pseudo-time function Ψ is defined from the node to non-negative integers. Ψ is initially computed from the delay values, and is updated at each step. Ψ0 , the pseudo-time at the initial configuration, is defined as follows: (i) given node v and its parent pv , Ψ0 (v) = d0 [v]+d20 [pv ]−1 , and (ii) Ψ0 (R) = max{Ψ0 (v), v ∈ childR }, where R is the root. For example, given the configuration in Figure 3(c), the Ψ0 values are given in Figure 5(a). We observe that if a node v is enabled, then Ψ0 (v) = Ψ0 (w) for all w ∈ Dv . Definition 4. Let Ψj and Ψj+1 be the pseudo-time functions for two consecutive configurations in some execution Cj → Cj+1 . Then Ψj+1 is computed as follows: - if node v has executed during this step then Ψj (v) and Ψj (w) for all children w ∈ Dv increase by 1: Ψj+1 (v) = Ψj (v) + 1 and Ψj+1 (w) = Ψj (w) + 1. - if any child of the root R executes, Ψ (R) is updated if necessary, i.e., Ψj+1 (R) = maxw∈childR {Ψj+1 (w)} - all other nodes u keep their current pseudo-time values, i.e., Ψj+1 (u) = Ψj (u).
344
D. Bein, A.K. Datta, and L.L. Larmore 0
A 1
1
B
B 1
2
B
A 3
B
root
4
2
2
A
B
4
root
2
A A 2
A
4
4
A
A
(a) Start configuration
1B 1B
A 3
2
A A
(b) After one step
Fig. 5. Pseudo-time values
For example, given Ψ0 from Figure 5(a), if the marked node executes, then the next pseudo-time values are the ones in Figure 5(b). The following relations hold: (i) Ψ0 (R) ≤ h (ii) Ψ0 (v) ≤ i + h − 1 for v = R, where i = level(v). Thus Ψ0 (v) ≤ 2h − 1, for any node v. Let E(v, t) be the predicate: “Node v is enabled if Ψ (v) = t.” Observation 1. (i) If E(v, t) is true then E(v, t+2k+1) is false and E(v, t+2k) is true, for all k ≥ 0. (ii) If E(v, t) is false and t ≥ Ψ0 (v) then E(v, t+2k +1) is true and E(v, t+2k) is false, for all k ≥ 0. Property 4. Given a starting configuration C0 , and Cj some configuration after Algorithm SSDST has executed j steps, then the number of rounds elapsed is q ≤ min{∀ nodes v, Ψj (v)}. Proof. A round has elapsed if all nodes enabled in the first configuration of the round have increased their Ψ values by at least one unit; thus the minimum value among all nodes has increased at least by one. We assume that the values to be placed in min-heap order are distinct. (If necessary, we can add infinitesimal tie-breakers to the values.) Thus they can be arranged in a strict sorted order: r1 < r2 < . . . < rn , and we say that the value ri has rank i. let li be Definition 5. For any given configuration C of Algorithm A HEAP, n the level of the node that holds the value ri ; we call the function W (C) = i=1 li i the weighted path length of the configuration C. The function W is strictly positive. It increases when a swap is executed between some node v that holds the value ri and some child w ∈ Dv that holds the value rj , where ri < rj . The value by which W increases is j − i.
Self-stabilizing Space Optimal Synchronization Algorithms on Trees
345
By Lemma 1, if the heap property does not hold at some node v, node v will execute a swap in finitely many rounds. Since W (C) is an increasing integer function bounded by hn, it must converge in finitely many steps. Thus: Observation 2. Function W converges in finitely many of rounds. Let C∗ be the configuration after convergence. Then C∗ has the heap property. Let Li be the level of the node that holds the value ri in configuration C∗ . Array pos is defined as follows. Definition 6. Given j, 1 ≤ j ≤ n, and some t ≥ 0, the value pos[j, t] represents the level of node v that holds the value rj when Ψ (v) = t. If initially, the element of ri is held by the node v situated at level li and Ψ (v) = t0 , then we assume that for any t, 0 ≤ t ≤ t0 , pos[j, t] = pos[j, t0 ]. First, we show that once the Ψ value of some node is t, the level pos[j, t] of the element rj is within a certain range (Property 5). In order to show that Algorithm A HEAP arranges the values as a heap, we show that after 7h/2 − 4 rounds, pos[j, t] = Lj for all j (Lemma 2). Property 5. For any t ≥ 0 and for any j, 1 ≤ j ≤ n, min{Lj , Q[j, t]} ≤ pos[j, t] ≤ max{Lj , P [j, t]} where P [j, t] = −t + 2Lj + 3h − 5 and Q[j, t] = t + 2Lj + 3 − 4h, for any j and t. Proof. Consider the predicates: P(t) : for any j ∈ 1 . . . n, pos[j, t] ≤ max{Lj , P [j, t]} Q(t) : for any j ∈ 1 . . . n, pos[j, t] ≥ min{Lj , Q[j, t]} It can be shown by induction on t that P(t) holds. The proof that Q(t) holds is similar. Lemma 2. Algorithms A HEAP arranges the values into min-heap order in 7h/2-4 rounds; thus the stabilization time is O(h) rounds. Proof. Follows from Property 5. 5.4
Reduction of Algorithm HEAP to A HEAP
In this section we first show that Algorithm HEAP reduces to Algorithm A HEAP. We can then conclude that, starting from an arbitrary configuration, in at most 4(7h/2 − 4) rounds, Algorithm HEAP arranges the values into min-heap order (Lemma 5). Definition 7 (Reduction). Given two different models of communication M and M′ , an algorithm A in the model M can be reduced to another algorithm A′ in the model M′ if there exists a one-to-many relation R from the set of system configurations in the model M to the set of the system configurations in the model M′ such that the following conditions are true:
346
D. Bein, A.K. Datta, and L.L. Larmore
i) For each configuration of Algorithm A in the model M there exists at least one configuration of Algorithm A′ in the model M′ . ii) ( Lifting property ) Given C1 and C2 two configurations of Algorithm A in the model M such that C1 −→ C2 is an execution step of Algorithm A, for any configuration C1′ ∈ R(C1 ), if Algorithm A′ in the model M′ starts in C1′ there exists at least one execution path that starts in C1′ and ends in some configuration C2′ ∈ R(C2 ). If A accomplishes a task in the model M and A reduces to A′ , then by Definition 7, A′ accomplishes the same task in the model M′ . We now show that Algorithm HEAP reduces to Algorithm A HEAP. Let Sv = (sv , xv , Jv ) be the set of all variables of node v in order (S, IV, J) used by Algorithm A HEAP in the abstract model. Let Svtv = (sv , xv , tv , Jv ) be the set of all variables of node v in order (S, IV, tmpS, J) used by Algorithm HEAP in the shared-memory model. Then R is defined as follows: R(S1 , . . . Sn ) = {(S1t1 , . . . Sntn ), ti ∈ {A, B}, ∀i, 1 ≤ i ≤ n} For each state Si of some configuration C1 of Algorithm A HEAP in the abstract model, 1 ≤ i ≤ n, there exists two possible states SiA and SiB in the sharedmemory model. Thus for each configuration C1 there exists 2n configurations in R(C1 ) of Algorithm HEAP in the shared-memory model, thus Condition (i) of Definition 7 is satisfied. We are left to show that Condition (ii) of Definition 7 is satisfied (Lemma 3). Lemma 3. Given C1 and C2 , two configurations of Algorithm A HEAP in the abstract model, such that C1 −→ C2 is an execution step of Algorithm A HEAP; for any configuration C1′ ∈ R(C1 ), if Algorithm HEAP in the shared-memory model starts in C1′ there exists at least one execution path that starts in C1′ and ends in some configuration C2′ ∈ R(C2 ). Proof. We give a sketch of the proof. A node state contains all the variables stored at that node. The system configuration contains the states of all the nodes. An execution step is a transition from one configuration to another. We break the system configuration into a number of chunks. A chunk is a set of a node and its descendants in the tree such that the first node in each chunk is enabled, and all the descendants of the first node reachable by a path of disabled nodes are added to the chunk. We build the set of chunks starting from the root in depth-first-search (DFS) order. If the root node is currently disabled, then the root and all nodes reachable from the root reachable by a path of disabled nodes are not part of any chunk. We call the set of those nodes the null chunk. Given a configuration, there is a unique way to break it into chunks. An execution step of Algorithm A HEAP in the abstract model in one chunk affects only the nodes’ states in that chunk. From Property 1 we know that if a non-leaf node is enabled, its children are disabled. So, except for the leaf nodes, every chunk contains at least two nodes.
Self-stabilizing Space Optimal Synchronization Algorithms on Trees
347
If the chunk contains at least two nodes, then the last node in the chunk is disabled, so it cannot affect the state of the first node of other chunks. Instead of considering an execution step between global configurations, we consider an execution step between the chunks of a global configuration. If the starting state of the node is either A or B, then the value to be sorted is its initial value. If some node starting state is either X or Y , then it is possible for some of the three steps of the swap to be applied (see Section 5) and the initial value of that node to be modified accordingly, and that modified value to be sorted. This drawback is caused by arbitrary initialization, and would be encountered even if we had used an extra variable for swapping. We recall that node J.v is the child of node v that holds the minimal IV value among all node v’s children. The variable J.v is ⊥ if and only if node v is a leaf node (child.v = ⊥). For any node v such that Sv = X, either Sv remains X and then the node J.v will have its S equal to Y in at most three rounds (by executing Action S1), or v changes its S to A or B in at most one round. For any node v such that S.v = X ∧ S.(J.v) = Y then IV.v gets the value IV.(J.v) and then node v changes its Sv to A or B in at most one round. Node J.v had already stored in IV.(J.v) the old value of IV.v (by executing Action S1) and will restore its SJ.v from Y to either A or B (depending on the value of tmpS) in at most one round. We can then conclude that if S.v is either X or Y , then in at most four rounds S.v is either A or B (Lemma 4). Lemma 4. For any node v, if S.v ∈ {X, Y }, in at most four rounds S.v becomes either A or B. Lemma 5. Starting from an arbitrary configuration, in at most 4(7h/2 − 4) rounds, Algorithm HEAP arranges the n values in min-heap order. Proof. From Lemma 4, each swap takes at most 4 rounds. From Lemma 2, if a swap takes at most 1 round, then heapification takes at most 7h/2 − 4 rounds. Since the swap takes at most 4 rounds, we obtain a total of at most 14h − 16 rounds.
6
Conclusion
In this paper, we present the first self-stabilizing algorithm for simultaneously activating non-adjacent processes in a rooted tree, called SSDST . The algorithm is optimal in the space complexity, and asymptotically optimal in the time complexity. We then give two applications of the proposed algorithm for rooted trees, a time and space optimal solution to the local mutual exclusion problem (Algorithm LMET ) and a space and (asymptotically) time optimal solution to the min-heap problem (Algorithm HEAP). All algorithms are self-stabilizing and uniform, and they work under the unfair distributed daemon.
348
D. Bein, A.K. Datta, and L.L. Larmore
In proving the time complexity of heap-building, we use the notion of pseudotime. Pseudo-time is similar to logical time introduced by Lamport [12]. We expect that Algorithm SSDST can be used to obtain optimal space solutions for other problems in a rooted tree. For example, for broadcasting m messages, a solution based on Algorithm SSDST stabilizes in at most 2h + 2m − 5 rounds (the root node executes m times).
References 1. L. Alima. Self-stabilizing max-heap. Proceedings of the ICDCS Workshop on Selfstabilizing Systems, pages 94–101, 1999. 2. L. Alima, J. Beauquier, A. Datta, and S. Tixeuil. Self-stabilization with global rooted synchronizers. Proceedings of the 18-th ICDCS, pages 102–109, 1998. 3. A. Arora and M. Nesterenko. Stabilization-preserving atomicity refinement. Journal of Parallel and Distributed Computing, 62:766–791, 2002. 4. D. Bein, A. Datta, and V. Villain. Snap-stabilizing optimal binary-search-tree. Proceedings of the 7-th International Symposium on Self-Stabilizing Systems, 2005. 5. B. Bourgon and A. Datta. A self-stabilizing distributed heap maintenance protocol. Proceedings of the Second Workshop on Self-stabilizing Systems, 1995. 6. A. Bui, A. Datta, F. Petit, and V. Villain. State-optimal snap-stabilizing PIF in tree networks. In Proceedings of the Third Workshop on Self-Stabilizing Systems, pages 78–85. IEEE Computer Society, 1999. 7. T. Cormen, C. Leiserson, R. Rivest, and C. Stein. Introduction to Algorithms (second edition). MIT Press, 2001. 8. E. W. Dijkstra. Self stabilizing systems in spite of distributed control. Communications of the Association of the Computing Machinery, 17:643–644, 1974. 9. S. Dolev, A. Israeli, and S. Moran. Uniform dynamic self-stabilizing leader election. IEEE Transactions on Parallel and Distributed Systems, 8(4):424–440, 1997. 10. T. Herman and T. Masuzawa. Available stabilizing heaps. Information Processing Letters, 77:115–121, 2001. 11. C. Johnen, L. Alima, A. Datta, and S. Tixeuil. Self-stabilizing neighborhood synchronizer in tree networks. Parallel Processing Letters, 12(3 & 4):327–340, 2002. 12. L. Lamport. Time, clocks and the ordering of events in a distributed systems. Communications of the ACM, 21:558–565, 1978. 13. S. Ukena, M. Hasegawa, Y. Katayama, T. Masuzawa, and H. Fujiwara. A selfstabilizing max-heap protocol in tree networks. Electronics and Communications in Japan, Part III: Fundamental Electronic Science (English translation of Denshi Tsushin Gakkai Ronbunshi), 86(9):63–72, 2003.
Distance-k Information in Self-stabilizing Algorithms⋆ Wayne Goddard1 , Stephen T. Hedetniemi1 , David P. Jacobs1 , and Vilmar Trevisan2 1
Department of Computer Science, Clemson University, SC 29634 USA {goddard, hedet, dpj}@cs.clemson.edu 2 Instituto de Matem´ atica, UFRGS, Porto Alegre, Brazil [email protected]
Abstract. Many graph problems seem to require knowledge that extends beyond the immediate neighbors of a node. The usual selfstabilizing model only allows for nodes to make decisions based on the states of their immediate neighbors. We provide a general polynomial transformation for constructing self-stabilizing algorithms which utilize distance-k knowledge, with a slowdown of nO(log k) . Our main application is a polynomial-time self-stabilizing algorithm for finding maximal irredundant sets, a problem which seems to require distance-4 information. We also show how to find maximal k-packings in polynomial-time. Our techniques extend results in a recent paper by Gairing et al. for achieving distance-two information.
1
Introduction
Self-stabilization, introduced by Dijkstra [1], is the most inclusive approach to fault tolerance in distributed systems. In a self-stabilizing algorithm, each node maintains its local variables, and can make decisions based on the correct knowledge of its neighbors’ states. In a self-stabilizing algorithm, a node may change its local state by making a move (an action which causes a change of local state). Algorithms are given as a set of rules of the form “if p(i) then M ”, where p(i) is a predicate and M is a move. A node i becomes privileged if p(i) is true. When a node becomes privileged, it may execute the corresponding move. We assume a serial model in which no two nodes move simultaneously. A central daemon selects, among all privileged nodes, the next node to move. If two or more nodes are privileged, we cannot predict which node will move next. In this paper we say that an algorithm stabilizes if no node is privileged. An execution will be represented as a sequence of moves M1 , M2 , . . ., in which Ms denotes the s-th move. One can transform the algorithm to work under other daemons, using established techniques. We refer the reader to [2] for a general treatment of self-stabilizing algorithms. ⋆
Research supported by: NSF grant CCR-0222648; CNPq grant 453991/2005-0; and FAPERGS grant 05/2024.1.
P. Flocchini and L. Gasieniec (Eds.): SIROCCO 2006, LNCS 4056, pp. 349–356, 2006. ֒ c Springer-Verlag Berlin Heidelberg 2006
350
W. Goddard et al.
A distributed system can be modeled with an undirected graph G = (V, E), where V is a set of n nodes and E is a set of m edges. If i ∈ V , then N (i), its open neighborhood, denotes the set of nodes to which i is adjacent, and N [i] = N (i) ∪ {i} denotes its closed neighborhood. Every node j ∈ N (i) is called a neighbor of node i. Throughout this paper we assume G is connected and n > 1. In the usual self-stabilizing model, each node i can read only the variables of its neighbors, that is, those nodes which are a distance of one from i. In this paper, we show how to obtain self-stabilizing algorithms in which a node i can effectively read the contents of variables which are within distance k of i, for any fixed k ≥ 1, extending results in [3] for achieving distance-two information. This will result in a slowdown of nO(log k) . In Section 3, we obtain a polynomial time self-stabilizing algorithm for finding a maximal irredundant set, a problem which requires distance-4 information. We assume throughout this paper that all nodes have a unique integer ID. Sometimes we do not distinguish between a node i and its ID. For each k ≥ 1, we let N k [i] denote the set of nodes whose distance from i is at most k, and we let N k (i) = N k [i] − {i}. When k = 1, these sets correspond, respectively, to the closed and open neighborhoods of i. A k-packing in a graph G = (V, E) is a set S ⊆ V of nodes such that for every pair of distinct nodes, u, v ∈ S, their minimum distance d(u, v) > k. A 1-packing is, therefore, a set S having the property that no two nodes in S are adjacent ( d(u, v) > 1 ). This is normally called an independent set. Algorithm 1.1 is a well-known and simple self-stabilizing algorithm for finding the characteristic function of a maximal independent set. It is easy to show that this algorithm stabilizes in at most 2n moves [6] in the distance-1 model. Algorithm 1.1. Maximal independent set local variable: f ENTER: if f (i) = 0 ∧ (∀j ∈ N (i))(f (j) = 0) then f (i) = 1 LEAVE: if f (i) = 1 ∧ (∃j ∈ N (i))(f (j) = 1) then f (i) = 0
2
Distance-k problems
In [3], it was observed that certain algorithmic problems can be solved more easily on an extended model in which each node can instantly see all state information of nodes that are within distance two. Having done this, the extended model can be simulated using a conventional self-stabilizing algorithm, provided all nodes have unique IDs. In this paper we show how arbitrary distances greater than two can be achieved. Our idea is to use the technique in [3] recursively. We now define a class of self-stabilizing algorithm models. For each k ≥ 1, in the distance-k self-stabilizing model, each node i can instantly see all state information
Distance-k Information in Self-stabilizing Algorithms
351
of all nodes in N k [i]. We assume that node i can read the ID of j and its state information f (j) for each j ∈ N k [i]. For brevity, we refer to this as the distance-k model. The distance-1 model is the usual self-stabilizing algorithmic model. It will be convenient to assume for now that k is a power of two. Now let k = 4, and consider Algorithm 2.1, which assumes the distance-4 model. If Algorithm 2.1 stabilizes, the set S = {i | f (i) = 1} is a maximal 4-packing. For if no node is privileged to LEAVE, then S must be a 4-packing, and if no node can ENTER, the 4-packing is maximal. Moreover, the algorithm must always stabilize. Indeed, once a node makes an ENTER move, no node in N 4 (i) can ENTER, and so no node in N 4 [i] can move again. If a node makes a LEAVE move, its next move must be an ENTER, after which it cannot move. It follows that Lemma 1. The distance-4 Algorithm 2.1 finds a maximal 4-packing in at most 2n moves. Algorithm 2.1. Maximal 4-packing in distance 4 local variable: f ENTER: if f (i) = 0 ∧ (∀j ∈ N 4 (i))(f (j) = 0) then f (i) = 1 LEAVE: if f (i) = 1 ∧ (∃j ∈ N 4 (i))(f (j) = 1) then f (i) = 0 Assume now that we have some distance-2k algorithm S2k , such as Algorithm 2.1, in which every node has a local variable f . We now will describe a way to simulate S2k using a distance-k algorithm Sk . We will see that the running times of Sk and S2k are related to within a factor in O(n3 ). In Algorithm Sk , each node i has three local variables: – The variable f stores the state of node i with respect to S2k , that is, the value of S2k ’s local variable. – The variable σ stores a local copy of f (j) for each j ∈ N k (i). We may assume that σ(i) is a list of pairs of the form (j, fj ), where j is an ID of a node in N k (i). We say that σ(i) is correct if for all j ∈ N k (i), f (j) = fj . – A pointer stores the ID of a member of N k [i], or has the value NULL. We write i → j, i → i, and i → NULL to mean, respectively, that i points to j, i points to itself, and i’s pointer is NULL. At each step in the execution of Sk , the values f (i) represent a state with respect to S2k . A node i in the distance-k model can read directly only state information of nodes in N k (i). However if j ′ ∈ N 2k (i), then j ′ ∈ N k (j) for some j ∈ N k [i]. It follows that in the distance-k model, by reading σ(j), node i has a view of f (j ′ ). However, it is possible for this view to be incorrect. During the execution of Sk , we say that node i is S2k -alive if it is privileged for S2k , under the assumption that its view of {(j, f (j)) | j ∈ N 2k (i)} is correct.
352
W. Goddard et al.
We define minN k [i] = min{j | j ∈ N k [i] ∧ j → j}, where min{∅} = NULL . That is, minN k [i] is the smallest ID, within distance k of i, which is pointing to itself; minN k [i] is defined to be NULL if no member of N k [i] points to itself. Algorithm Sk is displayed as Algorithm 2.2. When k = 1, it is exactly the algorithm described in [3]. Algorithm 2.2. Sk comment: Simulates distance-2k algorithm S2k local variables:f, σ, → UPDATE-σ: if σ(i) is incorrect then update σ(i) ASK: if i is S2k -alive ∧ (∀j ∈ N k [i] : j → NULL) ∧ σ(i) is correct then i → i RESET: if i → minN k [i] ∧ σ(i) is correct then i → minN k [i] CHANGE: if ∀j ∈ N k [i] : j → i ∧ σ(i) is correct if i is S2k -alive, then update f (i) then i → NULL Lemma 2. If Algorithm Sk stabilizes, then all pointers are null, σ(i) is correct for all i, and no node is S2k -privileged. Proof. Assume the algorithm has stabilized. Then no node points to itself, for otherwise the node i pointing to itself having the smallest ID would have all members of N k [i] pointing to it, and i would be privileged for a CHANGE move. Since no node points to itself, minN k [i] is NULL, and therefore all pointers are NULL. All σ(i) are correct since no node is privileged for an UPDATE-σ. No node is S2k -privileged, for otherwise it would be privileged to execute ASK. Lemma 3. While i is pointing to itself, no node in N k (i) can execute an ASK or CHANGE. Proof. For j ∈ N k (i) to execute ASK, i must be NULL. For j to execute CHANGE, i must be pointing to j. Lemma 4. If i makes an ASK move, its next move must be a CHANGE move. Proof. When i makes an ASK move, all members of N k [i] are NULL. Suppose its next move is a RESET. Then this means that some j ∈ N k (i) is pointing to itself. But this is impossible because i → i. Nor can its next move be an UPDATE-σ, because at the time of the ASK move, σ(i) was correct. But this can’t change by Lemma 3, nor can its next move be another ASK move because i → i.
Distance-k Information in Self-stabilizing Algorithms
353
Let us say that a move by i is correct if σ(j) is correct for all j ∈ N k (i), and incorrect otherwise. Lemma 5. If node i makes an ASK move, then its next CHANGE move is correct. Proof. Let j be some member of N k [i]. During the interval between the ASK and CHANGE moves, j must have changed its pointer from NULL to i, at which time σ(j) was correct, and there must have been a last time during this interval when this occurred. But σ(j) must have remained correct, because no member of N k [j] could have performed a CHANGE while j was pointing to i. Lemma 6. If a node i makes a CHANGE move, then its next ASK move is correct. Proof. During this interval, all j ∈ N k [i] changed their pointers from i to NULL. There is a last time at which j became NULL, prior to the ASK move. At this time, σ(j) is correct, and it must remain so up until the ASK move, since no member of N k [j] could have performed a CHANGE move as long as j’s pointer is NULL. Lemma 7. Between any two RESET moves made by i, some some j ∈ N k [i] must execute an ASK or a CHANGE. Proof. This is clear. For convenience, we define a REAL-CHANGE move as a CHANGE move in which the variable f is assigned. We let dki =| N k (i) |. Lemma 8. Consider an interval without a REAL-CHANGE move. Then each node i can make: 1. 2. 3. 4.
at most one UPDATE-σ move; at most one ASK move; at most one CHANGE move; and O(dki ) RESET moves.
Proof. 8.1 is obvious. To see 8.2, suppose i makes an ASK move. By Lemma 4, its next move must be a CHANGE move. Then by Lemma 5, the CHANGE move is correct. Since this is not a REAL-CHANGE, i is not S2k -privileged. Since no other REAL-CHANGE moves occur, i cannot become S2k -alive again to execute another ASK move. To see 8.3, suppose i makes a CHANGE move, and then makes an ASK move. By Lemma 6, the ASK move is correct. Since no REALCHANGE can take place, the σ’s remain the same, and if i were to execute another CHANGE move, it would have to be a REAL-CHANGE. Finally, 8.4 follows from Lemma 7. Lemma 9. There are at most O(n2 ) moves during an interval without REALCHANGE moves.
354
W. Goddard et al.
Proof. This follows immediately from Lemma 8. Lemma 10. Each node can make at most one incorrect REAL-CHANGE move. Proof. An incorrect REAL-CHANGE move can only occur as a node’s first CHANGE move, because subsequent CHANGE moves will be preceded by an ASK move, which by Lemma 5, must be correct. Lemma 11. Let (Mi ) be a sequence of moves made by Algorithm 2.2 during which no incorrect REAL-CHANGE occurs. Then the subsequence (Mi′ ) of REAL-CHANGE moves is a valid computation of S2k . Proof. This is clear. Lemma 12. Suppose Algorithm S2k can execute at most A moves. Then in any interval without an incorrect REAL-CHANGE move, Algorithm Sk can execute at most O(An2 ) moves. Proof. By Lemma 11, there can be at most A REAL-CHANGE moves, and by Lemma 9, between any two REAL-CHANGE moves, there are at most O(n2 ) moves. Theorem 1. In a network with n nodes, a distance-2k algorithm S2k that stabilizes within A moves can be implemented with a distance-k algorithm Sk that stabilizes in O(An3 ) moves. Proof. By Lemma 10 there can be at most n incorrect REAL-CHANGE moves. By Lemma 12, during the intervals without incorrect moves, there can be at most O(An2 ) moves. Finally by Lemma 2, the algorithm is correct. By repeating Theorem 1, we obtain Theorem 2. In a network with n nodes, a distance-k algorithm Sk which stabilizes in A moves can be implemented in the distance-1 model by an algorithm that stabilizes in O(An3⌈log2 (k)⌉ ) moves. Corollary 1. There is a self-stabilizing algorithm to find a maximal 4-packing that stabilizes in O(n7 )moves. Proof. This follows by Lemma 1 and Theorem 2. When we translate, say, a distance-4 algorithm S4 to a distance-2 algorithm S2 , each node will contain the original variable f used in S4 in addition to a pointer and a σ. Note that when S2 is then translated to a distance-1 algorithm S1 , each node will contain these three variables in addition to another pointer and another σ. A maximal 4-packing can be found by using a single boolean variable in the distance-4 model. However, to find a maximal 3-packing in the distance-4 model, nodes must know the distances of their neighbors. If we assume that in addition to its usual variables, each node displays a list of the IDs of its neighbors, then in
Distance-k Information in Self-stabilizing Algorithms
355
the distance-1 model, each node can compute the subgraph induced by its closed neighborhood. In the distance-k model, each node i can compute the subgraph induced by N k [i], and can compute, for example, the distance d(i, j) for j ∈ N k [i]. This is illustrated in Algorithm 2.3. This generalizes to a polynomial time self-stabilizing algorithm for maximal k-packing, for any fixed k, and improves upon the maximal k-packing algorithm in [4] that was given without analysis. Algorithm 2.3. Distance-4 algorithm for maximal 3-packing local variable: f ENTER: if f (i) = 0 ∧ (∀j ∈ N 4 (i), d(i, j) ≤ 3)(f (j) = 0) then f (i) = 1 LEAVE: if f (i) = 1 ∧ (∃j ∈ N 4 (i), d(i, j) ≤ 3)(f (j) = 1) then f (i) = 0
3
Maximal Irredundant Sets
Given a set S of nodes, we say a node s ∈ S has a private neighbor with respect to S if there exists some x ∈ N [s] − N [S − {s}]. A set S is irredundant [5] if every s ∈ S has a private neighbor with respect to S. Self-stabilizing algorithms have been found for many kinds of related sets, such as maximal independent sets and minimal dominating sets [6], but finding maximal irredundant sets has proven difficult because the problem seems to require distance-4 knowledge. Let S be a set of nodes, not necessarily irredundant, and let s ∈ S. If s has a private neighbor with respect to S, but s has no private neighbor with respect to S ∪ {x}, we say x destroys s. Finally, we say x ∈ V − S is safe if x has a private neighbor with respect to S ∪ {x}, and no s ∈ S is destroyed by x. Consider Algorithm 3.1. It is easy to see that if this algorithm stabilizes, then S = {i | f (i) = 1} is maximal irredundant. For if it is not irredundant, some i is privileged to execute a LEAVE move. And if it is not maximal irredundant, some i can execute an ENTER move. Note also that once a node executes an ENTER, it will never execute a LEAVE. Thus, given a sufficiently powerful model, each node moves at most twice. Algorithm 3.1. Maximal irredundant set local variable: f ENTER: if f (i) = 0 ∧ i is safe then f (i) = 1 LEAVE: if f (i) = 1 ∧ i has no private neighbor then f (i) = 0
356
W. Goddard et al.
Lemma 13. Node i can decide if it has a private neighbor from the information in N 2 [i]. Proof. A node x is a private neighbor of i if and only if x ∈ N [i], but for all j ∈ N 2 (i), j ∈ S implies x ∈ N [j]. Lemma 14. Node i can decide if it is safe from the information in N 4 [i]. Proof. If node i is not safe, then it must destroy some node j ∈ N 2 [i]. However, to know whether such a node j has a private neighbor requires examining {f (j ′ ) | j ′ ∈ N 2 [j]}. Theorem 3. There is a self-stabilizing algorithm for finding a maximal irredundant set that stabilizes in O(n7 ) moves. Proof. By Lemma 13 and Lemma 14 it follows that Algorithm 3.1 can be implemented in the distance-4 model. By our earlier comments, Algorithm 3.1 stabilizes in a linear number of moves. The analysis follows by Theorem 2. We observe that while Algorithm 3.1 makes a linear number of moves in the distance-4 model, each simulated move may not take constant time, although it will be polynomial.
References 1. Dijkstra, E.W.: Self-stabilizing systems in spite of distributed control. Comm. ACM 17 (11) (1974) 643–644 2. Dolev, S.: Self-Stabilization. MIT Press, 2000 3. Gairing, M., Goddard, W., Hedetniemi, S.T., Kristiansen, P., McRae, A.A.: Distance-two information in self-stabilizing algorithms, Parallel Process. Lett., 14 (2004) 387–398 4. Goddard, W., Hedetniemi, S.T., Jacobs, D.P., Srimani, P.K.: Self-stabilizing global optimization algorithms for large network graphs, Int. J. Dist. Sensor Net., 1 (2005) 329–344 5. Haynes, T.W., Hedetniemi, S.T., Slater, P.J.: Fundamentals of Domination in Graphs, Marcel Dekker, New York, 1998 6. Hedetniemi, S.M., Hedetniemi, S.T, Jacobs, D.P., Srimani, P.K.: Self-stabilizing algorithms for minimal dominating sets and maximal independent sets, Comput. Math. Appl., 46 (2003) 805–811
Author Index
Attiya, Hagit
Krizanc, Danny 1 Kutten, Shay 115
10
Bar-Noy, Amotz 171 Bein, Doina 334 Bil` o, Davide 295 Blin, L´elia 70 Bonichon, Nicolas 143 Calamoneri, Tiziana 227, 268 Chalopin, J´er´emie 85 Chlebus, Bogdan S. 253 Clementi, Andrea E.F. 227 Cohen, Reuven 29 Cormode, Graham 280 Datta, Ajoy K. 334 Derbel, Bilel 100 Di Ianni, Miriam 227 Dobrev, Stefan 197 Fraigniaud, Pierre 70 Fusco, Emanuele G. 268 Gagie, Travis 310 Gavoille, Cyril 100, 143 Goddard, Wayne 349 Gual` a, Luciano 295 Hedetniemi, Stephen T. 349 Hoepman, Jaap-Henk 115 Ilcinkas, David Jacobs, David P.
59 349
Kosowski, Adrian 130 Kowalski, Dariusz R. 44, 253 Kr´ aloviˇc, Rastislav 197 Kr´ aloviˇc, Richard 197 Kranakis, Evangelos 1
Labourel, Arnaud 143 Ladner, Richard E. 171 Laforest, Christian 157 Larmore, Lawrence L. 334 Lauria, Massimo 227 Lotker, Zvi 115 Malinowski, Adam 44 Monti, Angelo 227 Muthukrishnan, S. 280 Navarra, Alfredo 240 Nesterenko, Mikhail 212 Nisse, Nicolas 70 Patt-Shamir, Boaz 319 Peleg, David 29 Proietti, Guido 295 Ra¨ıpin Parv´edy, Philippe 182 Rajsbaum, Sergio 1 Raynal, Michel 182 Rokicki, Mariusz A. 253 Santoro, Nicola 197 Shafrir, Allon 319 Silvestri, Riccardo 227 Tamir, Tami 171 Tan, Richard B. 268 Thibault, Nicolas 157 Tixeuil, S´ebastien 212 Travers, Corentin 182 Trevisan, Vilmar 349 Vial, Sandrine 70 Vocca, Paola 268 Wattenhofer, Roger
24