Algorithmica - Springer Link

23 downloads 645 Views 271KB Size Report
simultaneous startup, optimal cost of rendezvous on any ring is. (D logl), where D ... Algorithm, Deterministic, Graph, Mobile agent, Rendezvous. 1. Introduction.
Algorithmica (2006) 46: 69–96 DOI: 10.1007/s00453-006-0074-2

Algorithmica © 2006 Springer Science+Business Media, Inc.

Deterministic Rendezvous in Graphs1 Anders Dessmark,2 Pierre Fraigniaud,3 Dariusz R. Kowalski,4 and Andrzej Pelc5 Abstract. Two mobile agents having distinct identifiers and located in nodes of an unknown anonymous connected graph, have to meet at some node of the graph. We seek fast deterministic algorithms for this rendezvous problem, under two scenarios: simultaneous startup, when both agents start executing the algorithm at the same time, and arbitrary startup, when starting times of the agents are arbitrarily decided by an adversary. The measure of performance of a rendezvous algorithm is its cost: for a given initial location of agents in a graph, this is the number of steps since the startup of the later agent until rendezvous is achieved. We first show that rendezvous can be completed at cost O(n + log l) on any n-node tree, where l is the smaller of the two identifiers, even with arbitrary startup. This complexity of the cost cannot be improved for some trees, even with simultaneous startup. Efficient rendezvous in trees relies on fast network exploration and cannot be used when the graph contains cycles. We further study the simplest such network, i.e., the ring. We prove that, with simultaneous startup, optimal cost of rendezvous on any ring is (D log l), where D is the initial distance between agents. We also establish bounds on rendezvous cost in rings with arbitrary startup. For arbitrary connected graphs, our main contribution is a deterministic rendezvous algorithm with cost polynomial in n, τ and log l, where τ is the difference between startup times of the agents. We also show a lower bound (n 2 ) on the cost of rendezvous in some family of graphs. If simultaneous startup is assumed, we construct a generic rendezvous algorithm, working for all connected graphs, which is optimal for the class of graphs of bounded degree, if the initial distance between agents is bounded. Key Words.

Algorithm, Deterministic, Graph, Mobile agent, Rendezvous.

1. Introduction. Two mobile agents located in nodes of a network, modeled as an undirected connected graph, have to meet at some node of the graph. This task is known in the literature as the rendezvous problem in graphs [6], and in this paper we seek efficient deterministic algorithms to solve it. If nodes of the graph are labeled then agents can decide to meet at a predetermined node and the rendezvous problem reduces to graph 1

This work was done during the authors’ visits at the Research Chair in Distributed Computing of the Universit´e du Qu´ebec en Outaouais. The results of this paper appeared in preliminary version in two conference papers: A. Dessmark, P. Fraigniaud and A. Pelc, Deterministic rendezvous in graphs, Proc. 11th Annual European Symposium on Algorithms (ESA 2003), September 2003, Budapest, Hungary, LNCS 2832, pp. 184– 195, and D. Kowalski and A. Pelc, Polynomial deterministic rendezvous in arbitrary graphs, Proc. 15th Annual Symposium on Algorithms and Computation (ISAAC 2004), December 2004, Hong Kong, LNCS 3341, pp. 644–656. 2 Department of Computer Science, Lund University, Box 118, S-22100 Lund, Sweden. [email protected]. 3 CNRS, LRI, Universit´ e Paris-Sud, 91405 Orsay, France. [email protected]. Additional support from INRIA Project “Grand Large.” 4 Department of Computer Science, The University of Liverpool, Chadwick Building, Peach Street, Liverpool L69 7ZF, England. [email protected]. Supported in part by NSF-NATO Award 0209588. 5 D´ epartement d’informatique, Universit´e du Qu´ebec en Outaouais, Gatineau, Qu´ebec, Canada J8X 3X7. [email protected]. Supported in part by NSERC discovery grant and by the Research Chair in Distributed Computing of the Universit´e du Qu´ebec en Outaouais. Received September 27, 2004; revised August 4, 2005. Communicated by R. Fleischer. Online publication June 19, 2006.

70

A. Dessmark, P. Fraigniaud, D. R. Kowalski, and A. Pelc

exploration. However, in many applications, when rendezvous is needed in an unknown environment, such unique labeling of nodes may not be available, or limited sensory capabilities of the agents may prevent them from perceiving such labels. Hence it is important to design rendezvous algorithms for agents operating in anonymous graphs, i.e., graphs without unique labeling of nodes. Clearly, the agents have to be able to distinguish ports at a node locally: otherwise, an agent may even be unable to visit all neighbors of a node of degree 3 (after visiting the second neighbor, the agent cannot distinguish the port leading to the first visited neighbor from the port leading to the unvisited one). Consequently, agents initially located at two nodes of degree 3, might never be able to meet. 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. No coherence between those local labelings is assumed. We also do not assume, in general, any knowledge of the topology of the graph or of its size. Likewise, agents are unaware of the distance separating them. 1.1. The Model Synchrony and startup times. Agents move in synchronous steps. In every step an agent may either remain in the same node or move to an adjacent node. We consider two scenarios: simultaneous startup, when both agents start executing the algorithm at the same time, and arbitrary startup, when starting times are arbitrarily decided by an adversary. In the former case, agents know that starting times are the same, while in the latter case, they are not aware of the difference between starting times, and each of them starts executing the rendezvous algorithm and counting steps since its own startup. The agent that starts earlier and happens to visit the starting node of the later agent before the startup of this later agent, is not aware of this fact, i.e, we assume that agents are created at their startup time and not waiting in the node before it. Adversarial decisions and cost of rendezvous. An agent, currently located at a node, does not know the other endpoints of yet unexplored incident edges. If the agent decides to traverse such a new edge, the choice of the actual edge belongs to an adversary, as we are interested in the worst-case performance. We assume that if agents get to the same node in the same step, they become aware of it and rendezvous is achieved. However, if agents cross each other along an edge (moving in the same step along the same edge in opposite directions) they do not notice this fact. In particular, rendezvous is not possible in the middle of an edge. The cost of a rendezvous algorithm, for a given initial location of agents in a graph, is the worst-case number of steps since the startup of the later agent until rendezvous is achieved, where the worst case is taken over all adversary decisions, whenever an agent decides to explore a new edge adjacent to a currently visited node, and over all possible startup times (decided by an adversary), in the case of the arbitrary startup scenario. In particular, time of local computations performed by agents does not contribute to cost. Labels and local knowledge. If agents are identical, i.e., they do not have distinct identifiers, and execute the same algorithm, then deterministic rendezvous is impossible even in the simplest case when the graph consists of two nodes joined by an edge, agents are initially located at both ends of it and start simultaneously: in every step both agents

Deterministic Rendezvous in Graphs

71

will either stay in different nodes or will both move to different nodes, thus they will never meet. Hence we assume that agents have distinct identifiers, called labels, which are two different integers written as binary strings starting with 1, and that every agent knows its own label. (For technical reasons we assume that labels are larger than 1. This assumption can be easily omitted by adding 1 to all labels.) If both agents knew both labels, the problem could be again reduced to that of graph exploration: the agent with the smaller label does not move, and the other agent searches the graph until it finds it. (This strategy is sometimes called “wait for mommy.”) However, the assumption that agents know each other may often be unrealistic: agents may be created in different parts of the graph in a distributed fashion, oblivious of each other. Hence we assume that each agent knows its own label but does not know the label of the other. The only initial input of a (deterministic) rendezvous algorithm executed by an agent is the agent’s label. During the execution of the algorithm, an agent learns the local port number by which it enters a node and the degree of the node. Notation. Labels of agents are denoted by L 1 and L 2 . The agent with label L i is called agent i. (An agent does not know its number, only the value of its label.) Labels are distinct integers larger than 1 represented as binary strings starting with 1. We denote by l the smaller of the two labels. The difference between startup times of the agents is denoted by τ . We denote by n the number of nodes in the graph, by the maximum degree and by D the distance between initial positions of agents. The agent with the earlier startup is called the earlier agent and the other agent is called the later agent. In the case of simultaneous startup, the earlier agent is defined as agent 1. (An agent does not know if it is earlier or later.) We use the word “graph” to mean a simple undirected connected graph with local port labelings but without node labels. 1.2. The Problems. In our setting it is not even obvious that (deterministic) rendezvous is at all possible. Of course, if the graph has a distinguished node, e.g., a unique node of a given degree, agents could decide to meet at this node, and hence rendezvous would be reduced to exploration (note that an agent visiting a node becomes aware of its degree). However, a graph may not have such a node, or its existence may be unknown and hence impossible to use in the algorithm. For example, it does not seem obvious a priori if rendezvous can be achieved in a ring. The following are some of the questions guiding our research: Q1. Is rendezvous feasible in arbitrary connected graphs? Q2. If so, can it be performed efficiently, i.e., at cost polynomial in the number n of nodes, in the difference τ between startup times and in labels L 1 , L 2 of the agents (or even polynomial in n, τ and log L 1 , log L 2 )? Q3. What is the optimal cost of rendezvous for simple classes of graphs, such as trees or rings? 1.3. Our Results. We start by introducing the problem in the relatively simple case of rendezvous in trees. We show that rendezvous can be completed at cost O(n + log l) on any n-node tree, even with arbitrary startup. We also show that for some trees this complexity cannot be improved, even with simultaneous startup. Trees are, however, a special case from the point of view of the rendezvous problem, as any tree has either a

72

A. Dessmark, P. Fraigniaud, D. R. Kowalski, and A. Pelc

central node or a central edge, which facilitates the meeting (incidentally, the possibility of the second case makes rendezvous not quite trivial, even in trees). As soon as the graph contains cycles, the technique which we use for trees cannot be applied. Hence it is natural to concentrate on the simplest class of such graphs, i.e., rings. We prove that, with simultaneous startup, optimal cost of rendezvous on any ring is (D log l). We construct an algorithm achieving rendezvous with this complexity and show that, for any distance D, it cannot be improved. With arbitrary startup, (n + D log l) is a lower bound on the cost required for rendezvous on an n-node ring. Under this scenario, we show two rendezvous algorithms for the ring: an algorithm with cost O(n log l), for known n, and an algorithm with cost O(lτ + ln 2 ), where τ is the difference between startup times, if n is unknown. For arbitrary connected graphs, our main contribution is a deterministic rendezvous algorithm with cost polynomial in n, τ and log l. The algorithm contains a non-constructive ingredient: agents use combinatorial objects whose existence we prove by the probabilistic method. Nevertheless our algorithm is indeed deterministic. Both agents can find separately the same combinatorial object with desired properties (which is then used in the rendezvous algorithm). This can be done using brute-force exhaustive search which may be quite complex but in our model only moves of the agents are counted and computation time of the agents does not contribute to cost. Moreover, it should be noticed that finding this combinatorial object can be done a single time at a preprocessing stage, the object can be stored in agents’ memory and subsequently used in many instances of the rendezvous problem. We also show a lower bound (n 2 ) on the cost of rendezvous in some family of graphs. If simultaneous startup is assumed, we construct a simple generic rendezvous algorithm, working for all connected graphs, which is optimal for the class of graphs of bounded degree, if the initial distance between agents is bounded. 1.4. Related Work. The rendezvous problem has been introduced in [25]. The vast literature on rendezvous (see [6] for a complete discussion and more references) can be divided into two classes: papers considering the geometric scenario (rendezvous in the line, see, e.g., [5], [7], [11], [12] and [19], or in the plane, see, e.g., [8] and [9]), and those discussing rendezvous in graphs, e.g., [2] and [4]. Most of the papers, e.g., [2], [3], [10], [11] and [20] consider the probabilistic scenario: inputs and/or rendezvous strategies are random. In [20] randomized rendezvous strategies are applied to study self-stabilized token management schemes. Randomized rendezvous strategies use random walks in graphs, which have been widely studied and applied also, e.g., in graph traversing [1], online algorithms [14] and estimating volumes of convex bodies [17]. A natural extension of the rendezvous problem is that of gathering [18], [20], [24], [26], when more than two agents have to meet in one location. Deterministic rendezvous with anonymous agents working in unlabeled graphs but equipped with tokens used to mark nodes was considered, e.g., in [23]. In [27] the authors considered rendezvous of many agents with unique labels. Although one of their scenarios is deterministic, it differs from our setting in that agents know the graph and they know a finite set containing the team of agents that are supposed to meet.

