Asynchronous Gathering in a Torus

We consider the gathering problem for asynchronous and oblivious robots that cannot communicate explicitly with each other, but are endowed with visibility sensors that allow them to see the positions of the other robots. Most of the investigations on the gathering problem on the discrete universe are done on ring shaped networks due to the number of symmetric configuration. We extend in this paper the study of the gathering problem on torus shaped networks assuming robots endowed with local weak multiplicity detection. That is, robots cannot make the difference between nodes occupied by only one robot from those occupied by more than one robots unless it is their current node. As a consequence, solutions based on creating a single multiplicity node as a landmark for the gathering cannot be used. We present in this paper a deterministic algorithm that solves the gathering problem starting from any rigid configuration on an asymmetric unoriented torus shaped network.


Introduction
We consider autonomous robots [21] that are endowed with visibility sensors and motion actuators, yet are unable to communicate explicitly.They evolve in a discrete environment, i.e., their space is partitioned into a finite number of locations, conveniently represented by a graph, where the nodes represent the possible locations that a robot can be, and the edges denote the possibility for a robot to move from one location to another.Those robots must collaborate to solve a collective task despite being limited to computing capabilities, inputs from the environment, etc.In particular, the robots we consider are anonymous, uniform, yet they can sense their environment and make decisions according to their own ego-centered view.In addition, they are oblivious, i.e., they do not remember their past actions.Robots operate in cycles that include three phases: Look, Compute, and Move (LCM for short).The Look phase takes a snapshot of the other robots' positions using a robot's visibility sensors.During the Compute phase, a robot computes a target destination 9:2 Asynchronous Gathering in a Torus based on its previous observation.The Move phase consists in moving toward the computed destination using motion actuators.Three execution models have been considered in the literature using LCM cycles, capturing the various degrees of synchrony between robots.According to current taxonomy [11], they are denoted as FSYNC, SSYNC, and ASYNC, from the stronger to the weaker.FSYNC stands for fully synchronous.In this model, all robots execute the LCM cycle synchronously and atomically.In the SSYNC (semi-synchronous) model, robots are asynchronously activated to perform cycles, yet at each activation, a robot executes one cycle atomically.With the weaker model, ASYNC (asynchronous), robots execute LCM in a completely independent manner.Of course, the ASYNC model is the most realistic.
In the context of robots evolving on graphs, the two benchmarking tasks are exploration [13] and gathering [4].In this paper, we address the gathering problem, which requires that robots eventually all meet at a single node, not known beforehand, and terminate upon completion.
We focus on the case where the network is an anonymous unoriented torus (or simply torus, for short).The terms anonymous and unoriented mean that no robot has access to any kind of external information (e.g., node identifiers, oracle, local edge labeling, etc.) allowing to identify nodes or to determine any (global or local) direction, such as North-South/East-West.Torus networks were investigated for the purpose of exploration by Devismes et al. [9].

Related Work
Mobile robot gathering on graphs was first considered for ring-shaped graphs.Klasing et al. [18], proposed gathering algorithms for rings with global-weak multiplicity detection.Global-weak multiplicity detection enables a robot to detect whether the number of robots on each node is one or more than one.However, the exact number of robots on a given node remains unknown if more than one robot is on the node.Then, Izumi et al. [14] provided a gathering algorithm for rings with local-weak multiplicity detection under the assumption that the initial configurations are non-symmetric and non-periodic, and that the number of robots is less than half the number of nodes.Local-weak multiplicity detection enables a robot to detect whether the number of robots on its current node is one or more than one.This condition was slightly relaxed by Kamei et al. [15].D'Angelo et al. [6] proposed unified ring gathering algorithms for most of the solvable initial configurations, using local-weak multiplicity detection.Overall, for rings, relatively few open cases remain [1], as algorithm synthesis was demonstrated feasible [19].
The case of gathering in tree-shaped networks was investigated by D'Angelo et al. [7] and by Di Stefano et al. [20].Hypercubes were the focus of Bose at el. [2].Complete and complete bipartite graphs were outlined by Cicerone et al. [5], and regular bipartite by Guilbault et al. [12].Finite grids were studied by D'Angelo et al. [7], Das et al. [8], and Castenow et al. [3], while infinite grids were considered by Di Stefano et al. [20], and by Durjoy et al. [10].Results on grids and infinite grids do not naturally extend to tori.On the one hand, the proof arguments for impossibility results on the grid can be extended for the torus, since their indistinguishability criterium remains valid.So, if a torus admits an edge symmetry (the robot positions are mirrored over an axial symmetry traversing an edge), is periodic (a non-trivial translation leaves the robot positions unchanged), or admits a rotation whose center is not a robot, the gathering is impossible on a torus.On the other hand, both the finite and the infinite grid allow algorithmic tricks to be implemented.For example, the finite grid has three classes of nodes: corners (of degree 2), borders (of degree 3), and inner nodes (of degree 4), and those three classes permit the robots to obtain some sense of direction.By contrast, the infinite grid makes a difference between two locations: the inner space (the set of nodes within the convex hull formed by the robot positions) and the outer space (the rest of the infinite grid), which also give some sense of direction.Now, every node in a torus has degree 4, and no notion of inner/outer space can be defined.To our knowledge, torus-shaped networks were never considered before for the gathering problem.The previous work by Devismes et al [9] only considers the exploration task.

