In this section it is shown that the time complexity of rendezvous in trees is O(d). It is first shown that the two agents can meet in time <12din the half-line [0,+∞), where they are allowed to moveonly in one direction towards the location0. Later it is shown how to adopt this algorithm to obtain a O(d) time rendezvous in trees.
3.2.1 One-Way Rendezvous in the Half-Line
Consider a half-lineL0 = [0,+∞)where the agentsα1 andα2 are labelled by their initial integer positionsp1 and p2 respectively. Assume also that this time the agents can move only in one direction towards the closed end (0) of L0.
The algorithm is executed in iterations formed of stages 1 and 2. The following in- variants are used. During each iterationi= 2,3, . . .the agents are partitioned according to their labels. Specifically, notationFh and Fc are re-used to to define invariants that will hold after each stage of this algorithm. Fh denotes the location of the agents after executing stage 1 of the algorithm (ahalf iteration),Fcdenotes the location of the agents
after executing stage 2 (afull iteration) of the algorithm:
1. Fih(k) ={(k+ 1)2i−2i−1−1, . . . ,(k+ 1)2i+ 2i−1−2}, for k >0, and
Fih(0) ={0, . . . ,2i+ 2i−1−2} on the conclusion of stage 1, 2. Fc
i(k) ={(k+ 1)2i−1, . . . ,(k+ 2)2i−2}, for k >0, and
Furthermore, it is assumed that the agents with labels inFih(k)andFih(k)are aligned at position k·2i on the conclusion of respective stages. For the completeness of the
argument observe that before the rendezvous algorithm is executed, F0c(k) contains the agent with label k located at position k≥0. Also on the conclusion of iteration 1 each
Fc
1(k) contains agents with label 2k+ 1and2k+ 2located at position2kon the line. Algorithm 2:One-way rendezvous
for all α∈Ado
label(α)⇐position ofα in the line end for
fori= 1,2,3, . . . do
stage 1: formFih(k) =Fic−1(2k)∪Fic−1(2k+ 1) by moving agents grouped in
Fic−1(2k+ 1)by 2i−1 positions towards0 stage 2:
if k >0then
form Fic(k) =Fic−1(2k+ 1)∪Fic−1(2k+ 2) else
form Fic(k) =Fih(k)∪Fic−1(2k+ 2)by moving agents grouped in Fic−1(2k+ 2) by 2i positions towards 0
end if end for
Proposition 3.3. Algorithm 2 has the enclosure property, i.e. for any three agentsα1,
α2 and α3 located initially at positions 0 ≤p1 < p2 < p3 when agents α1 and α3 meet,
they also meet α2.
Proof. The enclosure property is a straightforward consequence of the fact that groups of agents formed on the conclusion of stages 1 and 2 form partitions in which each group is a contiguous segment of positions in L0.
Using reasoning similar to the proof of Theorem 3.1 the following is obtained. Theorem 3.4. Two agentsα1, andα2 executing Algorithm 2 and initially located at dis-
tanced, on integer points in the half-lineL0= [0,+∞), require at most12dsynchronised rounds to rendezvous.
3.2.2 Rendezvous in trees
In this section it is assumed that the agents α1 andα2 are located at some two vertices
p1 and p2 in a finite tree T. The vertices in the tree are uniquely identified and the agents are aware of the entire structure of the tree, which is held in memory1. This allows the agents to select independently a unique vertex inT that becomes the root r
ofT. Assume thatd1 and d2 are respective distances fromp1 andp2 tor. Without loss 1
However, while not discussed specifically in this work as the focus is on time rather than memory, it would be feasible to reduce this memory requirement as in principle the agents only need to know the direction of the (path towards the) root vertex.
of generality, assume that d2 ≤ d1. Let x be the Lowest Common Ancestor (LCA) for
p1 and p2 in T with respect to the root r, where dx is the distance separating x from
r. For the purpose of rendezvous, the vertices in the tree adopt their distances tor as their labels. For example, the root r adopts the label 0 and vertex x adopts the label
dx. The new labelsd1 andd2 of the verticesp1 andp2 are also adopted by the agentsα1 and α2, respectively. In order to rendezvous, the agents execute Algorithm 2 designed for the half-line L0 = [0,+∞) moving gradually towards the rootr with the label 0.
Note that if x=p2, i.e. vertex p2 is located on the route fromp1 to r, the distance between p1 and p2 isd=d1−dx, and according to Theorem 3.4 the rendezvous process
will be completed in time12d. Otherwise, the initial distance betweenp1 andp2 inT is
d=d1+d2−2dx.
Let a vertexp02located on the path fromp1 tor, at distanced2 fromrbe the starting position of a hypothetical agentα02. Note that during the execution of Algorithm 2 agent
α02 acts the same way as α2, and in particular the distances between r and α2 as well as r and α02 are always the same. Assume also that vertex x is a starting position of another hypothetical agentαx.
Due to the enclosure property, see Corollary 3.3, during the execution of Algorithm 2 when the agentsαx and α1 meet they also meet α02. But since the moves ofα2 andα02 are identical and all of the agents move only towards the root r, when agentsαx andα1 meet, they also meet α2. Thus according to Theorem 3.4 agentsα1 and α2 rendezvous in time12(d1−dx)<12(d1+d2−2dx) = 12d. The following theorem follows.
Theorem 3.5. Two agents,α1 andα2 executing Algorithm 2 initially located at distance
don the vertices of a rooted tree T can rendezvous in ≤12dsynchronous rounds.