Deterministic Rendezvous in Graphs

73

2. Rendezvous in Trees. We introduce the rendezvous problem in the relatively simple case of trees. In this section we assume that agents know that they are in a tree, although they know neither the topology of the tree nor its size. Trees have a convenient feature from the point of view of rendezvous. Every tree has either a central node, defined as the unique node maximizing the distance from the farthest leaf, or a central edge, defined as the edge joining the only two such nodes. This suggests an idea for a natural rendezvous algorithm, even for arbitrary startup: explore the tree, find the central node or the central edge, and try to meet there. Exploring the tree is not a problem: an agent can perform depth-first search, keeping a stack for used port numbers. At the end of the exploration, the agent has a map of the tree, can identify the central node or the central edge, and can find its way either to the central node or to one endpoint of the central edge, in the latter case knowing which port corresponds to the central edge. In the first case rendezvous is accomplished after the later agent gets to the central node. In the second case the rendezvous problem in trees can be reduced to rendezvous on graph K 2 consisting of two nodes joined by an edge. We now show a procedure for rendezvous in this simplest graph. The Procedure Extend-Labels, presented below, performs a rendezvous on graph K 2 in the model with arbitrary startup. The procedure is formulated for an agent with label L. Enumerate the bits of the binary representation of L from left to right, i.e., starting with the most significant bit. The actions taken by agents are either move (i.e., traverse the edge) or stay (i.e., remain in place for one step). Steps are counted from the starting step of the agent. Intuitively, the behavior of the agent is the following. First, transform label L into the string L ∗ by writing bits 10 and then writing twice every bit of L. Then repeat indefinitely string L ∗ , forming an infinite binary string. The agent moves (stays) in step i, if the ith position of this infinite string is 1 (0). Below we give a more formal description of the algorithm: Procedure Extend-Labels In step 1 move. In step 2 stay. In steps 3 ≤ i ≤ 2log L + 4, move if bit (i − 2)/2 of L is 1, otherwise, stay. In steps i > 2log L + 4 behave as for step 1 + (i − 1 mod 2log L + 4). Figure 1 illustrates the execution of Procedure Extend-Labels for label 101. THEOREM 2.1. Procedure Extend-Labels performs rendezvous on graph K 2 in at most 2log l + 6 steps. PROOF. Assume, without loss of generality, that agent 1 does not start later than agent 2. Steps are counted from the startup of agent 2. The proof is divided into four cases.

1

0

1

1

0

0

1

1

1

0

1

1

Fig. 1. Extension of label 101.

0

0

1

1

1

0

···

74

A. Dessmark, P. Fraigniaud, D. R. Kowalski, and A. Pelc

Case 1: τ is odd. In this case either agent 1 stays in the second step or a rendezvous is accomplished in one of the first two steps. If agent 1 stays in the second step, since this is an odd step for this agent, it also stays in the third step. In the third step, however, agent 2 moves, as its action corresponds to the most significant bit of L 2 , which is 1. Thus rendezvous is accomplished no later than in step 3. Case 2: τ is even and not divisible by 2log L 1  + 4. In this case the actions of agent 1 in the first two steps are decided by the same bit in L 1 . Thus, the actions of the two agents will be different in one of the steps and a rendezvous is accomplished no later than in step 2. Case 3: τ is even and divisible by 2log L 1  + 4, and log L 1  = log L 2 . In this case at least one bit must be different in both labels. Let b be the position of this bit. In step 2b + 1 the behavior of the two agents is different, and a rendezvous is accomplished. Thus, rendezvous is accomplished no later than in step 2log L 1  + 3. Case 4: τ is even and divisible by 2log L 1  + 4, and log L 1  = log L 2 . In this case the actions of the agent with the smaller label are different in steps 2log l + 5 and 2log l + 6, while the other agent performs the same action. This results in a rendezvous no later than in step 2log l + 6. We can now formulate the following general algorithm for rendezvous in trees: Algorithm Rendezvous-in-Trees 1. Explore the tree 2. If there is a central node then go to this node and stay else go to one endpoint of the central edge execute Procedure Extend-Labels Since exploration of an n-node tree can be done at cost O(n), we get the following result. THEOREM 2.2. Algorithm Rendezvous-in-Trees performs rendezvous on any n-node tree in O(n + log l) steps. The following example shows that for some trees this complexity cannot be improved. THEOREM 2.3. There exist n-node trees on which any rendezvous algorithm requires cost (n + log l), even with simultaneous startup. PROOF. Consider an n-node tree, with n = 2k, consisting of two stars of degree k − 1 whose centers are joined by an edge. Suppose that agents are initially located in centers of these stars and start simultaneously. The adversary can prevent an agent from finding the edge joining their initial positions for 2(k −1) ∈ (n) steps. (After each unsuccessful attempt, the agent has to get back to its starting node.) This proves the lower bound (n) on the cost of rendezvous. In order to complete the proof, it is enough to show the lower

Deterministic Rendezvous in Graphs

75

bound (log l). We prove it in the simpler case of the two-node graph. (This also proves that Procedure Extend-Label is optimal for the two-node graph.) It is easy to extend the argument for our tree. For any integer x > 2 and any rendezvous algorithm working in t < x − 1 steps, we show two labels L 1 and L 2 of length x, such that the algorithm fails if agents placed on both ends of the edge have these labels. Let Si be the binary sequence of length t describing the move/stay behavior of agent i (if the agent moves in step r , the r th bit of its sequence is 1, otherwise it is 0). Since Si is a function of L i , and there are only 2t < 2x−1 possible sequences Si , it follows that there exist two distinct labels L 1 and L 2 of length x, such that S1 = S2 . Pick those two labels. During the first t steps, agents exhibit the same move/stay behavior, and hence they cannot meet.

3. Rendezvous in Rings. In this section we assume that agents know that the underlying graph is a ring, although, in general, they do not know its size. 3.1. Simultaneous Startup. We provide an algorithm that performs rendezvous on a ring in the simultaneous startup model, and prove that it works in an asymptotically optimal number of steps. In order to simplify the presentation, we first propose two algorithms that work only under certain additional conditions, and then show how to merge these algorithms into the final algorithm, working in all cases. Our first algorithm works under the condition that the lengths of the two labels are similar, more precisely, log log L 1  = log log L 2 . Let the extended label L i∗ be a sequence of bits of length 2log log L i +1 , consisting of the binary representation of label L i preceded by a (possibly empty) string of zeros. For example, the label 15 corresponds to the binary sequence 1111, while the label 16 corresponds to 00010000. The algorithm is formulated for an agent with label L and corresponding extended label L ∗ . Let m = 2log log L+1 be the length of L ∗ . Algorithm Similar-Length-Labels The algorithm works in stages numbered 1, 2, . . . until rendezvous is accomplished. Stage s consists of m phases, each of which has 2s+1 steps. In phase b of stage s do: If bit b of L ∗ is 1 then • move for 2s−1 steps in an arbitrary direction from the starting node, • move for 2s steps in the opposite direction, • go back to the starting node else stay for 2s+1 steps. LEMMA 3.1. Algorithm Similar-Length-Labels performs rendezvous in O(D log l) steps on a ring, if log log L 1  = log log L 2 . PROOF. If log log L 1  = log log L 2 , the lengths of the extended labels of both agents are equal, and therefore any phase b of any stage s of agent 1 starts and ends at the same

76

A. Dessmark, P. Fraigniaud, D. R. Kowalski, and A. Pelc

time as for agent 2. Since L 1 = L 2 , one of the agents is moving while the other is staying in at least one phase b of every stage. During stage s, every node at distance 2s−1 from the starting point of the agent will be visited. Thus, in phase b of stage s, where s is the smallest integer such that 2s−1 ≥ D, the agent that moves in this phase meets the agent that stays in this phase. The number of steps in this stage is O(D log l), which also dominates the sum of steps in all previous stages. Our second algorithm works under the condition that log log L 1  = log log L 2 . Let the activity number bi for agent i be 2 + log log L i . The algorithm is formulated for an agent with label L and activity number b. Algorithm Different-Length-Labels The algorithm works in stages. Stage s consists of s phases. Phase p of any stage consists of 2 p+1 steps. • In stage s < b, stay. • In stage s ≥ b, stay in phases p = s − b + 1. • In phase p = s − b + 1 of stage s ≥ b, move for 2 p−1 steps in an arbitrary direction, move in the opposite direction for 2 p steps, and go back to the starting node. LEMMA 3.2. Algorithm Different-Length-Labels performs a rendezvous in O(D log l) steps, if log log L 1  = log log L 2 . PROOF. If log log L 1  = log log L 2 , the agents have different activity numbers. Assume, without loss of generality, that l = L 1 . Hence b1 < b2 . In stage s ≥ b1 , agent 1 visits every node within distance 2s−b1 from its starting node (in phase s − b1 + 1). Hence, rendezvous is accomplished in stage s, where s is the smallest integer such that 2s−b1 ≥ D, i.e., s = b1 + log D. Stage s consists of O(2s ) steps and dominates the sum of steps in all previous phases. The required number of steps is thus O(2b1 +log D ) = O(D log l). We now show how to combine Algorithm Similar-Length-Labels with Algorithm Different-Length-Labels into an algorithm that works for entirely unknown labels. The idea is to interleave steps where Algorithm Similar-Length-Labels is performed with steps where Algorithm Different-Length-Labels is performed. However, this must be done with some care, as an agent cannot successfully switch algorithms when away from its starting node. The solution is to assign slices of time of increasing size to the algorithms. At the beginning of a phase of each of the algorithms, the agent is at its starting node. If it can complete the given phase of this algorithm before the end of the current time slice, it does so. Otherwise it waits (at its starting node) until the beginning of the next time slice (devoted to the execution of the other algorithm), and then proceeds with the execution of the halted phase in the following time slice. (Note that, while one agent remains idle till the end of a time slice, the other agent might be active, if Algorithm Similar-Length-Labels is executed and the label lengths are in different ranges.)