Our Contribution
We consider the problem of gathering on torus-shaped networks.In more detail, for initial configurations that are rigid (i.e.where each robot has a unique view of the configuration), we propose a distributed algorithm that gathers all robots to a single node, not known beforehand.We only make use of local-weak multiplicity detection: robots may only know whether at least one other robot is currently hosted at their hosting node but cannot know the exact number and are also unable to retrieve multiplicity information from other nodes.Furthermore, robots have no common notion of North and no common notion of handedness.Finally, robots operate in the most general and realistic ASYNC execution model.
On the torus operate K ≥ 3 identical robots, i.e., they all execute the same algorithm using no local parameters, and one cannot distinguish them using their appearance.In addition, they are oblivious, i.e., they cannot remember the operations performed before.No direct communication is allowed between robots; however, we assume that each robot is endowed with visibility sensors that allow him to see the position of the other robots on the torus.Robots operate in cycles that comprise three phases: Look, Compute and Move.During the first phase (Look), each robot takes a snapshot to see the positions of the other robots on the torus.In the second phase (Compute), they decide to either stay idle or move.In the case they decide to move, a neighboring destination is computed.Finally, in the last phase (Move), they move to the computed destination (if any).
At each instant, a subset of robots is activated for the execution by an external entity called scheduler.We assume that the scheduler is fair, i.e., all robots are activated infinitely many times.The model considered in this paper is the asynchronous model (ASYNC), where the time between Look, Compute, and Move phases is finite but unbounded.We however assume that the move phase is instantaneous, so that when a robot performs a look operation, it sees all robots on nodes and none on edges.Still, even with instant moves, each robot may move according to an outdated view, i.e., the robot takes a snapshot to see the positions of the other robots, but when it decides to move, some other robots may have moved already.Let ℓ 0 , ℓ 1 , . . ., ℓ L−1 be the sequence of ℓ-rings and let v i,0 , v i,1 , . . ., v i,ℓ−1 be the sequence of nodes on ℓ i (all operations on the indices are modulo ℓ for the nodes and modulo L for the ℓ-rings).By #r i,j (t) we denote the number of robots on v i,j at time t.Node v i,j is empty if #r i,j (t) = 0. Otherwise, v i,j is occupied.In the case where #r i,j (t) = 1, we say that there is a single robot on v i,j .By contrast, if #r i,j (t) ≥ 2, we say that there is a multiplicity on v i,j .
In this paper, we assume that robots have a local weak multiplicity detection i.e., for any robot r, located at node u, r can only detect a multiplicity on its current node u (local).Moreover, r cannot be aware of the exact number of robots part of the multiplicity (weak).
During the process, some robots move and occupy some nodes of the torus, and their positions form the configuration of the system at that time.Initially, we assume that each node hosts at most one robot, i.e., the initial configuration contains no multiplicities.
For each robot r, only a degraded vision of occupied locations is available.So, the local vision d i,j (t) of r about node v i,j at time t is 1 if #r i,j (t) > 0 and 0 otherwise.
By view r (t)(1), we refer to V i,j (t) in view r (t).Given two robots r and r ′ , we say that r has a larger view than r ′ at time t, denoted view r (t)(1) > view r ′ (t)(1), if view r (t) is lexicographically larger than view r ′ (t).Similarly, r is said to have the largest view at time t, if for any robots r ′ ̸ = r, not located on the same node as r, view r (t)(1) > view r ′ (t)(1) holds.
A configuration is said to be rigid at time t, if for any two robots r and r ′ , located on two different nodes of the torus, view r (t)(1) ̸ = view r ′ (t)(1) holds.
A configuration is said to be periodic at time t if there exist two integers i and j such that i ̸ = j, i ̸ = 0 mod ℓ, j ̸ = 0 mod L, and for every robot r (x,w) located on ℓ x at node v x,w , view r (x,w) (t)(1) = view r (x+i,w+j) (t)(1) (An example is given in Figure 1).
As defined by D'Angelo et al. [7], a configuration is said to be symmetric at time t, if the configuration is invariant after a reflection with respect to either a vertical or a horizontal axis.This axis is called the axis of symmetry (An example is given in Figure 1).
In this paper, we consider asymmetric (ℓ, L)-torus, i.e., ℓ ̸ = L.We assume w.l.o.g. that L < ℓ.In this case, we can differentiate two sides of the torus.We denote by nb ℓi (C) the number of occupied nodes on ℓ-ring ℓ i , in configuration C.An ℓ-ring ℓ i is said to be maximal in Given a configuration C and two ℓ-rings ℓ i and ℓ j .We say that ℓ j is adjacent to ℓ i if |i − j| = 1 mod L holds.Similarly, we say that ℓ j is neighbor of ℓ i in configuration C if nb ℓj (C) > 0 and nb ℓ k (C) = 0 for any k ∈ {i + 1, i + 2, . . ., j − 1} or k ∈ {i − 1, i − 2, . . ., j + 1}.We also define dis(x i , x j ) to be a function which returns the shortest distance, in terms of hops, between x i and x j where x i and x j are two nodes of the torus.We sometimes write x i = r i where r i is a robot.In this case, x i refers to the node that hosts r i .Finally, we use the notion of d.block to refer to a sequence of consecutive nodes in which there are occupied nodes each d hops (distance) with no other robot in between.The size of a d.block is the number of its occupied nodes.
Due to the lack of space, some details and proofs are omitted but can be found in [17].

Impossibility Results
This section presents impossibility results that motivate our settings.Given a graph G = (V, E) and a function m : V → N associating the number of robots on a vertex v of V to v, (G, m) is a configuration whenever v∈V m(v) is bounded and greater than zero.Let ϕ be a permutation of G's vertices that preserves its adjacency relation, so if Note that ϕ always exists as the identity permutation fits this definition.Similarly, given a configuration (G, m), let ψ be a permutation of G's vertices that preserves its adjacency relation and such that for every node v of V , m(v) = m(ψ(v)).Again, ψ always exists as the identity permutation fits this definition.Given such a permutation ψ, the cycle C ψ of order p that is generated by That is, ψ is not reduced to the identity, and all nodes have the same orbit size.We now recall the Theorem of Di Stefano and Navarra for general topologies: We specialize the general theorem to our setting:

▶ Corollary 1. If a torus configuration is invariant by a non-empty series of non-null translations, a reflection through an edge-axis, or a non-empty series of non-null rotations whose center does not hold a robot; it is not gatherable.
Next, we show that two robots cannot gather on a torus, even in FSYNC.

▶ Theorem 2. Starting from a configuration with two robots a and b on different vertices in a torus with at least two vertices, gathering cannot occur, even in FSYNC.
Finally, we show by induction that without multiplicity detection, the gathering is impossible.
▶ Theorem 3. Starting from any configuration with K ≥ 2 robots with no multiplicity detection, gathering in a torus is impossible, even in SSYNC.

Algorithm
When robots have only local weak multiplicity detection, multiplicities should be carefully created as the gathering becomes impossible from a configuration in which there are only two occupied nodes that both host a multiplicity.In ASYNC model, we need to be extra careful when it comes to robots with outdated views as they might create unwanted multiplicities (recall that when a robot moves the configuration might have changed as one or several robots might have moved once or many times).

O P O D I S 2 0 2 1 9:6 Asynchronous Gathering in a Torus
Our strategy is to create a sense of direction on a torus to identify the gathering node and keep this node invariant, preventing the creation of unwanted multiplicities (if the configuration contains only two occupied nodes, one of these two nodes hosts for sure a single robot).For this purpose, robots proceed in two phases: first, they create the desired direction allowing them to identify a single node and then gather on the identified node.More precisely, let C target be the set of configurations such that C ∈ C target if the following properties are satisfied: C contains three ℓ-rings ℓ secondary , ℓ max and ℓ target such that: (1) ℓ max is the unique maximal ℓ-ring in C, (2) ℓ secondary and ℓ target are adjacent to ℓ max .(3) nb ℓ secondary (C) = 0, (4) ℓ target satisfies exactly one of the following conditions: nb ℓtarget (C) = 1.We refer to the occupied node on ℓ target by v target .nb ℓtarget (C) = 2 and ℓ target hosts a 2.block.We refer to the unique empty node in the 2.block by v target .nb ℓtarget (C) = 3 and ℓ target hosts a 1.block of size 3.By v target , we refer to the occupied node in the middle of the 1.block.From a configuration C ∈ C target , a direction can be identified: from v target to ℓ max .The idea is to make all robots neither on ℓ max nor on ℓ target move to join v target and then make the remaining robots gather on the node that is on ℓ max which is adjacent to v target .To summarize, the proposed algorithm consists of two phases: 1. Preparation Phase.This phase starts from an arbitrary rigid configuration C 0 in which each node hosts at most one robot.Its aim is to reach a configuration C ∈ C target .2. Gathering Phase.Starting from a configuration C ∈ C target , the gathering node is identified, and all robots eventually move to join it i.e., the gathering is achieved.Let us refer by C p1 (respectively C p2 ) to the set of configurations that appear during the Preparation (respectively the Gathering) phase.Let C be the current configuration, robots execute Protocol 1. Observe that

Execute Gathering phase else
Execute Preparation phase To ease the description of our strategy, we define predicates on a given configuration C: Unique(C): There exists a unique i ∈ {0, . . ., L − 1} such that and all the ℓ-rings, except for ℓ max and ℓ target , are empty.By contrast, Partial(C) indicates that C ∈ C target and there exists at least one ℓ-ring besides ℓ max and ℓ target that is occupied (hosts at least one occupied node).
In our algorithm, in several cases, robots in a single ℓ-ring, say ℓ i , need to move and align themselves with respect to the positions of other robots which are on another ℓ-ring, say ℓ k .To ease the description of the algorithm, we define a procedure referred to by Align(ℓ i , ℓ k ) which makes the robots to perform such alignment i.e., align robots on ℓ i with respect to robots positions on ℓ k .When the procedure is called in a configuration C, the following properties hold on both ℓ i and ℓ k : 1. nb ℓi (C) = j with j ∈ {2, . . ., 5}, i.e., there are at least two and at most five robots on ℓ i .

nb ℓi (C) > nb ℓ k (C) holds, and either (1) nb
occupied in the middle of the 1.block if nb ℓ k (C) = 3. Node u mark is used as a land mark to align robots on ℓ i (a detailed description can be found in [17]).To give a better idea on the purpose of procedure Align, some examples are given in Figure 3.The procedure makes sure that if a multiplicity is created on ℓ i then it is adjacent to u mark .This allows the robots to keep track on multiplicities' positions and also make sure that the occupied nodes at a border of a 1.block on ℓ i host only a single robot.
Figure 2 presents an overview of our strategy showing all the transitions among the different defined configurations in sections 4.1-4.2.