Deterministic Rendezvous in Graphs

77

It only remains to specify the sequence of time slices. Let time slice t consist of 2t+1 steps (shorter slices than four steps are pointless). It is now enough to notice that the phases up for execution during a time slice will never have more steps than the total number of steps in the slice. As a phase of an algorithm has never more than twice the number of steps of the preceding phase, at least a constant fraction of every time slice is actually utilized by the algorithm. Exactly one of the algorithms has its condition fulfilled by the labels, and this algorithm accomplishes a rendezvous in O(D log n) steps, while the other algorithm has been assigned at most twice as many steps in total. We now present the main result of this section. THEOREM 3.1. In the simultaneous startup model the minimum cost of rendezvous in the ring is (D log l). PROOF. The upper bound has been shown above. For the lower bound, assume that D > 1 (if D = 1, the lower bound proof from the previous section is easy to modify for the ring). Define an infinite sequence of consecutive segments of the ring, of D/2 vertices each, starting clockwise from an arbitrary node in the ring. Note that the starting nodes of the agents are located in two different segments, with one or two segments in between. Divide all steps into periods of D/2 steps each, with the first step as the first step of the first period. During any period, an agent can only visit nodes of the segment where it starts the period and the two adjacent segments. Suppose that port numbers (fixed by an adversary at every node) yield an orientation of the ring, i.e., for any node v, the left neighbor of the right neighbor of v is v. The behavior of an agent with label L, running algorithm A, yields the following sequence of integers in {−1, 0, 1}, called the behavior code. The tth term of the behavior code of an agent is −1 if the agent ends time period t in the segment to the left of where it began the period, 1 if it ends to the right and 0 if it ends in the segment in which it began the period. In view of the orientation of the ring, the behavior of an agent, and hence its behavior code, depends only on the label of the agent. Note that two agents with the same behavior code of length x, cannot accomplish rendezvous during the first x periods, if they start separated by at least one segment: even though they may enter the same segment during the period, there is insufficient time to visit the same node. Assume that there exists an algorithm A which accomplishes rendezvous in Dy/6 steps. This cost corresponds to at most y/2 periods. There are only 3 y/2 < 2 y behavior codes of length y/2. Hence it is possible to pick two distinct labels L 1 and L 2 not greater than 2 y , for which the behavior code is the same. For these labels algorithm A does not accomplish rendezvous in Dy/6 steps. This contradiction implies that any rendezvous algorithm requires cost (D log l). 3.2. Arbitrary Startup. We begin by observing that, unlike in the case of simultaneous startup, (n) is a natural lower bound for rendezvous cost in an n-node ring, if startup is arbitrary, even for bounded distance D between starting nodes of the agents. Indeed, since starting nodes can be antipodal, each of the agents must at some point travel at distance at least n/4 from its starting node, unless he meets the other agent before. Suppose that the later agent starts at the time when the earlier agent is at distance n/4 from its starting node v. The distance D between the starting node of the later agent and v can be any

78

A. Dessmark, P. Fraigniaud, D. R. Kowalski, and A. Pelc

number from 1 to an, where a < 14 . Then rendezvous requires cost (n) (counting, as usual, from the startup of the later agent), since at the startup of the later agent the distance between agents is (n). On the other hand, the lower bound (D log l) from the previous subsection is still valid, since an adversary may also choose simultaneous startup. Hence we have PROPOSITION 3.1. In the arbitrary startup model the minimum cost of rendezvous in the n-node ring is (n + D log l). We now turn attention to upper bounds on the cost of rendezvous in the ring with arbitrary startup. Our next result uses the additional assumption that the size n of the ring is known to the agents. The idea is to modify Procedure Extend-Labels. Every step in Procedure Extend-Labels is replaced by 2n steps: the agent stays, respectively moves, in one (arbitrary) direction, for this amount of time. Recall that in Procedure ExtendLabels the actions of the two agents differ in step 2log l + 6 at the latest (counting from the startup of the later agent). In the modified procedure, time segments of activity or passivity, lasting 2n steps, need not be synchronized between the two agents (if τ is not a multiple of 2n) but these segments clearly overlap by at least n steps. More precisely, after time at most 2n(2log l + 6), there is a segment of n consecutive steps in which one agent stays and the other moves in one direction. This must result in a rendezvous. Thus we have the following result which should be compared with the lower bound from Proposition 3.1. (Note that this lower bound holds even when agents know n.) THEOREM 3.2. For a ring of known size n, rendezvous can be accomplished in O(n log l) steps. The above idea cannot be used for rings of unknown size, hence we give a different algorithm working without this additional assumption. We first present the idea of the algorithm. A similar, although technically much more involved idea underlies our rendezvous algorithm for arbitrary graphs, described in Section 5. Hence the present algorithm may serve as a convenient introduction to the general one, in a simple setting. Without loss of generality assume that L 1 > L 2 . Our goal is to have agent 1 find agent 2 by keeping the latter still for a sufficiently long time, while agent 1 moves along the ring. Since agents do not know whose label is larger, we schedule alternating segments of activity and passivity of increasing length, in such a way that the segments of agent 1 outgrow those of agent 2. The algorithm is formulated for an agent with label L. Algorithm Ring-Arbitrary-Startup For k = 1, 2, . . . • Move for k L steps in one (arbitrary) direction. • Stay for k L steps. THEOREM 3.3. ln 2 ) steps.

Algorithm Ring-Arbitrary-Startup accomplishes rendezvous in O(lτ +

Deterministic Rendezvous in Graphs

79

PROOF. Without loss of generality assume that L 1 > L 2 . First suppose that agent 2 starts before agent 1. Agent 1 performs active and passive segments of length k L 1 from step k(k − 1)L 1 + 1 to step  k(k + 1)L 1 . The length of the time segment of agent 1, containing step t, is  12 +

+ (t − 1)/L 1 L 1 . Similarly, the length of the seqment of  agent 2, containing step t, is  12 + 14 + (t + τ − 1)/L 2 L 2 . There exists a constant c 1 4

such that after step cn 2 every passive segment of agent 2 is of length greater than n. It now remains to establish when the active segments of agent 1 are sufficiently longer than those of agent 2. When the difference is 2n or larger, there are at least n consecutive steps where agent 1 moves (and thus visits every node of the ring),while agent 2 stays. In the

worst case L 1 = L 2 + 1 = l + 1 and the inequality  12 + 14 + (t − 1)/(l + 1)(l +  1) −  12 + 14 + (t + τ − 1)/ll ≥ 2n is satisfied by some t ∈ O(lτ + ln 2 ). If agent 2 starts after agent 1, the condition that the length of the passive segments of agent 2 is at least n is still satisfied after step cn 2 , for some constant c, and the second condition (concerning the difference between the agents’ segments) is satisfied even sooner than in the first case. Rendezvous is accomplished by the end of the segment containing step t ∈ O(lτ + ln 2 ). Since the length of this segment is also O(lτ + ln 2 ), this concludes the proof. Note. It follows from a forthcoming paper [21] that rendezvous time in rings with arbitrary startup can be decreased to O(n log l).

4. Rendezvous in Arbitrary Connected Graphs 4.1. Simultaneous Startup. For the scenario with simultaneous startup in arbitary connected graphs, we use techniques from Section 3.1, together with the following lemma. LEMMA 4.1. Every node within distance D of a node v in a connected graph of maximum degree , can be visited by an agent, starting in v and returning to v, in O(D D ) steps. PROOF. Apply breadth-first search. There are O( D ) paths of length at most D originating in node v. Thus, in O(D D ) steps, all of these paths are explored and all nodes within distance D are visited. We keep the exact pattern of activity and passivity from the interleaving algorithm of Section 3.1 but replace the linear walk from the starting node by a breadth-first search walk: if the alloted time in a given phase is t, the agent performs breadth-first search for t/2 steps and then backtracks to the starting node. Since the only difference is that we now require a phase of length O(D D ) to accomplish rendezvous, instead of a phase of length O(D) for the ring, we get the following result.

80

A. Dessmark, P. Fraigniaud, D. R. Kowalski, and A. Pelc

THEOREM 4.1. Rendezvous can be accomplished in O(D D log l) steps in an arbitrary connected graph with simultaneous startup. Note that agents do not need to know the maximum degree of the graph to perform the above algorithm. Also note that the above result is optimal for bounded distance D between agents and bounded maximum degree , since (log l) is a lower bound. 4.2. Arbitrary Startup. This section contains our main result for rendezvous in arbitrary connected graphs: we show a deterministic rendezvous algorithm with cost polynomial in n, τ and log l. We first construct a simpler rendezvous algorithm polynomial in n, τ and l (instead of log l). We do this to present the main idea of the algorithm and of its analysis without additional complications needed to decrease the cost. Then we show how to modify this algorithm in order to decrease its cost to polynomial in n, τ and log l. 4.2.1. A Rendezvous Algorithm Polynomial in n, τ and l. A walk of length k in a graph is a sequence (v1 , . . . , vk ) of nodes such that node vi+1 is adjacent to vi , for all i < k. A covering walk is a walk in which every node of the graph appears at least once. The aim of this subsection is to give a deterministic procedure, using a number of steps polynomial in n which, when started in any node of an unknown graph with at most n nodes, produces a covering walk in this graph. This procedure will be an important ingredient in our rendezvous algorithms. Define a random walk of an agent in graph G as a walk in which the agent, currently located at a node of degree d, acts in the next step as follows: it remains in the node with probability 1/2 and moves through any port with the same probability 1/(2d). The cover time of the graph G during a random walk starting at node v is the random variable denoting the smallest number of steps after which the agent performing this walk visits all nodes of the graph. The meeting time of two agents performing simultaneous random walks in graph G, starting at nodes v and w, is the random variable denoting the smallest number of steps after which agents performing these walks meet at some node. We use the following lemma proved in [15]: LEMMA 4.2. There exists a constant α > 0 such that the probability of each of the following events is at least 1/2: Event E 1 : the cover time of graph G with n nodes during the random walk starting at any node is at most αn 3 . Event E 2 : the meeting time of two agents performing simultaneous random walks in graph G with n nodes is at most αn 3 , for any starting nodes. Let α be the constant from Lemma 4.2. Let λ(n) = 2αn 5 log n. The next lemma shows a useful property of a random walk. LEMMA 4.3. A random walk of length λ(n) starting at node v in a graph G with at 2 most n nodes is a covering walk, with probability at least 1 − 2−2n log n . PROOF. Consider random binary variables X 1 , . . . , X m , where m = 2n 2 log n and, for every i = 1, . . . , m, X i is equal to 1 if the agent visits all nodes in G in period

Deterministic Rendezvous in Graphs

81

[αn 3 (i − 1) + 1, αn 3 i] and has not visited all nodes by step αn 3 (i − 1). The probability 2 that X 1 = · · · = X m = 0 is at most (1/2)m = (1/2)−2n log n . The fact that probabilities 1/2 are multiplied follows from the fact that the agent covers graph G in a time segment of length αn 3 with probability at least 1/2 independently of the starting point (by properties of event E 1 from Lemma 4.2 proved in [15]), and from the random walk property (future depends only on the current point, not on history). This concludes the proof. For any positive integer n and any function h n : {1, . . . , λ(n)} × {1, . . . , n − 1} −→ {0, 1, . . . , n − 1}, such that h n (i, d) ≤ d, we define the following procedure describing a walk of length λ(n) in a graph G, starting at a node v (cf. the upper bound for the length of a universal traversal sequence [1]): Procedure GRAPHCOVER(n, h n ) In step i ≤ λ(n) the agent, currently located at a node of degree d, moves to an adjacent node by port h n (i, d), or remains idle if h n (i, d) = 0 . After step λ(n) it stops. LEMMA 4.4. For any n, there exists a function h n : {1, . . . , λ(n)} × {1, . . . , n − 1} −→ {0, 1, . . . , n−1}, such that h n (i, d) ≤ d and the Procedure GRAPHCOVER(n, h n ) starting at any node of any graph G with at most n nodes, produces a covering walk in this graph. PROOF. Fix n. Fix a graph G with at most n nodes and fix some starting node v in 2 2 G. We can do it in at most n n · n ≤ 2n (log n+1) different ways, for fixed n. Applying Lemma 4.3, the probability of the event “there exists a graph G with at most n nodes and a starting node v in G, such that the random walk of length λ(n) in graph G starting in v is not a covering walk” is at most 2−2n

2

log n

· 2n

2

(log n+1)

≤ 2−n .

Using the probabilistic argument we prove the existence of the desired function, which completes the proof. Note that the problem of construction of function h n satisfying Lemma 4.4 is hard (cf. hardness of a construction of a universal traversal sequence even for 3-regular graphs [13]). In our applications to rendezvous algorithms, agents will use Procedure GRAPHCOVER(n, h n ) producing a covering walk in any graph with at most n nodes. To this end we want each of the agents to find the same function h n whose existence is guaranteed by Lemma 4.4. (This can be done by exhaustive search, ordering all such possible functions in a canonical way and checking them one by one to find the first suitable one. Recall that, according to our model, only moves of the agents are accounted for, and computation time of the agents does not contribute to rendezvous cost.) Let hˆ n be the first function in this canonical ordering, satisfying Lemma 4.4, for any n. To simplify notation, we write GRAPHCOVER(n) instead of GRAPHCOVER(n, hˆ n ). Hence procedure GRAPHCOVER(n) takes λ(n) = 2αn 5 log n steps and produces a covering walk in any graph with at most n nodes.

82

A. Dessmark, P. Fraigniaud, D. R. Kowalski, and A. Pelc

In order to design rendezvous algorithm PA we now define the following procedure EXTENDEDGRAPHCOVER: Procedure EXTENDEDGRAPHCOVER(i) For j = 1, 2, . . . , i do GRAPHCOVER(2i ) For j = i, i − 1, . . . , 1 do GRAPHCOVER(2i )  The above procedure, taking λ∗ (i) = 2 · ij=1 λ(2i ) steps, serves in turn to define procedure COVERWALK(x) used in Algorithm PA. Procedure COVERWALK(x) takes x steps and consists of executing EXTENDEDGRAPHCOVER(i) for the largest i satisfying λ∗ (i) ≤ x and then staying idle for the remaining x − λ∗ (i) time steps. We will show that the following algorithm completes rendezvous in any n-node graph, for agents with arbitrary labels L 1 , L 2 , with arbitrary delay τ , in cost polynomial in n, l = min{L 1 , L 2 } and τ : Algorithm PA (PassiveActive) for agent with label L. For k = 1, 2, . . . do Passive Phase: Wait for 2Lk steps Active Phase: • COVERWALK(Lk), starting from the current node in the graph • Perform L times COVERWALK(k), always starting from the current node in the graph Let k0 = λ∗ (log n). The idea of the algorithm is to guarantee that one of the agents is passive while the other agent L performs procedure COVERWALK and thus completes rendezvous. (We refer to this situation by saying that the active agent meets the passive agent—an asymmetric relation.) This is the reason for having increasing time segments of activity and passivity. The turn of the “for” loop for a given k is called the kth epoch of the agent. The kth epoch of agent with label L has two phases of equal length 2Lk: the passive phase and the active phase. The active phase is composed of an execution of COVERWALK(Lk) followed by L executions of COVERWALK(k). This is the subtle point in the algorithm design: it seems that none of these parts alone (one long execution of COVERWALK or many short executions of it) permits us to guarantee rendezvous in cost polynomial in n, l and τ . We analyze the performance of Algorithm PA as a function of n, l and τ . Let G be an n-node graph and let L 1 , L 2 be the labels of agents. Without loss of generality assume that L 1 > L 2 = l. We start counting time steps from the startup of the later agent. For every step t denote by ki (t), for i = 1, 2, the number of epochs executed by agent i in step t. We will use the following fact, which follows from the properties of COVERWALK(k), and from the definition of k0 . FACT 4.1. 1. If one agent starts its active phase of epoch k in time t, where L 1 k ≥ 2k0 , and the other agent is in the passive phase during the time segment [t, t +k0 ), then rendezvous is completed by step t + k0 .

Deterministic Rendezvous in Graphs

83

2. Assume k ≥ k0 . If one agent is in the second half of its active phase of epoch k in the time segment [t, t + 2k0 ), and the other agent is in a passive phase during the time segment [t, t + 2k0 ), for some t, then rendezvous is completed by step t + 2k0 . 3. Assume k ≥ k0 . If one agent ends its active phase of epoch k in time t, and the other agent is in a passive phase during the time segment (t − k0 , t], then rendezvous is completed by step t. The following lemma estimates the cost of rendezvous under some technical conditions. LEMMA 4.5. Let t1 , t2 be steps ending epochs k1 (t1 ), k2 (t2 ) of the first and second agent, respectively. Assume that L 1 k1 (t1 ) ≥ 40k0 , k2 (t2 ) ≥ 10k0 , |t1 − t2 | ≤ 4k0 and |L 1 k1 (t1 ) − L 2 k2 (t2 )| ≤ 2k0 . Then rendezvous is completed by step t2 + 26lk2 (t2 )k0 . PROOF. Let ti , for i = 1, 2, be the end of epoch ki (ti ) + y for y = 6k0 /(L 1 − L 2 ) of the ith agent. We have t1 = t1 +

k 1 (t1 )+y

4L 1 j = t1 + 2L 1 y[2k1 (t1 ) + y + 1]

j=k1 (t1 )+1

and t2 = t2 +

k 2 (t2 )+y

4L 2 j = t2 + 2L 2 y[2k2 (t2 ) + y + 1].

j=k2 (t2 )+1

Therefore, using inequality 6k0 /(L 1 − L 2 ) · (L 1 − L 2 ) ≥ 6k0 , we can bound t1 − t2 as follows: t1 − t2 = t1 + 2L 1 y[2k1 (t1 ) + y + 1] − t2 − 2L 2 y[2k2 (t2 ) + y + 1] = t1 − t2 + 4y[L 1 k1 (t1 ) − L 2 k2 (t2 )] + 2y 2 [L 1 − L 2 ] + 2y[L 1 − L 2 ] ≥ −4k0 − 8yk0 + 12yk0 + 12k0 > 4k0 . Let x be the first step such that t1 ≥ t2 + 4k0 , where t1 is the end of epoch k1 (t1 ) + x of the first agent and t2 is the end of epoch k2 (t2 ) + x of the second agent. By the above argument, x is well defined and x ≤ y < 6k0 /(L 1 − L 2 ) + 1. Consider two cases. Case 1: The beginning of epoch k2 (t2 ) + x of the second agent is more than 2k0 later than the beginning of epoch k1 (t1 ) + x of the first agent. Since k2 (t2 ) + x − 1 ≥ 10k0 > k0 , during the time segment [t2 − 4L 2 (k2 (t2 ) + x) − k0 + 1, t2 − 4L 2 (k2 (t2 ) + x)] the second agent meets the first one (which is passive in this period) by Fact 4.1 point 3, i.e., rendezvous is completed by the end of epoch k2 (t2 ) + x of the second agent. Case 2: The beginning of epoch k2 (t2 ) + x of the second agent is at most 2k0 later than the beginning of epoch k1 (t1 ) + x of the first agent (this includes the case when this difference is negative). Then the middle of epoch k1 (t1 ) + x of the first agent is in step t1 − 2L 1 [k1 (t1 ) + x], and the middle of epoch k2 (t2 ) + x of the second agent is in step

84

A. Dessmark, P. Fraigniaud, D. R. Kowalski, and A. Pelc

t2 − 2L 2 [k2 (t2 ) + x]. Hence we have t2 − 2L 2 [k2 (t2 ) + x] > t1 − 4L 1 [k1 (t1 ) + x], since t2 − 4L 2 [k2 (t2 ) + x] ≥ t1 − 4L 1 [k1 (t1 ) + x] − 4k0 (by definition of x) and k2 (t2 ) ≥ 10k0 . We also have t2 − 2L 2 [k2 (t2 ) + x] + k0 ≤ t1 − 2L 1 [k1 (t1 ) + x], since by definition of x, t1 − 2L 1 [k1 (t1 ) + x] − t2 + 2L 2 [k2 (t2 ) + x] is equal to t1 + t1 − 4L 1 [k1 (t1 ) + x] t2 + t2 − 2L 2 [k2 (t2 ) + x] − 2 2 t1 − t2 t1 − 4L 1 [k1 (t1 ) + x] − t2 + 2L 2 [k2 (t2 ) + x] = + 2 2 ≥ 2k0 − k0 = k0 . Hence in the time segment [t2 − 2L 2 [k2 (t2 ) + x] + 1, t2 − 2L 2 [k2 (t2 ) + x] + k0 ] the first agent is passive, while the second one starts its active phase in time t2 −2L 2 [k2 (t)+x]+1, which by Fact 4.1 point 1 gives rendezvous time by the end of epoch k2 (t) + x of the second agent. The latter is in step t2 +

k 2 (t2 )+x

4L 2 j = t2 + 2L 2 y[2k2 (t2 ) + y + 1] < t2 + 26lk2 (t2 )k0 .

j=k2 (t2 )+1

The next three lemmas estimate the time step by which rendezvous is completed, depending on the number of epoch changes of one agent during one epoch of the other. LEMMA 4.6. 1. Let t be the beginning of epoch k1 (t) of the first agent and assume that L 1 k1 (t) ≥ 40k0 and k2 (t) ≥ 10k0 . If the second agent ends its epoch only once during epoch k1 (t) of the first agent, then rendezvous is completed by step t + 11lk2 (t) + 26lk2 (t)k0 . 2. Let t be the beginning of epoch k2 (t) of the second agent and assume that L 1 k1 (t) ≥ 40k0 and k2 (t) ≥ 10k0 . If the first agent ends its epoch only once during epoch k2 (t) of the second agent, then rendezvous is completed by step t + 11lk2 (t) + 26lk2 (t)k0 . PROOF. We first prove part 1 of the lemma. Let t be the beginning of epoch k1 (t) of the first agent and let t  be the end of it. Let t + x, for some 0 ≤ x ≤ t  − t, be the end of epoch k2 (t) of the second agent. Consider step t  + y which is the end of epoch k2 (t) + 1 of the second agent. There are three cases. Case A: x < 2k0 . • If y < 4k0 then apply Lemma 4.5 to steps t  and t  + y to obtain that rendezvous is completed by step t  + y + 26l[k2 (t) + 1]k0 . • If y ≥ 4k0 then the first agent starts its active phase in step t + (t  − t + 1)/2 + 1 while the second one is passive during the time segment [t + (t  − t + 1)/2 + 1, t + (t  − t + 1)/2 + k0 ], which by inequality (t  − t + 1)/4 = L 1 k1 (t) ≥ 40k0 and Fact 4.1 point 1 implies that rendezvous is completed by step t  .

Deterministic Rendezvous in Graphs

Case B: 2k0 ≤ x ≤ t  − t − 4k0 . There are two subcases:

85

We have t + x − 2L 2 k2 (t) ≤ t + (t  − t + 1)/2 − 2k0 .

• If t + x − 2L 2 k2 (t) ≥ t then the first agent is passive in the time segment [t + x − 2L 2 k2 (t) + 1, t + x − 2L 2 k2 (t) + k0 ], while the second one starts its active phase in step t + x − 2L 2 k2 (t) + 1, which by Fact 4.1 point 1 implies that rendezvous is completed by step t + x; • if t + x − 2L 2 k2 (t) < t then the first agent is passive in the time segment [t + min{x, (t  − t + 1)/2}−2k0 +1, t +min{x, (t  − t + 1)/2}], while the second one is in the second half of its active phase during the time segment [t +min{x, (t  − t + 1)/2}− 2k0 +1, t +min{x, (t  − t + 1)/2}], which by Fact 4.1 point 2 implies that rendezvous is completed by step t + x. Case C: x > t  − t − 4k0 . • If t  + y ≤ t  + (t  − t + 1) + 4L 1 − 2k0 then the first agent is passive during the time segment [t + x + (t  + y − (t + x))/2 + 1, t + x + (t  + y − (t + x))/2 + k0 ] (since t + x + (t  + y − (t + x))/2 + 1 > t  and t + x + (t  + y − (t + x))/2 + k0 ≤ t  + (t  − t + 1)/2 + 2L 1 ), while the second one starts its active phase in step t + x + (t  + y − (t + x))/2 + 1. Applying Fact 4.1 point 1 we obtain that rendezvous is completed by step t  + y. • If t  + y > t  + (t  − t + 1) + 4L 1 − 2k0 then we apply Lemma 4.5 to steps t  + (t  − t + 1) + 4L 1 and t  + y to obtain that rendezvous time is at most t  + y + 26l[k2 (t) + 1]k0 . Therefore in all cases rendezvous is completed by step t  + y + 26l[k2 (t) + 1]k0 ≤ t + 8L 2 k2 (t) + 4L 2 + 26l[k2 (t) + 1]k0 ≤ t + 11lk2 (t) + 26lk2 (t)k0 . The proof of part 2 of the lemma is similar, but there are some subtle differences in comparison with the proof of the first part, due to the asymmetry of the assumptions (L 1 > L 2 but startup time of the first agent may be either smaller or larger than that of the second agent). Let t be the beginning of epoch k2 (t) of the second agent and let t  be the end of it. Let t + x, for some 0 ≤ x ≤ t  − t, be the end of epoch k1 (t) of the first agent. Consider step t  + y which is the end of epoch k1 (t) + 1 of the first agent. Case A: x < 4k0 • If y < 6k0 then we apply Lemma 4.5 to steps t  + y and t  to obtain that rendezvous is completed by step t  + 26lk2 (t)k0 . • If y ≥ 6k0 then the second agent starts its active phase in step t + (t  − t + 1)/2 + 1, while the first one is passive during the time segment [t + (t  − t + 1)/2 + 1, t + (t  − t + 1)/2 + k0 ], which by inequality (t  − t + 1)/4 = L 2 k2 (t) ≥ 10k0 and Fact 4.1 point 1 implies that rendezvous is completed by step t  . Case B: 4k0 ≤ x ≤ t  − 4k0 − t. We have t + x + 2L 2 [k2 (t) + 1] ≥ t + (t  − t + 1)/2 + 2k0 . It follows that the second agent starts its active phase in step t + (t  − t + 1)/2 + 1, while the first one is passive during the time segment [t + (t  − t + 1)/2 + 1, t + (t  − t + 1)/2 + k0 ]. Consequently, by Fact 4.1 point 1, rendezvous is completed by step t  .

86

A. Dessmark, P. Fraigniaud, D. R. Kowalski, and A. Pelc

Case C: x > t  − 4k0 − t. • If t  + y ≤ t  + (t  − t + 1) + 4L 2 − 2k0 then the second agent is passive during the time segment [t + x + (t  + y − (t + x))/2 + 1, t + x + (t  + y − (t + x))/2 + k0 ] (since t + x + (t  + y − (t + x))/2 + 1 > t  and t + x + (t  + y − (t + x))/2 + k0 ≤ t  + (t  − t + 1)/2 + 2L 2 ), while the first one starts its active phase in step t + x + (t  + y − (t + x))/2 + 1. Applying Fact 4.1 point 1 we obtain that rendezvous is completed by step t  + y. • If t  + y > t  + (t  − t + 1) + 4L 2 − 2k0 then we apply Lemma 4.5 to steps t  + y and t  + (t  − t + 1) + 4L 2 to obtain that rendezvous is completed by step t  + (t  − t + 1) + 4L 2 + 26l[k2 (t) + 1]k0 < t  + y + 2k0 + 26l[k2 (t) + 1]k0 . Therefore in all cases rendezvous is completed by step t  + y + 26l[k2 (t) + 1]k0 + 2k0 ≤ t + 8L 2 k2 (t) + 4L 2 + 26l[k2 (t) + 1]k0 + 2k0 ≤ t + 11lk2 (t) + 26lk2 (t)k0 . LEMMA 4.7. 1. Let t be the beginning of epoch k1 (t) of the first agent and assume that L 1 k1 (t) ≥ 40k0 and k2 (t) ≥ 10k0 . If the second agent ends its consecutive epochs twice during epoch k1 (t) of the first agent, then rendezvous is completed by step t +14lk2 (t)+26lk2 (t)k0 . 2. Let t be the beginning of epoch k2 (t) of the second agent and assume that L 1 k1 (t) ≥ 40k0 and k2 (t) ≥ 10k0 . If the first agent ends its consecutive epochs twice during epoch k2 (t) of the second agent, then rendezvous is completed by step t + 14lk2 (t) + 26lk2 (t)k0 . PROOF. We first prove part 1 of the lemma. Let t be the beginning of epoch k1 (t) of the first agent and let t  be the end of it. Let t + x and t + y, for some integers 0 ≤ x < y ≤ t  − t, be steps when the second agent ends its consecutive epochs. Since the length of epochs increases, we have that x ≤ (t  − t + 1)/2 − 4L 2 . Case A: t  − t + 1 ≤ y − x + 4k0 . The lemma follows from Lemma 4.5 applied to steps t  and t + y. Rendezvous is completed by step t + y + 26lk2 (t + y)k0 . Case B: t  − t + 1 > y − x + 4k0 . • If x ≥ k0 then Fact 4.1 point 3 implies that rendezvous takes place in the time segment [t + x − k0 + 1, t + x], which is before t + y. • If x < k0 then t + y < t  −3k0 , and consequently the second agent starts its active phase in step t +x +(y − x)/2+1 < t +k0 +(t  − t + 1)/2−2k0 +1 = t +(t  − t + 1)/2− k0 + 1. In the time segment [t + x + (y − x)/2 + 1, t + x + (y − x)/2 + 1 + k0 ] the first agent is in the passive phase, which by Fact 4.1 point 1 implies that rendezvous is completed by step t + y. Therefore in all cases rendezvous is completed by step t +y+26lk2 (t +y)k0 ≤ t +8L 2 k2 (t)+4L 2 +26l[k2 (t)+1]k0 ≤ t +11lk2 (t)+26lk2 (t)k0 .

Deterministic Rendezvous in Graphs

87

We now prove part 2 of the lemma. Again, there are some differences compared with part 1. Let t be the beginning of epoch k2 (t) of the second agent and let t  be the end of it. Let t + x and t + y, for some integers 0 ≤ x < y ≤ t  − t, be steps when the first agent ends its consecutive epochs. Notice again that since the length of epochs increases, we have that x ≤ (t  − t + 1)/2 − 4L 2 . Case A: t  − t + 1 ≤ y − x + 4k0 . The lemma follows from Lemma 4.5 applied to steps t + y and t  . Rendezvous is completed by step t  + 26lk2 (t  )k0 . Case B: t  − t + 1 > y − x + 4k0 . Subcase B1: t + y ≥ t  − k0 . We have t + y − (y − x)/2 + 1 > t  − (t  − t + 1)/2 + k0 . The second agent starts its active phase in step t  − (t  − t + 1)/2 + 1. The first agent is passive during the time segment [t  − (t  − t + 1)/2 + 1, t  − (t  − t + 1)/2 + k0 ]. By Fact 4.1 point 1, rendezvous is completed by step t + y. Subcase B2: t + y < t  − k0 . • If y > t  − (t  − t + 1)/2 then the second agent meets the first one during the time segment [t + y + 1, min{t + y + 2k0 , t  }], since min{t + y + 2k0 , t  } − (t + y) > k0 . If min{t + y + 2k0 , t  } − (t + y) ≥ 2k0 , we use Fact 4.1 point 2, otherwise we use Fact 4.1 point 3. • If (t  − t + 1)/2 + 4k0 ≤ y ≤ t  − (t  − t + 1)/4 then t + y + (y − x)/2 + 2L 1 ≥ t  −(t  − t + 1)/4+2k0 and consequently, by Fact 4.1 point 2, during the time segment [t  − (t  − t + 1)/4 + 1, t  − (t  − t + 1)/4 + 2k0 ] the second agent meets the first one (which is passive in this time segment). • If y < (t  − t + 1)/2 + 4k0 then t + y − (y − x)/2 ≤ t  − (t  − t + 1)/2 − k0 , since (y − x)/2 ≥ 80k0 . By Fact 4.1 point 1, the first agent meets the second one in the time segment [t + y − (y − x)/2 + 1, t + y − (y − x)/2 + k0 ]. Therefore in all cases rendezvous is completed by step t  + 26lk2 (t  )k0 ≤ t + 12L 2 k2 (t) + 12L 2 + 26lk2 (t)k0 ≤ t + 14lk2 (t) + 26lk2 (t)k0 . LEMMA 4.8. 1. Let t be the beginning of epoch k1 (t) of the first agent and assume that L 1 k1 (t) ≥ 40k0 and k2 (t) ≥ 10k0 . If the second agent ends its consecutive epochs at least three times during epoch k1 (t) of the first agent, then rendezvous is completed by the end of epoch k2 (t) + 1 of the second agent, which is at most t + 9lk2 (t). 2. Let t be the beginning of epoch k2 (t) of the second agent and assume that L 1 k1 (t) ≥ 40k0 and k2 (t) ≥ 10k0 . If the first agent ends its consecutive epoch at least three times during epoch k2 (t) of the second agent, then rendezvous is completed by the end of epoch k1 (t) + 1 of the first agent, which is at most t + 4lk2 (t). PROOF. First consider time t being the beginning of epoch k1 (t) of the first agent. Let t  be the end of epoch k1 (t) of the first agent. Let x ≥ 0 be such that t + x is the end of epoch k2 (t) of the second agent. Notice that x < (t  − t + 1)/2.

88

A. Dessmark, P. Fraigniaud, D. R. Kowalski, and A. Pelc

• If x − 2L 2 k2 (t) ≥ 0 then, during the time segment [t + x − 2L 2 k2 (t) + 1, t + x − 2L 2 k2 (t) + k0 ], the second agent meets the first one, by Fact 4.1 point 1. • If x − 2L 2 k2 (t) < 0 then t + x + 2L 2 [k2 (t) + 1] ≤ t + (t  − t + 1)/2 − k0 . Otherwise we would have t  ≥ t + x + 4L 2 [k2 (t) + 1] + 4L 2 [k2 (t) + 2] > t + x + 2L 2 [k2 (t) + 1] + 4L 2 + x + 4L 2 [k2 (t) + 2] > t + 2(t  − t + 1)/2 − 2k0 + 2L 2 k2 (t) + 8L 2 > t (in view of L 2 k2 (t) ≥ 10k0 ), and this is a contradiction. Hence the second agent meets the first one during the time segment [t + x + 2L 2 (k2 (t) + 1) + 1, t + x + 2L 2 (k2 (t) + 1) + k0 ], by Fact 4.1 point 1. Therefore rendezvous is completed by step t + x + 2lk2 (t) + 2l + k0 ≤ t + 9lk2 (t). The proof of part 2 of the lemma is similar: just interchange indices 1 and 2 and phrases “the first agent” and “the second agent.” Rendezvous is completed by step t  < t + 4lk2 (t). THEOREM 4.2. Algorithm PA solves the rendezvous problem for any n-node graph G, for√ any labels L 1 > L 2 = l of agents and any delay τ between startup times, in cost O( lτ n 5 log n + ln 10 log2 n). PROOF. Let t1 be the first step for which L 1 k1 (t1 ) ≥ 40k0 . Let t2 ≥ t1 be the first step for which k2 (t2 ) ≥ 10k0 . Observe that ti is the beginning of epoch ki (ti ) of the ith agent. Consider the step t ∗ = t2 + (t2 − t1 ) + 8L 2 k2 (t2 ) = 2t2 + 8L 2 k2 (t2 ) − t1 . We have t ∗ > t2 ≥ t1 , hence k1 (t1 ) ≤ k1 (t ∗ ). Consider two cases. Case A: k1 (t1 ) = k1 (t ∗ ). We have the inclusion [t2 , t2 + 4L 2 k2 (t2 )] ⊆ [t1 , (t1 + t ∗ )/2]. Hence the epoch k2 (t2 ) of the second agent is included in the passive phase of epoch k1 (t1 ) of the first agent. We use Fact 4.1 point 1 to obtain that rendezvous is completed during epoch k2 (t2 ) of the second agent. Hence rendezvous cost is O(t2 + L 2 k2 (t2 )). By definition of t1 we get that t1 ∈ O(k02 ) = O(n 10 log2 n). If t2 > t1 then k2 (t1 ) < 10k0 , and consequently k2 (t2 ) = 10k0 . Hence t2 ∈ O(L 2 k02 ) ⊆ O(ln 10 log2 n). On the other hand, L 2 k2 (t2 ) ∈ O(ln 5 log n). If t2 = t1 then t2 ∈ O(n 10 log2 n). On the other hand we have 4L 2 (k2 (1) + 1) + · · · + 4L 2 (k2 (t2 ) − 1) ≤ t2 . √ √ Hence k2 (t2 ) − k2 (1) ∈ O( t2 /L 2 ). It follows that√L 2 k2 (t2 ) ∈ O(L 2 (k2 (1) + t2 /L 2 )). Since τ ∈ (L 2 (k2 (1))2 ), we get that k2 (1) ∈ O( τ/L 2 ), and hence rendezvous cost is   O(t2 + L 2 k2 (t2 )) ⊆ O(t2 + L 2 τ/L 2 + L 2 t2 /L 2 ) √ √ ⊆ O(n 10 log2 n + lτ + ln 5 log n). √ Consequently, in both situations, rendezvous cost is O(ln 10 log2 n + lτ ).

Deterministic Rendezvous in Graphs

89

√ Case B: k1 (t1 ) < k1 (t ∗ ). In this case we have that t2 ∈ O(k02l) and k2 (t2 ) ∈ O( τ/l + k0 ). Below we give the proof of this statement in all possible situations. • L 1 k1 (1) ≥ 40k0 and k2 (1) ≥ 10k0 . In this case t2 =√ t1 = 1. We also have τ ∈ (L 2 (k2 (1))2 ), and consequently k2 (t2 ) = k2 (1) ∈ O( τ/l). • L 1 k1 (1) ≥ 40k0 and k2 (1) < 10k0 . In this case t1 = 1 and t2 ∈ O(L 2 k02 ) = O(lk02 ). Also k2 (t2 ) ∈ O(k0 ). • L 1 k1 (1) < 40k0 and k2 (1) ≥ 10k0 . In this case L 1 (k1 (t1 ) − 1) < 40k0 , which implies that t1 ∈ O(L 1 (k1 (t1 ))2 ) ⊆ O(k02 /L 1 ). Also t2 = t1 , which gives t2 ∈ O(k02 ). On the√other hand, τ ∈ (L 2 (k2 (1))2 ), and consequently k2 (t2 ) ∈ k2 (1) + O(k0 ) ⊆ O( τ/l + k0 ). • L 1 k1 (1) < 40k0 and k2 (1) < 10k0 . In this case L 1 (k1 (t1 ) − 1) < 40k0 , which implies that t1 ∈ O(L 1 (k1 (t1 ))2 ) ⊆ O(k02 /L 1 ). Also t2 ∈ t1 + O(L 2 k02 ) = O(lk02 ). On the other hand, k2 (t2 ) ≤ k2 (t1 ) + 10k0 ∈ k2 (1) + O(k0 ) = O(k0 ). Let t be the first step after t2 in which an epoch of the first agent starts. Notice that, by the assumption k1 (t1 ) < k1 (t ∗ ), we have t ≤ t2 + t ∗ , and consequently t ∈ O(t2 + L 2 k2 (t2 )). Hence k2 (t) ∈ O(k2 (t2 )). Consider times t1 , t2 > t such that ti is the end of epoch ki (t), for i = 1, 2. Subcase B1: t1 ≤ t2 . Consider epoch k2 (t) of the second agent. By definition of step t, this epoch starts not earlier than t2 . Since t1 ≤ t2 , we have that the first agent ends its epoch at least once during epoch k2 (t) of the second agent. Applying point 2 of one of Lemmas 4.6–4.8, depending on the number of epoch changes of the first agent in epoch k2 (t2 ), we obtain that rendezvous cost is at most t + 18lk2 (t) + 26lk2 (t)k0 ∈ O(t2 + L 2 k2 (t2 )) + O(lk2 (t2 )) + O(lk2 (t2 )k0 )   ⊆ O(k02l + l( τ/l + k0 ) + l( τ/l + k0 )k0 ) √ = O( lτ n 5 log n + ln 10 log2 n). Subcase B2: t1 > t2 . Consider epoch k1 (t) of the first agent. It starts in step t ≥ t2 . Since t1 > t2 , we have that the second agent ends its epoch at least once during epoch k1 (t) of the first agent. Applying point 1 of one of Lemmas 4.6–4.8, depending on the number of epoch changes of the second agent in epoch k1 (t1 ), we obtain that rendezvous cost is at most t + 18lk2 (t) + 26lk2 (t)k0 ∈ O(t2 + L 2 k2 (t2 )) + O(lk2 (t2 )) + O(lk2 (t2 )k0 )   ⊆ O(lk02 + l( τ/l + k0 ) + l( τ/l + k0 )k0 ) √ ⊆ O( lτ n 5 log n + ln 10 log2 n), the same asymptotic bound as in Subcase B1. 4.2.2. A Rendezvous Algorithm Polynomial in n, τ and log l. In this section we design and analyze a modification of Algorithm PA which has cost polynomial in n, τ and log l, rather than polynomial in n, τ and l. The modified algorithm has two non-constructive ingredients: the function determining the covering walks, already used in Procedure

90

A. Dessmark, P. Fraigniaud, D. R. Kowalski, and A. Pelc

COVERWALK and another one, used in the new procedure TRAVERSE described below. (As before, the new combinatorial object (a family of functions) whose existence we prove using again the probabilistic method, can be found by each of the agents separately, using local exhaustive search.) Similarly as before, our algorithm remains deterministic. Assume that, for every label L and positive integer k, we have a function f L ,k : {1, . . . , klog L} × Z+ → Z+ ∪ {0} such that f L ,k (i, d) ≤ d for any positive integers i, d. We call such a function a port-function. The interpretation of f L ,k (i, d) is the port number used by an agent with label L in the ith step of graph traversal with parameter k, if the agent is currently at a node of degree d (the value 0 indicates that the agent remains at the current node). According to this intuition we define the procedure TRAVERSE. For a non-negative integer t and for a positive integer k, define T (k, t) as the set of all infinite sequences (t1 , . . . , tk , . . .) of non-negative integers such that t1 + · · · + tk = t and ti = 0 for every i > k. For a given label L, integers k > 0 and t ≥ 0, fix t¯ ∈ T (k, t) and define: Procedure TRAVERSE(L , k, t¯) For i = 1, 2, . . . , k do initialize counti := ti (ti is the ith value of t¯) For j = 1, 2, . . . , klog L do Set d to the degree of the current node (if d > k and countd not initialized then initialize countd := 0) Set countd := countd + 1 If f L ,k (countd , d) > 0 then Go using port f L ,k (countd , d) The intuition behind the parameter t¯ in the above procedure is the following. For every d, we suppose that, before starting procedure TRAVERSE, td first port choices in nodes of degree d, yielded by the function f L ,k , were already executed. Hence this introduces a shift of procedure TRAVERSE by t steps back, assuming that td nodes of degree d were already visited. In the algorithm we only use TRAVERSE for parameter 0¯ (hence no shift at all) but in the analysis we consider executions of TRAVERSE shifted in time with respect to each other, and hence this more general formulation of the procedure will become useful. The following algorithm uses procedure TRAVERSE, which in turn depends on a family of port-functions. We use the algorithm for such a family of functions with a specially defined property. Algorithm MPA (Modified PassiveActive) for agent with label L. For k = 1, 2, . . . do Passive Phase: Wait for 2 · 2log Lk steps Active Phase: First Stage: Perform COVERWALK(log Lk), starting from the current node in the graph ¯ Middle Stage: Perform TRAVERSE(L , k, 0) Last Stage: Perform 2log L times COVERWALK(k), always starting from the current node in the graph As before, the turn of the “for” loop for a given k is called the kth epoch of the agent. Let G be an n-node graph, let v1 , v2 be two nodes in G, let t be a non-negative

Deterministic Rendezvous in Graphs

91

integer, and let ind ∈ {1, 2}, t¯ ∈ T (k1 , t), if ind = 1 and t¯ ∈ T (k2 , t) otherwise. Execute(L 1 , k1 , L 2 , k2 , G, v1 , v2 , t¯, ind) denotes the execution of procedures ¯ if ind = 1 • TRAVERSE(L 1 , k1 , t¯) and TRAVERSE(L 2 , k2 , 0) ¯ • TRAVERSE(L 1 , k1 , 0) and TRAVERSE(L 2 , k2 , t¯) if ind = 2 by agents operating in graph G, where procedure TRAVERSE(L 1 , k1 , ·) starts in node v1 and procedure TRAVERSE(L 2 , k2 , ·) starts in node v2 . We assume that procedure Execute is performed until one of the agents completes its procedure TRAVERSE. Let α > 0 be the constant from Lemma 4.2 and let k0 = λ∗ (log n) be as in Section 4.2.1. We say that a family of port-functions { f L ,k : k ∈ Z+ , L = 2, 3, . . .} is a rendezvous family, if the following property is satisfied: RV. For all labels L 1 > L 2 such that log L 1  = log L 2 , all parameters k1 = k2 , for every n such that 10αn 5 log n ≤ k1 , every n-node graph G, for all starting nodes v1 , v2 , any sequence t¯ ∈ T (k1 , t), where t < 6k0 , any ind ∈ {1, 2}, agents with labels L 1 , L 2 meet during procedure Execute(L 1 , k1 , L 2 , k2 , G, v1 , v2 , t¯, ind). Our goal is to show the existence of a rendezvous family. The proof uses the probabilistic method and requires the analysis of simultaneous random walks of two agents in a graph. LEMMA 4.9. Let L be a positive integer. For a given n-node graph G, consider two simultaneous random walks of length 10αn 5 log n log L, started in any nodes v1 , v2 of 2 graph G. The agents meet in some node with probability at least 1 − 2−10n log n log L . PROOF. Consider random binary variables X 1 , . . . , X m , where m = 10n 2 log n log L and, for every i = 1, . . . , m, X i is equal to 1 if agents meet during the time segment [αn 3 (i − 1) + 1, αn 3 i] and have not met by step αn 3 (i − 1). The probability that 2 X 1 = · · · = X m = 0 is at most (1/2)−10n log n log L . The argument relies on Lemma 4.2 (for event E 2 ) and is similar as in the proof of Lemma 4.3. LEMMA 4.10. 2, 3, . . .}.