Preparation Phase
Let C ∈ C p1 .The purpose of this phase is to reach a configuration C ′ ∈ C target from C so that a direction is defined and the gathering node is identified.For this aim, robots first need to decrease the number of maximal ℓ-rings to reach a configuration C ′′ in which Unique(C ′′ ) is true.Then, from configuration C ′′ , robots need to create both ℓ target and ℓ secondary to reach a configuration C ′ ∈ C target .To prevent the creation of unwanted multiplicities due to robots with outdated views, most of the configurations in this phase are kept rigid.
First, let us address the case in which Unique(C) is false (C contains at least two maximal ℓ-rings).Robots need to decrease the number of maximal ℓ-rings to reach a configuration C ′ in which Unique(C ′ ) holds.Two cases are possible depending on whether there is an empty node on a maximal ℓ-ring: if a maximal ℓ-ring hosts at least one empty node then, the idea is to fill one of these empty nodes on a single maximal ℓ-rings.By contrast, if all the nodes of the maximal ℓ-rings are occupied, the idea is to create a single multiplicity on one of the maximal ℓ-rings to decrease their number gradually.Robots to move are chosen carefully in both cases, so that the configuration remains rigid.This is important to prevent having robots with outdated views.In the following, we refer to a maximal ℓ-ring by ℓ max .Robots behavior in a configuration C in which Unique(C) holds is as follows: 1.If nb ℓmax (C) = ℓ (all the nodes of ℓ max are occupied).Let R max (C) be the set of robots on a maximal ℓ-ring.As C is rigid, all robots in R max (C) have a unique view.Let ℓ m be the maximal ℓ-ring in C that hosts the robot with the maximal view in R max (C).One robot r is elected on ℓ m to move.Its destination is one of its adjacent occupied nodes on ℓ m .Robot r is selected as follows: Let R m (C) ⊂ R max (C) be the set of robots on ℓ m which by moving to one of their adjacent occupied node on ℓ m , the configuration reached remains rigid.Robot r is the robot in R m (C) which has the biggest view (|R m (C)| > 0).