There exists a rendezvous family of port-functions { f L ,k : k ∈ Z+ , L =

PROOF. Let α ≥ 1 be chosen according to Lemma 4.9. We prove the lemma for every k separately. Fix k. We can independently prove property RV for every two labels L 1 , L 2 such that L/2 < L 2 < L 1 ≤ L, where L is such that log L is a positive integer. Fix such an integer L. For every positive integer L  , where L/2 < L  ≤ L, every i = 1, . . . , k log L and every positive integer d, let f L  ,k (i, d) be the (independent) random values such that Pr[ f L  ,k (i, d) = 0] = 12 and Pr[ f L  ,k (i, d) = b] = 1/2d for every b = 1, . . . , d. We prove that property RV holds with high probability. Consider labels L 1 , L 2 such that L/2 < L 2 < L 1 ≤ L. We can choose such labels in at most L 2 ways. Let G be any 2 2 n-node graph, where 10αn 5 log n ≤ k. There are at most (n 2 )n = 22n log n such graphs. There are at most n 2 choices of starting nodes v1 , v2 , and at most 6k0 = 12n 2 choices of t to have t < 6k0 . Consider any sequence t¯ ∈ T (n − 1, t) (we can restrict attention to such sequences because the graph has n nodes). There are at most 2n log n such sequences.

92

A. Dessmark, P. Fraigniaud, D. R. Kowalski, and A. Pelc

There are two possible choices of ind. Fix L 1 , L 2 , graph G, v1 , v2 , t and t¯ ∈ T (n − 1, t). 2 2 We can do it in at most L 2 · 22n log n · 12n 4 · 2n log n ≤ 26n log n log L different ways, for any positive integer n > 1 (for n = 1 rendezvous is trivial). We prove that, with high probability, agents performing random walks meet during procedure Execute(L 1 , k1 , L 2 , k2 , G, v1 , v2 , t¯, ind), assuming the conditions in property RV. We can consider only ind = 1, since for ind = 2 the proof is similar (by inequalities log L 1  = log L 2  and k = k1 = k2 ). In Execute(L 1 , k1 , L 2 , k2 , G, v1 , v2 , t¯, 1) the first agent executes procedure TRAVERSE(L 1 , k1 , t¯) while the second agent executes ¯ procedure TRAVERSE(L 2 , k2 , 0). By Lemma 4.9 and the independence of random variables f L  ,k (i, d) for different ¯ are parameters L  , k, i, d we get that TRAVERSE(L 1 , k1 , t¯) and TRAVERSE(L 2 , k2 , 0) 5 two random walks on graph G, hence they meet in time 10αn log n log L with probability 2 at least 1 − 2−10n log n log L . Consequently, the probability that any two agents with labels L 1 , L 2 , where L/2 < L 2 < L 1 ≤ L, meet in time 10αn 5 log n log L is at least 1 − 2−10n

2

log n log L

· 26n

2

log n log L

≥ 1 − 2−n

2

log n log L

.

In view of Lemma 4.10 we can use a rendezvous family of port-functions as a basis for Algorithm MPA. The rest of our analysis assumes that MPA uses such a fixed family (which agents can compute locally), and hence we assume that property RV is satisfied. Notice that, in the proof of Lemma 4.10, we used the probabilistic method for fixed k, L and n. The function f L  ,k of an agent with label L  , such that L/2 < L  ≤ L, has the domain bounded by nk log L and the range bounded by n. The agent may have to compute all such functions f L  ,k , for L/2 < L  ≤ L. This can be done locally in time exponential in nk log L log n. Recall that local computations do not affect rendezvous cost in our model. Our next lemma corresponds to Lemma 4.5 in the analysis of Algorithm PA. LEMMA 4.11. Let t1 , t2 be steps ending epochs k1 (t1 ), k2 (t2 ) of the first and second agent, respectively. Assume that log L 1  = log L 2 , |log L 1 k1 (t1 ) − log L 2 k2 (t2 )| < 2k0 , k1 (t1 ), k2 (t2 ) ≥ 10αn 5 log n and |t1 − t2 | < 6k0 . Then rendezvous is completed by step t2 . PROOF. Conditions log L 1  = log L 2  and k1 (t1 ), k2 (t2 ) ≥ 10αn 5 log n and |log L 1 k1 (t1 ) − log L 2 k2 (t2 )| < 2k0 imply k = k1 (t1 ) = k2 (t2 ). Since |t1 − t2 | < 6k0 and log L 1 k1 (t1 ) = log L 2 k2 (t2 ), we have that the middle stages of active phases in epochs k1 (t1 ), k2 (t2 ) (of the first and the second agent, respectively) start in steps which are at a distance less than 6k0 . It follows from property RV and Lemma 4.10 that agents meet by the end of the middle stage of the agent which first finishes its middle stage. This middle stage ends before step min{t1 , t2 } − 2k2 (t2 )log L 2  ≤ t2 , since 2k2 (t2 ) ≥ 20αn 5 log n = 10k0 . THEOREM 4.3. Algorithm MPA solves the rendezvous problem for any n-node graph G, for any√labels L 1 > L 2 = l of agents and for any delay τ between startup times, in cost O(n 5 τ log l log n + n 10 log2 n log l).

Deterministic Rendezvous in Graphs

93

PROOF. For n = 1 the theorem is trivial. Assume n > 1. log L 2 , the analysis used for AlNotice that for L 1 > L 2 such that log L 1  > √ gorithm PA works and gives rendezvous time O(n 5 τ log l log n + n 10 log2 n log l) for MPA. Indeed, the differences between Algorithm PA and Algorithm MPA are the following: • Instead of L in PA we use 2log L in MPA. • Middle stages are different—in PA steps corresponding to the first and middle stages of MPA are executions of COVERWALK(Lk), while in MPA the first stage is an execution of COVERWALK(log Lk) and the middle stage is an execution of procedure TRAVERSE. Observe that by the assumption log L 1  > log L 2  the inequality L 1 > L 2 used in the analysis of PA corresponds to 2log L 1  > 2log L 2  in the case of MPA (L 1 > L 2 was the only relation between L 1 , L 2 that we used in the analysis of PA). On the other hand, during the analysis of Algorithm PA, we did not assume anything about the period corresponding to the middle stage of MPA—since we always used Fact 4.1 to argue about the period of meeting, and in Fact 4.1 the only considered periods correspond to the first and last stages of MPA (by the assumption L 1 k1 , k2 ≥ 10k0 ). Hence, in the case log L 1  > log L 2 , no changes in Algorithm MPA with respect to Algorithm PA influence the analysis performed for Algorithm PA. Hence we may assume that log L 1  = log L 2 . The idea of the proof under this assumption is similar to that in the proof of Theorem 4.2. Let t ∗ be the first step for which k1 (t ∗ ) = 10αn 5 log n or k2 (t ∗ ) = 10αn 5 log n. Since log L 1  = log L 2 , we can assume without loss of generality that k1 (t ∗ ) = 10αn 5 log n. This means that the first agent starts first, so we count steps from the startup of the second agent. Notice that, since the first agent starts first, we also have k2 (t ∗ ) ≤ k1 (t ∗ ). Let t ∗∗ ≥ t ∗ be the first step for which k2 (t ∗∗ ) = 80αn 5 log n. There are two cases: Case 1: k1 (t ∗ ) ≥ 3k2 (t ∗ ) + 2. It follows that during epoch k1 (t ∗ ) of the first agent, the second agent changes its epoch at least three times. Using similar arguments as in the proof of Lemma 4.8, we get that the second agent meets the first one during the passive phase of the epoch k1 (t ∗ ) of the first agent. Thus the rendezvous cost in this case is at most 8(k1 (t ∗ ) + 1)2 log L 2  ∈ O(n 10 log2 n log l). Case 2: k1 (t ∗ ) < 3k2 (t ∗ ) + 2. In this case we have t ∗∗ ∈ (t ∗ ). Consider step t ≥ t ∗∗ being the first starting point of an epoch of the first agent after step t ∗∗ − 1. We have k1 (t) ≤ k1 (t ∗∗ ) ∈ (k1 (t ∗ )) ⊆ (n 5 log n), and t ∈ (t ∗ ), since t ∗∗ ∈ (t ∗ ). We have also k2 (t) ≥ 80αn 5 log n. Consider epoch k1 (t) of the first agent. Since k1 (t), k2 (t) ≥ 40k0 , we can adapt proofs of Lemmas 4.6–4.8 to obtain rendezvous by step O(t + (k2 (t ∗∗ ))2 log l) ⊆ O((t ∗∗ )2 log l) ⊆ O(n 10 log2 n log l). The following modification has to be made (it does not influence the reasoning, only the final asymptotic formula): instead of using Lemma 4.5 we use Lemma 4.11. Hence the final rendezvous cost is  O(n 5 τ log l log n + n 10 log2 n log l + n 10 log2 n log l)  ⊆ O(n 5 τ log l log n + n 10 log2 n log l).

94

A. Dessmark, P. Fraigniaud, D. R. Kowalski, and A. Pelc

4.3. A Lower Bound. In Section 3.2 we proved the lower bound (n + D log l) for the cost of rendezvous in a ring, with arbitrary startup. In this section we show that, in some graphs with (n 2 ) edges, the cost of rendezvous is (n 2 ), i.e., a large part of the graph has to be explored before agents can meet. THEOREM 4.4. For all positive integers n and any labels L 1 and L 2 , there exists an n-node graph G n such that rendezvous cost in G n , for agents with labels L 1 and L 2 (even with simultaneous startup) is (n 2 ). PROOF. For simplicity, we give the proof for n divisible by 4. It is easy to modify it in the general case. Consider a regular graph in which ports at each node are numbered in such a way that, for every edge, port numbers at both ends of it are equal. Hence we can define a color of an edge as the port number at its ends. This induces a proper edge coloring (colors of incident edges are different). In such a graph the route of an agent starting at a given node (before rendezvous) can be coded as an oblivious sequence of colors depending only on the label of the agent. Indeed, the agent starts in a given state which determines the color of an edge to take, or forcing it to stay in the next step. In both cases the next state depends only on the previous one, as the agent does not gain new information (when it moves, the entry port number and the degree of the next node are known in advance). Consider a complete graph on k nodes, where k is even and k ≥ 4. Consider any proper coloring of its edges with k − 1 colors. Consider the sequence of colors of length k 2 /12 describing the route of an agent with label L, assuming that port numbering is compatible with the given edge coloring and that rendezvous did not occur by step k 2 /12. Suppose that the agent starts at a given node v. For any node w, let c(w) denote the number of edges incident to w and traversed by the agent during its route of length k 2 /12. Call a node w light, if c(w) ≤ k/3. There are at least k/2 light nodes: otherwise, more than k/2 nodes would be incident to at least k/3 traversed edges, and the total number of traversed edges would exceed k 2 /12. Take two disjoint copies G  and G  of a complete graph on k nodes, with the above edge coloring. Place an agent with label L 1 in some node of G  , and an agent with label L 2 in some node of G  . Let a  be a light node in G  with respect to the route of an agent with label L 1 and let a  be a light node in G  with respect to the route of an agent with label L 2 . There are at least 2k/3 untraversed edges incident to a  in G  and at least 2k/3 untraversed edges incident to a  in G  . Hence there exist untraversed edges e incident to a  and e incident to a  of the same color. Let e = {a  , b } and e = {a  , b }. We can now construct the graph G n , for n = 2k. Its set of nodes is the union of sets of nodes of G  and G  . Its edges are defined as follows. Remove edges e and e and replace them by edges f  = {a  , b } and f  = {a  , b }, colored with the common color of e and e , keeping all other edges of G  and G  and their coloring intact. The resulting graph G n is a properly colored connected regular graph. Place agents as before and start them simultaneously. Since edges e and e were untraversed edges of the same color, the routes of agents in graph G n will be the same as in graphs G  and G  , respectively, for the first k 2 /12 steps. It follows that, for the first k 2 /12 ∈ (n 2 ) steps, agents visit disjoint sets of nodes and hence rendezvous is impossible.

Deterministic Rendezvous in Graphs

95

5. Conclusion. We considered the problem of deterministic rendezvous in connected graphs, assuming that every agent knows only its own label. For the class of trees we got an algorithm, working for arbitrary startup, which cannot be improved for some trees, even when startup is simultaneous. However, the situation is far from completely understood even for rings. While for simultaneous startup we established that optimal rendezvous cost is (D log l), our bounds on rendezvous cost in rings with arbitrary startup are not tight. For arbitrary connected graphs our main result was the design and analysis of a deterministic rendezvous algorithm polynomial in n, τ and log l. Our algorithm requires exhaustive local search by each agent to find an object whose existence is proved using the probabilistic method. While local computations (even possibly very extensive), do not affect cost in our model, it is interesting to know if there is a deterministic rendezvous algorithm with cost polynomial in n, τ , log l whose local computations also take polynomial time. Another open problem concerns the dependence of rendezvous cost on the parameter τ (the difference between startup times). We showed a lower bound (n 2 ) on rendezvous cost in some graphs. We also showed that cost (log l) is required even for the two-node graph. On the other hand, for agents starting at distance (n) in a ring, cost (n log l) is required, even for τ = 0. However, we do not know if any non-constant function of τ is a lower bound on rendezvous cost in some graphs. (Recall that the cost of our √ algorithm for arbitrary connected graphs contains a factor τ .) Hence the following problem remains open: Does there exist a deterministic rendezvous algorithm for arbitrary connected graphs with cost polynomial in n and l (or even in n and log l) but independent of τ ? We finally notice that the more general problem of gathering a finite number of agents in one node of a graph can be reduced to rendezvous, provided that, when two or more agents meet at a node, they learn their identities. Indeed, when several agents meet at a node, the whole group may start behaving like the agent with the lowest label in the group. Thus, from now on, the entire group moves together, and gathering all agents in one node is accomplished as a result of consecutive rendezvous of increasing groups of agents. References [1]

[2] [3] [4] [5] [6]

R. Aleliunas, R.M. Karp, R.J. Lipton, L. Lov´asz, 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), pp. 218–223. S. Alpern, The rendezvous search problem, SIAM Journal on Control and Optimization 33 (1995), 673–683. S. Alpern, Rendezvous search on labelled networks, Naval Research Logistics 49 (2002), 256–274. S. Alpern, V. Baston, and S. Essegaier, Rendezvous search on a graph, Journal of Applied Probability 36 (1999), 223–231. S. Alpern and S. Gal, Rendezvous search on the line with distinguishable players, SIAM Journal on Control and Optimization 33 (1995), 1270–1276. S. Alpern and S. Gal, The Theory of Search Games and Rendezvous, International Series in Operations Research and Management Science, Kluwer, Dordrecht, 2002.