If nb ℓmax (C)
< ℓ (There is at least one empty node on ℓ max ), the idea is to fill exactly one of the empty nodes on exactly one of the maximal ℓ-ring.Let R(C) be the set of robots closest to an empty node on a maximal ℓ-ring in C.Under some conditions, using the rigidity of C, one robot of R(C), say r, is elected to move (the one with the largest view).Its destination is its adjacent empty node toward the closest empty node on a maximal ℓ-ring, say u, taking the shortest path.Among robots in the set R(C), the one to move is the one that does not create a symmetric configuration.If no such robot exists in R(C), some extra steps are taken beforehand to ensure that the configuration remains rigid.We discuss the various cases: If C contains exactly two occupied ℓ-rings then, C contains only two maximal ℓ-rings.
Robot r (the one to move) is the robot with the maximal view in C. Its destination is its adjacent empty node on an empty ℓ-ring (Note that this ℓ-ring exists since L > 4).
If C contains more than two occupied ℓ-rings then: let r be the robot in R(C) with the largest view.By u and target-ℓ we refer to the closest empty node on a maximal ℓ-ring to r and the ℓ-ring including u.If by moving, r does not create a symmetric configuration, then r simply moves to its adjacent node toward u taking the shortest path.By contrast, if r creates a symmetric configuration by moving, then let C ′ be the configuration reached once r moves.Using configuration C ′ that each robot can compute without r moving, another robot r ′ in C is selected to move.We show later on that a symmetric configuration can only be reached when r either joins an empty node on the same L-ring as u for the first time or when it joins u.For the other cases, the configuration remains rigid.Hence, we only address the following two cases: a. Robot r joins an empty node on the same L-ring as u for the first time in C ′ .In this case, in C, the robot that is on target-ℓ being on the same L-ring as r moves to u (refer to Figure 4).b.Robot r joins u in C ′ .If in C ′ there are only two occupied ℓ-rings.The robot with the largest view which does not create a symmetric configuration is elected to move.Its destination is its adjacent empty node on an empty ℓ-ring.By contrast, if there are more than two occupied ℓ-rings in C ′ then robots proceed as follows: If the axis of symmetry lies on the unique ℓ max in C ′ then, we are sure that there are two ℓ-rings which are maximal in C and that are symmetric with respect to the unique maximal ℓ-ring in C ′ .Let r be the robot located on a maximal ℓ-ring which is not on the axis of symmetry in C ′ , that has the smallest view.Robot r is the one to move; its destination is its adjacent empty node on its ℓ-ring.
If the axis of symmetry is perpendicular to the unique maximal ℓ-ring in C ′ then let T be the set of occupied ℓ-rings in C without target-ℓ.If there is an ℓ-ring in T which does not contain two 1.blocks separated by a single empty node on each side, then using the rigidity of C, a single robot on such an ℓ-ring which is the closest to the biggest 1.block is elected to move.Its destination is the closest 1.block.If there no such ℓ-ring in T (all ℓ-rings contains two 1.blocks separated by a unique empty node), then using the rigidity of C, one robot being on an ℓ-ring of T who has an empty node as a neighbor on its ℓ-ring is elected to move.Its destination is its adjacent empty node on its current ℓ-ring.
Note that we have only discussed the cases in which the reached configuration is either rigid or symmetric.This is because when r moves, it create neither a periodic nor an edge-edge symmetric configuration.This is mainly due to the fact that in C ′ , there is a unique maximal ℓ-ring and C is assumed to be rigid.
We address now the case in which Unique(C) holds i.e., C contains a unique maximal ℓ-ring, ℓ max .To reach a configuration C ′ ∈ C target , robots need to move to build both ℓ secondary and ℓ target i.e., one of the two adjacent ℓ-rings to ℓ max needs to become empty while the other one needs to host either a single occupied node, a 2.block of size 2 or a 1.block of size 3. Let ℓ i and ℓ k the two adjacent ℓ-rings to ℓ max .Assume w.l.o.g. that nb ℓi (C) ≤ nb ℓ k (C).To ease the description of this phase, we distinguish five main cases describing the possible states of ℓ i and ℓ k : (i) the case in which both ℓ i and ℓ k are empty (C ∈ C Empty ).The idea, in this case, is to elect a single robot to join either ℓ i or ℓ k .(ii) the case in which ℓ i is empty and ℓ k hosts more than one occupied node (C ∈ C Semi−Empty ).The idea is to make the robots on ℓ k gather in a single node.Note that in both cases (i) and (ii), a configuration C ′ ∈ C target is created.(iii) the case in which ℓ i hosts a single occupied node while ℓ k hosts at least two robots (C ∈ C Oriented ).The unique occupied node on ℓ i is used as a landmark to make robots on ℓ k move and create either a 2.block of size 2 or a 1.block of size 3 (C ∈ C Oriented−2 ).Once such a block is created (C ∈ C Oriented−1 ), it is easy to free ℓ i as the robots move to their adjacent node on ℓ max (since the configuration reached C ′ ∈ C target , the multiplicity created on ℓ max can be identified as it is adjacent to v target ).(iv) the case in which both ℓ i and ℓ k host a unique occupied node (C ∈ C Semi−Oriented ).The idea is to add a single robot to either ℓ i or ℓ k .Finally, (v) the case in which both ℓ i and ℓ k host more than one robot (C U ndef ined ).The idea is to make robots elect either ℓ i or ℓ k and then make the robots on the elected ring gather on a single node.Both cases (iv) and (v) aim at reaching a configuration in C Oriented .More formally: b.C Oriented−2 .Contains all the configuration in C oriented that are not in Figure 5 presents instances of configurations in which there is a unique maximal ℓ-ring.
The behavior of the robots in each set of configurations is as follows: 1. C ∈ C Empty .Let ℓ ni and ℓ n k be the two neighboring ℓ-rings of ℓ max (one neighboring ℓ-ring from each direction).In the case in which ℓ ni = ℓ n k = ℓ max (C contains a single occupied ℓ-ring) then, using the rigidity of C, one robot from C is selected to move to its adjacent empty node outside its ℓ-ring (the scheduler chooses the direction to take).Otherwise, let R m be the set of robots which are the closest to either then, the unique robot in R m , referred to by r, is the one allowed to move.Assume w.l.o.g. that r is the closest to ℓ i .The destination of r is its adjacent empty node outside its current ℓ-ring on the shortest empty path toward ℓ i .If r is the closest to both ℓ i and ℓ k then the scheduler chooses the direction to take (it moves either toward ℓ i or ℓ k ).In the case where |R m | > 1 (R m contains more than one robot) then, by using the rigidity of C, one robot r is selected.Its behavior is the same as r in the case where |R m | = 1.If nb max (C) > 4 then the unique robot on ℓ i moves to its adjacent node on ℓ max .Otherwise, let u be the node on ℓ max adjacent to a robot on ℓ i .