96

A. Dessmark, P. Fraigniaud, D. R. Kowalski, and A. Pelc

[7] E. Anderson and S. Essegaier, Rendezvous search on the line with indistinguishable players, SIAM Journal on Control and Optimization 33 (1995), 1637–1642. [8] E. Anderson and S. Fekete, Asymmetric rendezvous on the plane, Proc. 14th Annual ACM Symposium on Computational Geometry, 1998, pp. 365–373. [9] E. Anderson and S. Fekete, Two-dimensional rendezvous search, Operations Research 49 (2001), 107–118. [10] E. Anderson and R. Weber, The rendezvous problem on discrete locations, Journal of Applied Probability 28 (1990), 839–851. [11] V. Baston and S. Gal, Rendezvous on the line when the players’ initial distance is given by an unknown probability distribution, SIAM Journal on Control and Optimization 36 (1998), 1880–1889. [12] V. Baston and S. Gal, Rendezvous search when marks are left at the starting points, Naval Research Logistics 48 (2001), 722–731. [13] S.A. Cook and P. McKenzie, Problems complete for deterministic logarithmic space, Journal of Algorithms 8(5) (1987), 385–394. [14] D. Coppersmith,, P. Doyle, P. Raghavan, and M. Snir, Random walks on weighted graphs, and applications to on-line algorithms, Proc. 22nd Annual ACM Symposium on Theory of Computing (STOC 1990), pp. 369–378. [15] D. Coppersmith, P. Tetali, and P. Winkler, Collisions among random walks on a graph, SIAM Journal on Discrete Mathematics 6 (1993), 363–374. [16] A. Dessmark, P. Fraigniaud, and A. Pelc, Deterministic rendezvous in graphs, Proc. 11th European Symposium on Algorithms (ESA 2003), LNCS 2832, Springer-Verlag, Berlin, pp. 184–195. [17] M. Dyer, A. Frieze, and R. Kannan, A random polynomial time algorithm for estimating volumes of convex bodies, Proc. 21st Annual ACM Symposium on Theory of Computing (STOC 1989), pp. 375–381. [18] P. Flocchini, G. Prencipe, N. Santoro, and P. Widmayer, Gathering of asynchronous oblivious robots with limited visibility, Proc. 18th Annual Symposium on Theoretical Aspects of Computer Science (STACS 2001), LNCS 2010, Springer-Verlag, Berlin, pp. 247–258. [19] S. Gal, Rendezvous search on the line, Operations Research 47 (1999), 974–976. [20] A. Israeli and M. Jalfon, Token management schemes and random walks yield self stabilizing mutual exclusion, Proc. 9th Annual ACM Symposium on Principles of Distributed Computing (PODC 1990), pp. 119–131. [21] D. Kowalski and A. Malinowski, How to meet in anonymous network, manuscript. [22] D. Kowalski and A. Pelc, Polynomial deterministic rendezvous in arbitrary graphs, Proc. 15th Annual Symposium on Algorithms and Computation (ISAAC 2004). [23] E. Kranakis, D. Krizanc, N. Santoro, and C. Sawchuk, Mobile agent rendezvous in a ring, Proc. 23rd International Conference on Distributed Computing Systems (ICDCS 2003), pp. 592–599. [24] W. Lim and S. Alpern, Minimax rendezvous on the line, SIAM Journal on Control and Optimization 34 (1996), 1650–1665. [25] T. Schelling, The Strategy of Conflict, Oxford University Press, Oxford, 1960. [26] L. Thomas, Finding your kids when they are lost, Journal of the Operational Research Society 43 (1992), 637–639. [27] X. Yu and M. Yung, Agent rendezvous: a dynamic symmetry-breaking problem, Proc. International Colloquium on Automata, Languages, and Programming (ICALP 1996), LNCS 1099, Springer-Verlag, Berlin, pp. 610-621.