C ∈ C
If nb max (C) = 3 and the robots form a 1.block of size 3 whose middle robot is adjacent to u then the unique robot on ℓ i moves to its adjacent node on ℓ max .Otherwise, robots on ℓ max execute Align(ℓ max , ℓ i ).
If nb max (C) = 4 and u is empty, then the unique robot on ℓ i moves to u. Otherwise (u is occupied), then let r be the robot on u.
If r has an adjacent empty node on ℓ max then r moves to one of its adjacent nodes (the scheduler chooses the node to move to in case of symmetry).If r does not have an adjacent empty node on ℓ max , then let r ′ be the robot on ℓ max which is adjacent to r and which does not have a neighboring robot on ℓ max at distance ⌊ℓ/2⌋.Robot r ′ moves to its adjacent empty node on Otherwise, if nb ℓ k (C) > 3 then, nb ℓ k (C) − 2 robots gather on the node u k located on ℓ k and which is on the same L-ring as the unique occupied node on ℓ i .For this purpose, the robot on ℓ k which is the closest to u k with the largest view is the one allowed to move.Its destination is its adjacent node on ℓ k toward u k .4. C ∈ C Semi−Oriented .Let ℓ ni and ℓ n k be the two neighboring ℓ-rings of ℓ i and ℓ k respectively.First, if w.l.o.g.
then, C contains only 3 occupied ℓ-rings ℓ i , ℓ max and ℓ j .Using the rigidity of C, one robot from either ℓ ni or ℓ n k (not both) is selected to move.Its destination is its adjacent empty node outside its current ℓ-ring in the opposite direction of ℓ max .Next, if ℓ i ̸ = ℓ n k (ℓ k ̸ = ℓ ni ) then, using the rigidity of C, a unique robot is selected to move from either ℓ ni or ℓ n k (not both).Its destination is its adjacent empty node outside its current ℓ-ring toward ℓ i (respectively ℓ k ) if the robot was elected from ℓ ni (respectively ℓ n k ).If ℓ ni = ℓ n k , the scheduler chooses the direction to take. 5. C ∈ C U ndef ined .Depending on the number of robots on ℓ i and ℓ k , we consider two cases:: The idea is to make robots on ℓ i gather on ℓ i .We define a configuration, denoted Γ(C), built from C ignoring some ℓ-rings that will be used to identify a single node on ℓ i on which all robots on ℓ i will gather.If there are at least four occupied ℓ-rings in C then Γ(C) is the configuration built from C ignoring both ℓ i and ℓ k .By contrast, if there are only three occupied ℓ-rings then Γ(C) is the configuration built from C ignoring only ℓ i .The following cases are possible: i. Configuration Γ(C) is rigid.Using the rigidity of Γ(C), one node on ℓ i , say u, is elected as the gathering node.Robots on ℓ i move in turn to the elected node.ii.Configuration Γ(C) has exactly one axis of symmetry.The axis of symmetry of Γ(C) either intersects with ℓ i on a single node (edge-node symmetric), or on two nodes (node-node symmetric) or only on edges (edge-edge symmetric): -Γ(C) is node-edge symmetric: The node on ℓ i that is on the axis of symmetry of Γ(C) is the gathering node.Robots on ℓ i move in turn to join it.
-Γ(C) is node-node symmetric: Let u 1 and u 2 be the two nodes on ℓ i on which the axis of symmetry passes through.If both nodes are occupied, then using the rigidity of C, exactly one of the two nodes is elected.Assume w.l.o.g. that u 1 is elected.Robots on u 1 move to their adjacent node.If both u 1 and u 2 are empty then let R be the set of robots on ℓ i that are at the smallest distance from either u 1 or u 2 .If |R| = 1 (Let r ∈ R and assume w.l.o.g. that r is the closest to u 1 ) then, r moves on ℓ i toward u 1 taking the shortest path.By contrast, if |R| > 1 then using the rigidity of C, exactly one robot of R is elected to move.The elected robot moves on ℓ i toward the closest node among u 1 and u 2 taking the shortest path.
-Γ(C) is edge-edge symmetric: assume w.l.o.g. that Γ(C)'s axis of symmetry of passes through ℓ i on the two edges e 1 = (u 1 , u 2 ) and e 1 = (u 3 , u 4 ) with u 1 and u 3 being on the same side.Let U = {u j , j ∈ [1 − 4]}.We consider the following cases: For all u ∈ U , u is occupied.Using the rigidity of C, a single node u ∈ U is elected.Robots on u move to their adjacent node u ′ ∈ U (refer to Figure 6, (A)).Three nodes of U are occupied.Assume w.l.o.g. that u 1 ∈ U is the one empty.
If there are robots on ℓ i which are located on the same side as u 1 and u 3 with respect to Γ(C)'s axis of symmetry then, the robots among these which are the closest to u 3 move to their adjacent node on ℓ i toward u 3 taking the shortest path (refer to Figure 6, (B)).By contrast, if there are no robots on ℓ i which are on the same side of u 1 and u 3 then, robots on u 2 move to their adjacent node in the opposite direction of u 1 (refer to Figure 6, (C)).
Two nodes of U are occupied.First, assume w.l.o.g. that u 1 and u 2 are occupied (the case in which the two nodes are neighbors).If all robots on ℓ i are on the same side of the axis of symmetry (assume w.l.o.g. that they are at the same side as u 2 ).Robots on u 1 are the ones to move.Their destination is u 2 (refer to Figure 6, (D)).By contrast, if there are robots on both sides of Γ(C)'s axis of symmetry then, let U ′ be the set of occupied nodes on ℓ i which are the farthest from the occupied node of U which is on the side (of the axis of symmetry).If there are two such nodes (one at each side), as C is rigid, the scheduler elects exactly one of these two nodes.Let us refer to the elected node by u.Robots on u are the ones to move.Their destination is their adjacent node on ℓ i towards the occupied node of U being on their side (refer to Figure 6, (E)).By contrast, if there is only one node in U ′ then, robots on the other side of the axis of symmetry are the ones to move to start from the robots that are the closest to the occupied node of U being on their side.Their destination is their adjacent ℓ i toward the occupied node of U on their side (refer to Figure 6, (F)).Finally, if there are no robots on both sides of the axis of symmetry, then using the rigidity of C, one occupied node of U is elected.Robots on the elected node are the ones to move.Their destination is their adjacent occupied node in U .Next, assume w.l.o.g. that u 1 and u 3 are occupied (the case in which the two nodes of U are not neighbors but are at the same side of Γ(C)'s axis of symmetry).Robots on a node of U with the largest view are the ones to move.Their destination is their adjacent node in the opposite direction of a node of U (refer to Figure 6, (H)).Finally, assume w.l.o.g. that u 1 and u 4 are occupied (the case in which the two nodes of U are not neighbors and are in opposite sides of Γ(C) axis of symmetry).Robots on a node of U with the largest view are the ones to move.Their destination is their adjacent node on ℓ i , in the opposite direction of their adjacent node in U (refer to Figure 6, (G)).
There is only one node of U that is occupied.Assume w.l.o.g. that u 1 is occupied.If all robots on ℓ i are on the same side as u 1 with respect to Γ(C)'s axis of symmetry then, the closest robot to u 1 on ℓ i are the ones to move.Its destination is its adjacent node towards u 1 taking the shortest path.By contrast, if all robots on ℓ i are in the opposite side of the axis of symmetry of u 1 then robots on u 1 are the ones to move.Their destination is u 2 .Finally, if robots on ℓ i are on both sides of the axis of symmetry then the closest robot to u 1 being on the same side of Γ(C)'s axis of symmetry as u 1 are the ones to move.Their destination is their adjacent node on ℓ i towards u 1 taking the shortest path.All nodes of U are empty.Let d be the smallest distance between a node of u ∈ U and a robot on the same side of Γ(C)'s axis of symmetry as u.Let R be the set of robots at distance d from a node u ∈ U .If |R| = 1 then the robot in R moves towards the closest node u ∈ U .By contrast, if |R| > 1 then, using the rigidity of C, a unique robot in R is selected to move.Its destination is its adjacent node on ℓ i toward the closest node u ∈ U .iii.Configuration Γ(C) has more than one axis of symmetry.Using the rigidity of C, a single robot from Γ(C) is elected to move.Its destination is its adjacent empty node on its current ℓ-ring.This reduces the number of axis of symmetries to either 1 or 0. b. nb ℓi (C) = nb ℓ k (C).The strategy is similar to the one used in the case in which nb ℓi (C) ̸ = nb ℓ k (C).That is, by using the state of configuration Γ(C), robots on either ℓ i or ℓ k gather in a single node.The difference in this case is that the robots need to elect either ℓ i or ℓ k .The detailed description of this case can be found in [17].

Gathering Phase
This phase starts from a configuration C ∈ C target in which a direction is defined in C (from ℓ target to ℓ max ).The idea is to make all robots that are neither on ℓ target nor ℓ max move to join v target .Then, make some robots on ℓ max move to join v target while the other align themselves with respect to v target to finally gather all on the node of ℓ max adjacent to v target .
To ease the description of our algorithm, we define the following set of configurations: 1. Set C sp which includes the following four sub-sets: a. SubSet C sp−1 : C ∈ C sp−1 if there are exactly two occupied ℓ-rings in C denoted ℓ i and ℓ j respectively on which the following conditions hold: (1) ℓ i and ℓ j are adjacent.
(2) nb ℓj (C) < nb ℓi (C) (3) either : nb ℓi (C) = 4 and ℓ i contains two 1.blocks of size 2 being at distance 2 from each other.Let u be the unique node between the two 1.blocks on ℓ i .nb ℓi (C) = 3 or 5 and ℓ i contains a 1.block of size nb ℓi (C).Let u be the middle node of the 1.block of size nb ℓi (C).(4) Either nb ℓj (C) = 3 and ℓ j contains a 1.block of size 3 whose middle node is adjacent to u or nb ℓj (C) = 2 and ℓ j contains either a 2.block of size 2 whose middle node is adjacent to u or a 1.block of size 2 having one extremity adjacent to u (refer to Figure 7 for some examples).We now present the behavior of robots during the gathering phase.If the current configuration C ∈ C target , then we define ↑ as the direction from ℓ target to ℓ max taking the shortest path.Observe that ↑ can be computed by all robots and ↑ is unique (recall that ℓ max is unique, and ∀ C ∈ C target , nb ℓtarget (C) ̸ = nb ℓ secondary (C)).Using ↑, we define a total order on the ℓ-rings of the torus such that ℓ i ≤ ℓ j if ℓ i is not further from ℓ target than ℓ j with respect to ↑.Note that C p2 = C pr ∪ C ls ∪ C sp .Let C be the current configuration, robots behavior for each defined set is as follows: 1. C ∈ C pr .Let us refer by ℓ i to the ℓ-ring that is adjacent to ℓ target such that ℓ i ̸ = ℓ max .
Depending on the number of robots on ℓ i , two cases are possible: a. nb ℓi (C) > 0. Let R m be the set of robots on ℓ i that are the closest to v target , if i. there is an occupied node u i on ℓ i that is adjacent to v target , then robots on u i are the ones to move.Their destination is v target .ii. there is no robot on ℓ i that is adjacent to v target and nb ℓi (C) < ℓ − 1, then robots in R m are the ones to move.Their destination is their adjacent empty node on ℓ i on the empty path toward v target .iii. there is no robot on ℓ i adjacent to v target and nb ℓi (C) = ℓ − 1, then let R m ′ be the set of robots that share a hole with u i , where u i is the node on ℓ i that is adjacent to v target .Robots in R m ′ are allowed to move only if they are not part of a multiplicity location.Their destination is the node towards u i on the empty path.b. nb ℓi (C) = 0. Let ℓ k be the closest neighboring ℓ-ring to ℓ target with respect to ↑.Let R m be the set of robots on ℓ k that are closest to v target .Robots on R m are the ones to move, their destination is the node outside ℓ k and toward ℓ target with respect to ↑. 2. C ∈ C ls .Robots aims at reaching a configuration C ′ ∈ C sp .If nb ℓmax (C) ≤ 5, robots on ℓ max execute Align(ℓ max , ℓ target ).Otherwise, robots behave as follows: Let u 1 , u 2 , u 3 , u 4 and u 5 be a sequence of five consecutive nodes on ℓ max such that u 3 is adjacent to v target .If u 3 is occupied and has exactly one adjacent occupied node on ℓ max (assume w.l.o.g. that this node is u 2 ) then the robot on u 2 is the one to move.Its destination is u 3 .By contrast, if u 3 has either no adjacent occupied nodes on ℓ max , or two adjacent occupied nodes on ℓ max , then robots on u 3 move to v target .Finally, if u 3 is empty then let R be the set of robots that are closest to u 3 on ℓ max .If |R| = 2 then both robots move to their adjacent node on ℓ max toward u 3 .By contrast, if |R| = 1, then first assume that the distance between the robot in R and u 3 is d.If there is a robot r m on ℓ max that shares a hole with u 3 and at distance d + 1 from u 3 , then r m moves towards u 3 taking the shortest path.If no such robot exists, the robot in R moves toward u 3 taking the shortest path.3. C ∈ C sp .We distinguish: a. C ∈ C sp−1 .If C ∈ C target , then the robots on ℓ target that are at the extremities of the 1.block or the 2.block move to their adjacent occupied node on ℓ max .By contrast, if C ̸ ∈ C target , then the robot not on ℓ max that has two adjacent occupied nodes moves to its adjacent node on ℓ max .b. C ∈ C sp−2 .If there is a 1.block of size 3 on ℓ max then the robots that are in the middle of the 1.block of size 3 move to their adjacent occupied node that has one robot at distance 2. If ℓ max contains a 1.block of size 5 then the robots on ℓ max that are adjacent of the extremities of the 1.block move on ℓ max in the opposite direction of the extremities of the 1.block.Finally, if ℓ max contains two 1.blocks of size 2 then the robots that share a hole of size 1 move toward each other.c.C ∈ C sp−3 .Robots on v target move to their adjacent node on ℓ max (note that v target can be occupied by either a single robot or a multiplicity).d.C ∈ C sp−4 .If C contains a 1.block of size 3 then the robots at the extremities of the 1.block move to their adjacent occupied node.By contrast, if C contains a 1.block of size 2 then the robot that is not part of a multiplicity moves to its adjacent occupied node (it will be shown that one of the occupied nodes hosts only one robot).We now state our main positive result.▶ Theorem 4. Assuming an (ℓ, L)-torus in which L < ℓ and L > 4 and starting from an arbitrary rigid configuration, Protocol 1 solves the gathering problem for any K ≥ 3.

Concluding Remarks
We presented the first algorithm for gathering asynchronous oblivious mobile robots in a fully asynchronous model in a torus-shaped space graph.Our work raises several open questions: 1. What is the exact set of initial configurations that are gatherable?Our work considers initial rigid configurations only, and we know that periodic, edge-symmetric, and invariant through rotation (with no center robot) configurations make the problem impossible to solve.As in the case of the ring, special classes of non-rigid configuration may exist that are still gatherable.2. The case of a square torus is intriguing: the robots would loose the ability to distinguish between the big side and the small side of the torus, so additional constraints are likely to hold if gathering remains feasible.3. Following recent work by Kamei et al. [16] on the ring, it would be interesting to consider myopic (i.e.robot whose visibility radius is limited) yet luminous (i.e.robots that maintain a constant size state that can be communicated to other robots in the visibility range) robots in a torus.

Figure 1
Figure 1Instance of some defined configurations.

Figure 2 Figure 3
Figure 2 Transitions among all configurations.

Figure 4
Figure4 On the left, r is suppose to move but by moving, it creates a symmetric configuration C ′ shown in the middle.The robot on target-ℓ on the same L-ring as r moves to u.

Figure 5
Figure 5 Instance of configurations C when Unique(C) is true.
Semi−Empty .Assume w.l.o.g.nb ℓ k (C) > 1 and nb ℓi (C) = 0. We consider two cases: a. nb ℓ k (C) > 3 or nb ℓ k (C) = 2. Recall that C ̸ ∈ C target .Let ↑ be the direction defined from ℓ max to ℓ k taking the shortest path and let ℓ n be the ℓ-ring that is neighbor of ℓ i .Observe that ℓ n = ℓ k is possible (if only two ℓ-rings are occupied in C).Using the rigidity of configuration C, one robot from ℓ n is elected to move.Its destination is its adjacent node outside ℓ n and towards ℓ i with respect to the direction ↑. b. nb ℓ k (C) = 3.Again, recall that C ̸ ∈ C target .The aim is to make the three robots form a single 1.block.To this end, if the configuration contains a single d.block of size 3 with d > 1 then the robot in the middle of the d.block moves to its adjacent node on ℓ k (the scheduler chooses the direction to take).By contrast, if the configuration contains a single d.block of size 2 (d ≥ 1) then the robot not part of the d.block moves towards its adjacent empty node towards the d.block taking the shortest empty path.3. C ∈ C Oriented .Let r i be the single robot on ℓ i .a. C ∈ C Oriented−1 .

Figure 6
Figure 6 Case in which Γ(C) is edge-edge symmetric.
Lemma 1. From any initial rigid configuration C 0 ∈ C p1 , a configuration C ′ ∈ C target which does not contain any robot with an outdated view, is eventually reached.Moreover, the unique maximal ℓ-ring in C ′ hosts at most one multiplicity node.This node (if any) is adjacent to v target .