Time-Optimal Gathering under Limited Visibility with One-Axis Agreement †

: We consider the distributed setting of N autonomous mobile robots that operate in Look-Compute-Move (LCM) cycles following the well-celebrated classic oblivious robots model. We study the fundamental problem of gathering N autonomous robots on a plane, which requires all robots to meet at a single point (or to position within a small area) that is not known beforehand. We consider limited visibility under which robots are only able to see other robots up to a constant Euclidean distance and focus on the time complexity of gathering by robots under limited visibility. There exists an O ( D G ) time algorithm for this problem in the fully synchronous setting, assuming that the robots agree on one coordinate axis (say north), where D G is the diameter of the visibility graph of the initial conﬁguration. In this article, we provide the ﬁrst O ( D E ) time algorithm for this problem in the asynchronous setting under the same assumption of robots’ agreement with one coordinate axis, where D E is the Euclidean distance between farthest-pair of robots in the initial conﬁguration. The runtime of our algorithm is a signiﬁcant improvement since for any initial conﬁguration of N ≥ 1 robots, D E ≤ D G , and there exist initial conﬁgurations for which D G can be quadratic on D E , i.e., D G = Θ ( D 2 E ) . Moreover, our algorithm is asymptotically time-optimal since the trivial time lower bound for this problem is Ω ( D E ) . then in two epochs, they reach positions of L (cid:48) or south of L (cid:48) through the subsequent vertical or diagonal hop. We also show that, if some robots in the north of L (cid:48) do not move in the ﬁrst epoch, then they reach positions of L (cid:48) or south of L (cid:48) through the vertical or diagonal hop by the next two epochs.


Introduction
In the classic model of distributed computation by mobile robots, also known as the OBLOT model, each robot is modeled as a point in the plane [1,2]. The robots are autonomous (no external control), anonymous (no unique identifiers), indistinguishable (no external identifiers), disoriented (no agreement on local coordinate systems and units of distance measures), oblivious (no memory of past computation), and silent (no direct communication and actions are coordinated via only vision and mobility). They execute the same algorithm. Each robot proceeds in Look-Compute-Move (LCM) cycles: when a robot becomes active, it first obtains a snapshot of its surroundings (Look), then computes a destination based on the snapshot (Compute), and then finally moves towards the destination (Move) [2].
We consider the gathering problem in the OBLOT model, where starting from any arbitrary (yet connected) initial configuration, all robots are required to meet at a single point (or to position within a small area) that is not known beforehand. Relaxing the requirement to meet at a single point by positioning them within a small area is performed to circumvent the impossibility result of gathering to a point in the asynchronous setting, even for two robots [3]. In fact, the algorithm we designed in this article positions all robots either at a single point not known beforehand or within a unit line segment not known beforehand depending on different conditions. Gathering is one of the most fundamental tasks and a central benchmark problem in distributed mobile robotics [4]. Early studies on gathering in the OBLOT model solved it under unlimited visibility, where each robot is assumed to observe (the locations of) all other robots [5], and all the robots are connected to each other. The viewing range defines the maximum possible distance up to which a robot can observe other robots, and the connectivity range defines the maximum possible distance between any two nodes to be connected (i.e., to have an edge between them). Flocchini et al. [6] provided the first algorithm for gathering in the OBLOT model under limited visibility, where each robot can observe (the locations of) other robots within a fixed unit distance (viewing range), and each robot is connected to all other robots within that fixed unit distance (connectivity range), i.e., the viewing and connectivity ranges are the same. Subsequently, several algorithms were studied for this problem under different constraints [2,[7][8][9][10]. These studies proved the correctness of the algorithms but provided no runtime analysis (except a proof of finite time termination).
The runtime analysis for gathering has been studied relatively recently [11][12][13][14][15]. Degener et al. [11] provided the first algorithm for this problem with runtime O(N 2 ) in expectation in the fully synchronous setting, where N is the total number of robots. Degener et al. [12] provided an O(N 2 )-time algorithm for this problem in a fully synchronous setting. They also showed that, for some initial configurations, their algorithm is essentially tight by providing a matching lower bound of Ω(N 2 ). Kempkes et al. [13] provided an O(OPT log OPT)-time algorithm for this problem under a slightly different continuous time setting, where OPT is the runtime of an optimal algorithm. All the above algorithms assume that both the viewing and connectivity ranges are of (fixed) radius 1. Recently, Cord-Landwehr et al. [14] provided an O(N)-time algorithm for this problem for robots positioned on a grid in a fully synchronous setting. In this algorithm, it is assumed that robots have the viewing range of (distance) 20, i.e., each robot can observe other robots within a fixed distance of 20, but the connectivity range is one, i.e., two robots are connected if and only if they are vertical or horizontal neighbors on the grid. Moreover, each robot is assumed to possess memory for remembering a constant number of previous cycles. Recently, Fischer et al. [15] provided an O(N 2 )-time algorithm for gathering on a grid in the fully synchronous setting, if the memory is not available, by using the improved viewing range of 7. The intriguing open question is whether a time-optimal algorithm can be designed for gathering under limited visibility and if possible, under what conditions. We define time optimality as follows: Let G be the visibility graph of an arbitrary initial configuration I of N ≥ 1 robots in a plane. The robots in the system act as nodes of G. There is an edge between any two nodes in G if the distance between these two nodes is at most the connectivity range. Note that, according to the definitions above, the viewing and connectivity ranges may or may not be the same. If each robot is connected to all robots within its viewing range, then the viewing range also serves as the connectivity range; otherwise, the connectivity range is different than the viewing range. In order to solve the gathering problem, G must be connected [2]; G is connected if the robots (or nodes of G) cannot be separated into two subsets such that no robot of the one subset is connected to any robot of the other subset (and vice versa). For example, the authors in [14] used the viewing range 20, but the robots in horizontal or vertical distance of one are connected. Let D G be the diameter of G, which is the greatest distance between any pair of nodes in G following the edges of G. Let D E be the diameter of the initial configuration I, which is the greatest Euclidean distance between any pair of robots in I. Notice that for any I, D E ≤ D G , and for some configurations the gap between D G and D E can be as much as quadratic on D E , i.e., D G = Θ(D 2 E ). Figure 1 illustrates these ideas. Therefore, an O(D E )time algorithm would be time-optimal for gathering starting from any initial connected configuration, since Ω(D E ) is the trivial time lower bound for robots to meet at a single point (or to position within a small area) starting from any arbitrary initial configuration.
Hence, the open question specifically is whether an O(D E )-time algorithm can be designed for gathering for classic oblivious robots under limited visibility. Recently, Izumi et al. [4] made progress towards addressing this open question. Specifically, they presented an O(D G )-time algorithm for gathering on the plane in a fully synchronous setting under limited visibility with the condition that robots agree on one coordinate axis. They used viewing range of one with an assumption that the visibility graph G remains connected even if the edges with the corresponding distance of greater than 1 − 1 √ 2 are removed from it. The assumption on the visibility graph G in Izumi et al. [4] essentially means that the connectivity range is of radius 1 − 1 √ 2 (different and in fact smaller than the viewing range of one).
There is still a large gap between the O(D G ) time bound of Izumi et al. [4] and the asymptotically optimal O(D E ) time bound, since D G can be quadratic on D E (Figure 1). This work closes this gap under the same one axis agreement with a slightly modified viewing range of √ 10 and the square connectivity range (if we do not explicitly write "square", then the viewing and connectivity ranges are circular ) of √ 2 compared to the viewing range of one and the (circular) connectivity range of 1 − 1 , and our algorithm again achieves O(D E ) runtime). Notice that the square connectivity range of distance c means that a robot is connected to all other robots inside or on the boundary of the (axis-aligned) square area with the (diagonal) distance from the robot to each corner of the square c. Notice also that the square connectivity range of √ 2 for a robot is equivalent to the L ∞ -distance of 1 around the robot. Therefore, if we have both the viewing and connectivity ranges of c, then the area they enclose differs if the connectivity range is "square"; otherwise, they enclose the same area. Moreover, in contrast to Izumi et al. [4], which works in the fully synchronous setting, our algorithm works in the asynchronous setting. The algorithm presented by Izumi et al. [4] follows the movements of robots in one direction (either north or east) along D G in such a way that in each round, starting from the southmost and westmost robots, each robot moves towards the farthest neighbor within its connectivity range. In our algorithm, robots do not follow D G ; instead, they gather at a point (or within a small area) that is not known beforehand in O(D E ) rounds. Particularly, in our algorithm, all the robots gather at a single point not known beforehand under both axis agreements and inside a horizontal line segment of length one that is not known beforehand under one axis agreement. A preliminary version of this article has been published in SSS'17 conference [16], and this article extends that version by including many details and proofs that were missing in that version.
Contributions. We focus, in this article, on optimizing runtime for gathering under limited visibility. We consider autonomous, anonymous, indistinguishable, oblivious, and silent point robots (also called swarms) as in the classic OBLOT model [2]. Robots agree on the unit of distance measure. The viewing range is √ 10-a robot can see all other robots within the fixed radius of at most distance √ 10. The square connectivity range is √ 2-a robot is connected to all other robots inside or on the boundary of the (axis-aligned) 2 × 2-sized square area for which its center is the position of the robot. In a LCM cycle, a robot can move to any position inside or on the square area, including its four corners. The challenge here is that robot movements must not harm swarm connectivity. As in Izumi et al. [4], we assume that robots agree on one coordinate axis (say north), but they may not agree on the other coordinate axis. Moreover, we assume that the robot setting is asynchronous-there is no notion of common time, and robots perform their LCM cycles arbitrarily. Furthermore, we assume that the robot moves are rigid-a robot in motion in each cycle cannot be stopped (by an adversary) before it reaches its destination at that cycle. Additionally, all previous algorithms assume that when two or more robots move to the same location, they are merged and act as a single robot. In this article, we do not have that assumption; in other words, even if robots are located at the same position and activated at different time, the gathering progress is achieved through the (individual) moves of those robots.
In this article, we prove the following result which, to our best knowledge, is the first algorithm for gathering that is asymptotically time-optimal for classic oblivious robots under limited visibility since the trivial time lower bound for gathering under limited visibility starting from any initial configuration of N ≥ 1 robots is Ω(D E ). Theorem 1. For any initial connected configuration of N ≥ 1 robots with the viewing range of √ 10 and the square connectivity range of √ 2 on a plane, gathering can be solved in O(D E ) time in the asynchronous setting, when robots agree on one coordinate axis.
Notice that, the visibility graph G must be connected, since gathering may not be solvable under limited visibility if G is not connected [2,6]. Our selection of the viewing and (square) connectivity ranges and the assumption of one-axis agreement play an important role in proving Theorem 1. For both viewing and (circular or square) connectivity ranges of one, we conjecture that there is no O(D E )-time algorithm for gathering of classic oblivious robots in the asynchronous setting, even when robots agree on both coordinate axes. This is because a robot cannot move more than distance one in each LCM cycle to preserve connectivity, and only the end robots can move in each cycle. Therefore, if the robots are connected as shown in Figure 1, O(D G ) time is required to gather them since only end robots can move and the rest cannot. For the viewing and (circular or square) connectivity ranges of constant > 1, we conjecture that there is no O(D E )-time algorithm for gathering of classic oblivious robots if the robots do not agree on any coordinate axis. This is because the robots' movements become arbitrary as there is no agreement on the coordinate axes. Thus, robots can only gather if they move following the diameter D G , which only provides an O(D G )-time algorithm.
Technique. Let L be the topmost horizontal line so that all the robots of any initial configuration I are either on the positions of line L or south from L. Let L be the line parallel to L at distance one south of L. The main idea behind the algorithm is to make robots of I in the north of L move to the positions of L or south of L in O(1) epochs, even under the asynchronous setting, where an epoch is the time interval for all N robots to execute their LCM cycle at least once (the formal definition of epoch is in Section 2). To accomplish this, we classify the moves of robots into three categories: diagonal hops, horizontal hops, and vertical hops. We will show that if all the robots in the north of L make diagonal or vertical hops, they reach L or south of L in one epoch. However, if some of those robots make a horizontal hop, then in two epochs, they reach positions of L or south of L through the subsequent vertical or diagonal hop. We also show that, if some robots in the north of L do not move in the first epoch, then they reach positions of L or south of L through the vertical or diagonal hop by the next two epochs.
Similarly, let L b be the bottommost horizontal line (parallel to L) so that the robots of I are either on L b or north of L b . The main idea is to show that the robots on L b do not move south of L b forever. Specifically, we show that robots on L b wait for all the robots in the north of L b so that they meet at distance (at most) D south of L b where D is proportional to the horizontal diameter of the initial configuration I. This is achieved by asking robots not to make any diagonal, horizontal, or vertical hops if they see at least a robot in the north at vertical distance 1 (or more) from their positions (i.e., on or outside the connectivity range of the corresponding robot).
Other Related Work. The classic oblivious robots model or the OBLOT model has been considered heavily in order to solve a diverse set of problems, such as scattering, gathering, convergence, circle formation, flocking, etc., in distributed mobile robotics. A comprehensive description of the state-of-the-art research on distributed computing by mobile robots can be found in these excellent books [2,17]. Much work on the classic model on these problems does not provide runtime analysis, for example, see papers on gathering in a non-predefined point [5][6][7]18,19]. Pagli et al. [20] considered gathering classic robots to a small area by avoiding collisions between robots. However, they also do not provide runtime analysis. Kirkpatrick et al. [19] studied gathering as a point convergence problem where starting from an arbitrary initial configuration, robots move in such a manner that they reach inside a circle of radius that is at most , > 0. They proposed an algorithm to solve the problem in the k-asynchronous model (i.e., the degree of asynchrony is bounded to k); however, they showed that point convergence is unsolvable in the fully asynchronous model. In this article, we present an algorithm with runtime analysis to solve the gathering problem in the fully asynchronous model by assuming robots agree on one coordinate axis. Bhagat et al. [21] studied the limited visibility model for robots and presented different geometric pattern formation problems under limited visibility.
Gathering on a predefined point has been studied in several papers [22][23][24]. These papers studied gathering in the context of robots with an extent (i.e., fat robots). Applying these algorithms to the classic model solves gathering in O(D) time (provided that gathering point is known to robots), where D is the largest distance from any robot to the predefined gathering point. However, the runtime bound is provided only for the grid, and the gathering point is known to robots a priori. Recently, Braun et al. [25] studied the gathering problem in a three-dimensional Euclidean space under limited visibility and presented O(n 2 )-time and O(D E · n 3 2 )-time algorithms in the fully synchronous and continuous time models, respectively.
The question of gathering on graphs instead of gathering in the plane was studied in [26][27][28]. Di Stefano and Navarra [27] assumed unlimited visibility and an asynchronous setting and proved the optimal bounds on the number of robot movements for special graph topologies such as trees and rings. D'Angelo et al. [28] showed that gathering can be solved in grids without multiplicity detection. Di Stefano and Navarra [26] extended the results of [28] to infinite grids and bounded the total number of robot movements.
Gathering is solved by circumventing the impossibility of gathering at a single point in some recent papers. The relaxation is on the gathering requirement: Gathering occurs within a small area instead of at a point. A prominent paper that solves gathering in a small area is written by Cord-Landwehr et al. [14] in which, starting from any arbitrary configuration on a grid, robots gathered within a 2 × 2-sized grid area. Cord-Landwehr et al. [29] provided an O(N)-time algorithm for the robot convergence problem (converging toward a single not predefined point) [30].
Izumi et al. [31] considered the robot scattering problem (opposite of gathering) in the semi-synchronous setting and provided an expected O(min{N, D 2 + log N})-time algorithm; here, D is the diameter of the initial configuration.
All the previous algorithms, including Izumi et al. [4], work in the fully synchronous setting, except for [11] which works in the one-by-one activation setting (also known as sequential activation). Our algorithm works in the asynchronous setting. Furthermore, all previous algorithms assume that when two or more robots move to the same location, they are merged as only one robot. Our algorithm does not merge robots; in other words, even if robots located at the same position are activated at different times, the gathering progress is achieved through the (individual) moves of those robots.
Roadmap. In Section 2, we detail the model and touch on some preliminaries. For the sake of simplicity in discussion, we first provide an O(D E )-time algorithm for robots on a grid agreeing on both the coordinate axes in Section 3. We then provide an O(D E )algorithm for robots on a plane agreeing on both the coordinate axes in Section 4. In Section 5, we discuss how the algorithms of Sections 3 and 4 can be modified to solve gathering when robots agree on only one axis. Finally, we provide concluding remarks in Section 6 with a brief discussion.

Model and Preliminaries
Robots. We consider a distributed system of N robots (agents) from a set Q = {r 0 , r 1 , · · · , r N−1 }. Each robot is a (dimensionless) point that can move in an infinite two-dimensional real space R 2 . Throughout this article, we will use a point to refer to a robot as well as its position. We denote by dist(r i , r j ) the distance between two robots r i , r j ∈ Q. Each robot r i works under limited visibility and viewing range of each robot is √ 10, i.e., a robot r i can see and be visible to another robot r j if and only if dist(r i , r j ) ≤ √ 10. For some cases, e.g., for grid, the viewing range smaller than √ 10 is sufficient. We describe what exactly is the viewing range when we describe algorithms in Sections 3 and 5. The connectivity range of each robot is √ 2 following square connectivity, i.e., two robots have an edge between them on G if one robot is inside the (axis-aligned) 2 × 2-sized square area formed by the other robot being at its center. The robots agree on the unit of distance measure, i.e., the viewing and connectivity ranges of √ 10 and √ 2 are the same for each robot r i ∈ Q. The robots also agree on one coordinate axis, north (the assumption of robots agreeing on east is analogous). For the sake of simplicity in discussion, the algorithms in Sections 3 and 4 assume that robots agree on both coordinate axes. The assumption on both axis agreement is lifted in Section 5.
Look-Compute-Move. Each robot r i is either active or inactive. When a robot r i becomes active, it performs the "Look-Compute-Move" cycle as follows: • Look: For each robot r j that is within the viewing range of r i , r i can observe the position of r j on the plane. Robot r i also knows its own position; • Compute: In any cycle, robot r i may perform an arbitrary computation using only the positions observed during the "look" portion of that cycle. This includes determination of a (possibly) new position for r i for the start of next cycle; • Move: At the end of the cycle, robot r i moves to its new position.
Robot Activation. In the fully synchronous setting (F SY N C), every robot is active in every LCM cycle. In the semi-synchronous setting (S SY N C), at least one robot is active, and over an infinite number of LCM cycles, every robot is often infinitely active. In the asynchronous setting (AS Y N C), there is no common notion of time, and no assumption is made on the number and frequency of LCM cycles in which a robot can be active. The only guarantee is that every robot is active infinitely often. Complying with the ASY N C setting, we assume that a robot "wakes up" and performs its Look phase at an instant of time. We also assume that during the Move phase, it moves in a straight line and stops only after reaching its destination point; in other words, the moves are rigid [2].
Runtime. For the F SY N C setting, time is measured in rounds. Since a robot in the SSY N C and ASY N C settings could stay inactive for an indeterminate interval of time, we bound a robot's inactivity and use the standard notion of epoch to measure runtime. An epoch is the smallest interval of time within which each robot is guaranteed to execute its LCM cycle at least once. Therefore, for the F SY N C setting, a round is an epoch. We will use the term "time" generally to mean rounds for the F SY N C setting and epochs for the SSY N C and ASY N C settings.
Square Area. Let r i ∈ Q be a robot positioned at coordinate (x i , y i ). Let L i , L i , respectively, be the horizontal and vertical lines passing through r i . Since r i knows north, r i can easily compute L i , L i . The square area for r i , denoted as SQ(r i ), is an area of the plane enclosed by four lines L i,t , L i,b , L i,l , L i,r with L i,t , L i,b being parallel to L i (perpendicular to L i ) and passes through coordinates (x i , y i + 1) and (x i , y i − 1), respectively, and L i,l , L i,r is perpendicular to L i (parallel to L i ) and passes through coordinates (x i − 1, y i ) and (x i + 1, y i ), respectively. Notice that SQ(r i ) is axis-aligned, and both the height and width of it is two. We denote by p tl , p bl , p br , p tr the intersection points of lines L i,t and L i,l , L i,b and L i,l , L i,b and L i,r , and L i,t and L i,r , respectively. We can divide SQ(r i ) to four quadrant squares SQ 1 (r i ), SQ 2 (r i ), SQ 3 (r i ), and SQ 4 (r i ) with both heights and widths as one. Let SQ 1 (r i ) and SQ 2 (r i ) be at the north of L i and SQ 3 (r i ) and SQ 4 (r i ) be at the south of L i . Moreover, let SQ 1 (r i ) and SQ 3 (r i ) be at west of L i and SQ 2 (r i ) and SQ 4 (r i ) be at east of L i . We say that the positions of L i in SQ(r i ) belong to SQ 3 (r i ) and SQ 4 (r i ). Figure 2a illustrates these ideas. Unit Area. Let r j , r k , respectively, be the topmost and leftmost robots among the robots in SQ(r i ). In some situations, both r j and r k may be the same robot, and this definition is still valid. Let L T be the horizontal line passing through r j and L L be the vertical line passing through r k . Let L B be the horizontal line parallel to L T , and it is at distance one south of L T . Similarly, let L R be the vertical line parallel to L L and at a distance of one east of L L . The unit area for r i , denoted as SQ unit (r i ), is an area of the plane inside SQ(r i ) enclosed by lines L L , L T , L R , and L B . Note that SQ unit (r i ) is an (axis-aligned) unit square of both height and width one. We denote by p TL , p BL , p BR , and p TR the intersection points of lines L T and L L , L B and L L , L B and L R , and L T and L R , respectively. Figure 2b illustrates the idea of unit area computation.
Visibility Graph and Gathering Configuration. We define the visibility graph of any initial configuration I and gathering configurations as follows.
Definition 1 (Initial Visibility Graph). The visibility graph G(I) = (Q, E) of any arbitrary initial configuration I of robots is the graph such that, for any two distinct robots r i and r j , (r i , r j ) ∈ E where r j is positioned on or inside SQ(r i ) (or vice-versa). SQ( * ) provides connectivity for robots with square connectivity range √ 2. The gathering problem may not be solvable under limited visibility if the initial visibility graph G(I) is not connected [2,6]. Therefore, we assume that G(I) is connected at time t = 0. Moreover, any algorithm for gathering must maintain the connectivity of G(I) during its execution until a gathering configuration is reached. For the sake of clarity, we denote by G t (I) the visibility graph G(I) for any time t ≥ 0.

Definition 2 (Ideal Gathering Configuration
). An ideal gathering configuration is one where all robots are at a single point that is not known beforehand.

Definition 3 (Relaxed Gathering Configuration).
A relaxed gathering configuration is one where all robots are on a horizontal segment of length 1 unit that is not known beforehand.
The relaxed gathering configuration (Definition 3) is inspired from the recent work of Cord-Landwehr et al. [14], where the authors modified the ideal gathering configuration (Definition 2) to solve gathering on a grid by locating all robots within a 2 × 2-sized square area that is not known beforehand. Additionally, Definition 3 helps us to circumvent the impossibility results relative to gathering to a point in the ASY N C setting [3], even when N = 2, by gathering the robots in a unit horizontal line segment. As an example, consider two robots r i , r j at distance 1 apart on a horizontal line working under an ASY N C setting. Let r i and r j activate at the same time and r i moves to the position of r j and r j moves to the position of r i as both of them move in the horizontal line. This scenario may repeat infinitely since r i and r j do not have common agreement on east or west under one-axis agreement on north. By using our square connectivity range √ 2, the viewing range √ 10 and one-axis agreement, even when N = 2, the robots can reach a horizontal segment of length one unit. The viewing range helps each robot r i to see whether there is a robot outside SQ(r i ) and decide whether Definition 3 is reached.
Under both axis agreement, our algorithm provides an ideal gathering configuration (Definition 2). Under one-axis agreement, our algorithm provides a relaxed gathering configuration (Definition 3). Since we focus on runtime, we do not explicitly characterize the configurations that do not achieve Definition 2 under one-axis agreement, but we simply prove that all the configurations (at least) attain Definition 3 in O(D E ) time.

O(D E ) Time Algorithm for the Grid
In this section, we define the grid model that is a restriction imposed on the Euclidean plane. The motivation behind designing an algorithm for this model is that it is simple to understand and easy to analyze. We design and analyze an algorithm without the grid restriction in Section 4. In the grid model, a robot moves on a two-dimensional grid and changes its position to one of its eight horizontal, vertical, or diagonal neighboring grid points. Throughout this section, we assume that robots agree on both coordinate axes, and each robot has the viewing range of two. Moreover, each robot has the square connectivity range of √ 2. We say gathering is performed when the robot configuration satisfies Definition 2.

The Algorithm
The pseudocode of the algorithm is given in Algorithm 1. Depending on the positions of other robots within its viewing range, r i distinguishes diagonal, horizontal, and vertical hops, which we discuss separately below. A robot r i hops on one of its neighboring grid points based on the diagonal, horizontal, or vertical pattern that matches the snapshot it takes in the Look phase. Notice that since robots agree on north, r i never hops on any of the three neighboring grid points relative to north from its position, i.e., r i hops only to one of its five neighboring grid points on the same horizontal line L i or south of L i . We will show that this allows achieving a gathering progress in every epoch. Since robot moves are not instantaneous due to the ASY N C setting, a robot r i also does not move if it observes at least one robot in the north of L i inside or on SQ(r i ). This is crucial for guaranteeing that robots do not move south forever. Robot r i terminates when it sees no other robot inside or on SQ(r i ) other than its position.
Diagonal Hops. A diagonal hop takes a robot r i to one of the two diagonal neighboring grid points in the south (i.e., either p br or p bl ). Let L i be a horizontal line that passes from the current position of a robot r i . Robot r i makes a diagonal hop when it sees no robot in SQ(r i ) at the north of L i (including the positions of L i ) and either (i) r i sees no other robot in SQ 3 (r i ) (except at its position) and sees at least one robot on L i,r at the south of L i or (ii) r i sees no other robot in SQ 4 (r i ) (except at its position) and sees at least one robot on L i,l at the south of L i . In case (i), r i hops on grid point p br , whereas in case (ii), it hops on grid point p bl .
In this hop, the robot moves diagonally at a distance of √ 2. Figure 3a,b illustrate diagonal hops.

Algorithm 1:
The algorithm for gathering on a grid (under both axis agreement) /* In every LCM cycle, each robot r i does the following when it activates: */ /* Look: */ 1 (x i , y i ) ← current position of robot r i in the grid graph G; 2 C(r i ) ← snapshot of the positions of other robots within the viewing range of r i ; /* Compute: */ 3 SQ(r i ) ← square area for robot r i ; 4 L i , L i ← horizontal and vertical lines passing through r i , respectively; 5 L i,t , L i,b ← horizontal lines parallel to L i and passing through (x i , y i + 1) and (x i , y i − 1), respectively; 6 L i,r , L i,l ← vertical lines parallel to L i and passing through (x i + 1, y i ) and (x i − 1, y i ), respectively; 7 d i ← destination point for r i to move; 8 If r i sees no other robot in any of the neighboring grid points on SQ(r i ) then 9 r i terminates; 10 Else if r i sees at least a robot in SQ(r i ) in North of L i then 11 r i keeps waiting; d i ← (x i , y i ); // do nothing /* Check the following two conditions for a diagonal hop. */ 12 Else if r i sees no robot in SQ(r i ) on or West of L i (except at its position), and sees at least a robot on L i,r that is part of SQ(r i ) in South of L i then // Figure 3a     Horizontal Hops. A horizontal hop takes r i to its neighboring grid point on L i in the east. When a robot r i sees at least one robot r j at its horizontal neighboring grid point (and possibly others on L i between r i and r j ) and no other robot in SQ(r i ), r i makes a horizontal hop to the neighboring grid point in the east. Figure 3c illustrates the horizontal hop.
Vertical Hops. A vertical hop always takes r i to its neighboring grid point vertically south from it. Robot r i makes a vertical hop if either (i) it sees a robot r j on L i at the south of L i and no other robot in SQ(r i ) at the north of L i or (ii) it sees at least one robot each on L i,l and L i,r or south of L i and no other robot in SQ(r i ) at the north of L i . Figure 3d illustrates case (i) and Figure 3e illustrates case (ii).

Analysis of the Algorithm
We first prove the correctness of the algorithm in the sense that the visibility graph G t (I) remains connected during execution. We then prove the progress of the algorithm such that after a finite number of epochs, any connected initial configuration converges to an ideal gathering configuration (Definition 2). Let I be any arbitrary initial configuration of robots in Q on a grid such that G 0 (I) is connected. Let SER(I) be the axis-aligned smallest enclosing rectangle for the robots in I.  Lemma 1. Given any initial configuration I such that the visibility graph G 0 (I) is connected, the graph G t (I) at any time t > 0 remains connected.
Proof. For a robot r i , since G 0 (I) is connected, there are robots in at least two out of its eight neighboring grid points, unless r i is a leaf node in G 0 (I) in which case there may be a robot in only one out of its eight neighboring grid points. We will show that no matter the moves of r i and the robots in its eight neighboring grid points, in the new configuration, r i has robots in at least two out of its eight neighboring grid points (unless it is a leaf node in G 0 (I) in which case there will be a robot in one of eight neighboring grid points). This immediately proves this lemma from our definition of connectivity.
Notice that the movements of r i are either diagonal, horizontal, or vertical, and r i never moves to its three neighboring grid points on SQ(r i ) in the north of L i . Furthermore, r i does not move when it sees at least one robot r j at the north of L i or inside SQ(r i ).
A diagonal hop for r i is possible when r i sees other robot(s) r j only on one of its two diagonal neighboring grid points on SQ 3 (r i ) or SQ 4 (r i ), and r i moves to the position of r j (since r j does not move as r j sees r i at the north of L j until r i reaches the position of r j ). Robot r i also makes a diagonal hop when it sees other robot(s) r j on either L i,l only or L i,r only that is part of SQ(r i ) in the south of L i . Since r j is at the south of L i , it must be in transit to the neighboring diagonal grid point of r i and r i , and r j meet together when both of them reach that grid point. If one reaches that grid point before, it waits for the other since there will be at least one robot at the north of the horizontal line for the robot on that grid point until r i and r j meet.
A horizontal hop for r i is possible only when r i sees r j in the east at the horizontal neighboring grid point (and no other robot inside or on SQ(r i ) except on L i in the east). After the movement, r i either reaches the position of r j (if r j does not move) or r i and r j will be at the two vertical neighboring grid points (if r j moves). That is, for r j to move, r j has to see at least one other robot in addition to r i on L i or at the south. The connectivity is maintained since r i is the endpoint robot (i.e., it has only one neighboring robot), and if r j is also the endpoint robot, then there is no third robot in the system; otherwise, r j must see a robot r k = r i in one of its five neighboring grid points on L i or south of L i .
A vertical hop for r i is possible when it sees at least one other robot r j on the neighboring grid point that is vertically south of it (and possibly others between r i and r j ), but no robot is observed on or inside SQ(r i ) in the north of L i . In this case, r i reaches the position of r j since r j cannot move until there is r i in the north. r i performs a vertical hop also when it sees at least one robot each on the two vertical lines L i,l and L i,r on or south of L i in SQ(r i ) and no robot in SQ(r i ) in the north of L i . Suppose r i sees two robots r j and r k in SQ(r i ) on or south of L i such that r j ∈ L i,l and r k ∈ L i,r . After the movement, in this case, the distance between r i and one of r j , r k is at most √ 2 as they will be (at most) at the diagonal neighboring grid points from each other. The lemma is described as follows. Proof. Since L D Y is the topmost horizontal line segment, there is no robot in the north of L D Y . Moreover, since robots agree on north, the robots at the grid points of L D Y never move north of L D Y . Therefore, if all the robots at the grid points of L D Y make diagonal or vertical hops when they become active, then they will reach the positions of L D Y −1 ; hence, in at most one epoch, all robots on L D Y will be at L D Y −1 , even in the ASY N C setting. Note that in an epoch, each robot completes its LCM cycle at least once. This means that, in this case, each activated robot at L D Y completes its LCM cycle after moving to the position of L D Y −1 . Therefore, a robot r i on L D Y remains at a grid point on L D Y if and only if it makes a horizontal move in that epoch. We will show that r i either terminates or moves to a position on L D Y −1 in the next epoch.
Let r j be the robot at the horizontal neighboring grid point that r i sees on L D Y when it makes a horizontal hop. We have it that r i must not have seen any robot on its other seven neighboring grid points or inside of SQ(r i ) (except between r i and r j on the same horizontal line). When r i moves to the position of r j , either r j is still on L D Y or has moved to L D Y −1 in the neighboring grid point that is vertically south of r j . If r j has not moved south, either the execution is still in the first epoch or r j does not see any other robot except on or between the positions of r i and r j in the same horizontal line. If r j is still in the first epoch, then r i reaches the position of r j , and either this horizontal moving scenario repeats with execution still being in the first epoch or r j moves south. If r j does not see any other robot except on or between the positions of r i and r j in the same horizontal line, r i (and all other robots on L i up to r j ) reaches the position of r j , and all of them terminate by achieving the gathering configuration. If r j has moved to L D Y −1 in the first epoch, r i moves to the position of r j on L D Y −1 when it becomes active next time since r j is in the neighboring grid point of SQ(r i ) that is vertically south of it. Therefore, in at most two epochs, all the robots on L D Y move to the positions of L D Y −1 .
The following observation is immediate for vertical hops since a vertical hop by a robot takes it to its neighboring grid point vertically south of it. For a horizontal/diagonal hop, this is also true since a robot performing a horizontal/diagonal hop never finds its neighboring robot outside L D X and L 0 .  Proof. Let X := {r 0 , . . . , r X } be the robots on L 0 in the increasing order of their xcoordinates (some of the grid points on L 0 may be empty, and it does not impact our analysis). If all robots r 0 , . . . , r X on set X have robots on or inside SQ( * ) at the north of L 0 , they do not move until those robots at the north of L 0 are moved to L 0 . Therefore, we first assume that only r 0 and r X have robots at the north of L 0 inside or on SQ(r 0 ) and SQ(r X ), respectively, and {r 1 , . . . , r X−1 } have no such robots at the north of L 0 inside or on their respective SQ( * ). Robots r 2 , . . . , r X−2 can move to their neighboring grid points that are vertically south of them in one epoch. This is because they do not see any robot at the north of the horizontal line passing through their positions.
In the second epoch, r 2 and r X−2 see r 1 and r X−1 , respectively, in the north on their respective SQ( * ), and only the robots r 3 , . . . , r X−3 can move to the next line in the south from their current horizontal line. This implies that each robot r i , 1 ≤ i ≤ X 2 waits for r i−1 since it sees r i−1 on the neighboring grid point in the north from their position, and this is also the case for the robots from r X 2 +1 (from r X 2 +2 in the even D X case) to r X−1 . The scenario repeats until the middle robot of L 0 reaches at most D X 2 − 1 distance south from L 0 , if D X is an odd number). If D X is an even number, two robots r X 2 and r X 2 +1 of L 0 reach at most D X 2 − 2 distance south from L 0 . Now consider the case where either r 0 or r X has no robot on the neighboring grid point that is vertically north from it in addition to r 1 , . . . , r X−1 . Notice that at least one of r 0 or r X must have a robot at the north to maintain the connectivity of G t (I). Let r 0 be that robot (the case of r X is analogous). If r 0 moves first, it moves to the position of r 1 in L 0 performing a horizontal hop. If r 1 moves first, r 0 reaches r 1 at the horizontal line immediately below L 0 performing a diagonal hop. By repeating this, the robots r 0 , . . . , r X 2 −1 may reach the position of r X 2 (the middle robot) at distance D X 2 south of L 0 (i.e., L S ). For the remaining robots r X 2 , . . . , r X , each robot r X−i , 1 ≤ i ≤ X 2 sees r X−i+1 in the north on respective SQ( * ); thus, the middle robot can reach at most D X 2 south of L 0 . Therefore, this process again ends up at line L S in the worst-case.
During the execution, the robots at the north of L 0 in SER(I) may visit the robots south of L 0 . In that case, the robots at the south of L 0 do not move until they see at least one robot at the north of its position inside SQ( * ). If a robot does not see any robots at the north of its position, then it either performs a diagonal hop which never takes it to the south of L S or it performs a vertical hop. If it performs a vertical hop, it will perform a horizontal hop in the next epoch, and this never takes it south of L S . Therefore, according to the moves of the robots of L 0 , it is easy to see that all the robots in Q are within the triangular area (as depicted in Figure 4).

Lemma 4.
The viewings of two and the square connectivity range of √ 2 are sufficient for gathering relative to a grid point (that is not known beforehand) on a grid under both axis agreements.
Proof. If a robot r i sees robots only at the south (vertically below or diagonal), it can simply move towards the south, and when r i sees no robot in the south and no robot on horizontal neighboring grid points, it can simply terminate. This is because if there is another robot within its viewing range, r i must see it in one of its eight neighboring grid points in order to satisfy connectivity for G t (I), t > 0, (Lemma 1) since G 0 (t) satisfies this condition. If r i sees a robot r j in either of its horizontal neighboring grid points, then r i moves to the position of r j if r j is at its east, and r j simply waits for r i as it does not perform a horizontal hop to the west or moves vertically south. Even in this case, r i sees r j . Therefore, if r i sees no robot in SQ(r i ), it can terminate. According to the definition of the connectivity range, the viewing range of two is enough for r i to maintain connectivity with any of the eight neighboring grid points.
The analysis of this section proves the following main result. Proof. We have from Lemma 1 that G t (I) remains connected during the execution. We have from Lemma 2 that all the robots at the topmost horizontal line L D Y of SER(I) move to L D Y −1 in at most two epochs. Thus, after at most two epochs, Lemma 2 applies again to the robots of L D Y −1 , which takes all the robots on L D Y −1 to L D Y −2 or south in next two epochs. This process continues and all the robots in SER(I) move to line L 0 or south of it in at most 2 · D Y epochs. These robots will be at one grid point in at most the next D X epochs. This is because for every one unit of vertical hop of the robots at the south of L 0 , the width of the positions of robots decreases by two. The width of the positions of robots at L 0 is at most D X . Thus, the width of the positions of robots becomes zero at distance ≤ D X 2 south of L 0 . Again, from Lemma 2, it takes at most two epochs to move all the robots one unit south; hence, to move all the robots at D X 2 distance south of L 0 , it takes at most D X epochs. Therefore, the robots can gather in O(D X + D Y ) epochs. We have that max{D X , D Y } ≤ D E ≤ √ 2 · max{D X , D Y } for SER(I) of any initial configuration I. Therefore, The algorithm terminates (Lemma 4) since if a robot r i sees no robot in SQ(r i ) other than its current position, then all the robots of Q must be gathered in the current position of r i (due to the connectivity guarantee of Lemma 1).

O(D E ) Time Algorithm for the Euclidean Plane
We discuss here how to solve gathering in a Euclidean plane by removing the restrictions on robot moves imposed on a grid. The viewing range is of √ 10, and the square connectivity range is of √ 2 (both measured in Euclidean distance). The robots agree on both coordinate axes.
We say gathering is performed when the robot configuration satisfies the ideal gathering configuration (Definition 2).

The Algorithm
The pseudocode of the algorithm is provided in Algorithm 2. Depending on the positions of other robots in its viewing range, a robot r i can decide to hop on the positions of one of its neighboring quadrants SQ 3 (r i ) or SQ 4 (r i ); we do not allow r i to move to the positions north of L i . In contrast to grid where robots always move in either unit distances (horizontal and vertical hops) or distance √ 2 (diagonal hops), in the Euclidean plane, a robot may move with varying distance of at most one for horizontal and vertical hops and varying distance of at most √ 2 for diagonal hops. The main difference (with the grid) is on how robots match patterns to perform diagonal, horizontal, and vertical hops. In contrast to relatively simple matching patterns of robots on a grid, the matching patterns of robots for the Euclidean plane are complex.

Overview of the Patterns
The idea is to resemble the patterns for the Euclidean plane to the respective patterns for the grid. For this purpose, we ask each robot r i to compute unit area SQ unit (r i ) as defined in Section 2. SQ unit (r i ) helps r i to decide whether to make a diagonal, horizontal, or vertical hop. If r i sees itself or at least one robot in SQ unit , (r i ) is connected to a robot at the north of L T , and it does not move. This guarantees that robots do not move south forever. If the robots in SQ unit (r i ) are not connected to any other robot outside of SQ unit (r i ) at the west of L R (or similarly at the east of L L ), then r i makes a horizontal hop to the east (or similarly to west). If r i satisfies the conditions for a horizontal hop, except that there is a robot on point p BR (or similarly on p BL ), and the robots in SQ unit (r i ) are in a single diagonal line, then it makes a diagonal hop to p BR (or similarly to p BL ). If the robots in SQ unit (r i ) are not connected to any other robot outside of SQ unit (r i ) at the north of L B but (at least) a robot in SQ unit (r i ) is connected to a robot on or south of L B and r i does not satisfy a condition for a diagonal hop, then r i makes a vertical hop. Moreover, if r i sees at least one robot on each of its two sides (east and west) at horizontal distance ≥ 2, then it makes a vertical hop. The termination is guaranteed by asking r i to check, in every LCM cycle, whether all robots in its viewing range are positioned in SQ unit (r i ) (that is, r i sees no robot outside SQ unit (r i )). When that is the case, r i and the remaining robots in SQ unit (r i ) run a special procedure in order to reach a single point (Definition 2) and terminate their computation. Reaching a single point is facilitated for robots by both axis agreement.

Detailed Description of the Patterns
We provide details of the patterns below. Robot r i terminates when it sees no other robot in SQ(r i ), except on its current position.
Horizontal Hops. Robot r i makes a horizontal hop in the following conditions: • This case is similar to the grid. If r i sees a robot r j at its east at distance one on line L i and there is no robot in SQ(r i ), except the current position of r i and possibly on L i from r i up to r j , r i hops to the position of r j (distance 1). • Robot r i hops horizontally east on L i distance 1 − L ik (L ik is the distance between r i and r k , the leftmost robot in SQ(r i )) if all the following conditions are satisfied (Figure 5a illustrates this case for a horizontal hop): -No robot in SQ unit (r i ) is connected to any other robot at the north of L T .

-
No robot in SQ unit (r i ) is connected to any other robot at the west of L R , except for the robots in SQ unit (r i ).

-
There is no robot on L B of SQ unit (r i ).

Algorithm 2:
The algorithm for gathering in the Euclidean plane /* In every LCM cycle, each robot r i does the following when it becomes activated: */ /* Look: */ 1 (x i , y i ) ← current position of robot r i in the plane; 2 C(r i ) ← snapshot of the positions of other robots within the viewing range of r i ; /* Compute: */ 3 SQ(r i ) ← square area for robot r i ; 4 SQ unit (r i ) ← unit area for r i ; 5 L i , L i ← horizontal and vertical lines passing through r i , respectively; 6 L i,t , L i,b , L i,r , L i,l ← top, bottom, right and left boundary lines of SQ(r i ), respectively; 7 L T , L B , L R , L L ← top, bottom, right and left boundary lines of SQ unit (r i ), respectively; 8 d i ← destination point for r i to move; 9 If r i sees no robot outside SQ unit (r i ) then 10 execute the termination procedure; 11 If r i sees a robot r j in SQ unit (r i ) that is connected to other robot in North of L i,t (of SQ(r i )) then 12 r i does not move; d i ← (x i , y i ); /* Conditions for horizontal hops */ 13 Else if there is no robot on L B in the segment of SQ unit (r i ) ∧ no robot in SQ unit (r i ) is connected to any other robot in West of L R except the robots in SQ unit (r i ) then 14 set the destination point d i as a point at horizontal distance 1 − L ij in East (where L ij is the horizontal distance from r i to the leftmost robot r j in SQ unit (r i )); /* Note: If r i be the leftmost robot in SQ unit (r i ), then it moves distance 1 horizontally in East. And, if the conditions satisfy symmetrically, then r i sets as destination point to the position on L L in West. */ /* Conditions for diagonal hops */ 15 Else if r i sees at least a robot on the diagonal point p BR ∧ all the robots in SQ unit (r i ) are in the diagonal line that passes through SQ 4 (r i ) ∧ no robot in SQ unit (r i ) is connected to any other robot in the West of L R , except the robots in SQ unit (r i ) then 16 set d i as the diagonal point p BR at distance √ 2 − L ij (where L ij is the distance from r i to r j , the topmost and leftmost robot in SQ unit (r i )); /* Note: Here, p BR is the intersection point of L B and L R and SQ 4 (r i ) is the unit square quadrant of SQ(r i ) in the South-West region. If r i be the topmost (leftmost) robot in SQ unit (r i ), then it moves distance √ 2 diagonally to p BR . Moreover, if the above conditions satisfy symmetrically, then r i sets as destination point p BL (the intersection point of L B and L L ).
*/ 17 Else // Conditions for vertical hops 18 SP unit (r i ) ← unit area in West of L i,l and South of L B ;

19
If r i sees a robot at the intersection point of lines L i and L B ∨ r i sees at least one robot each in both sides (East and West) at horizontal distance ≥ 2 ∨ (r i sees a robot on L B of SQ unit (r i ), no robot in SQ unit (r i ) is connected to other robot in North of L B and West of L L ) ∨ (r i sees at least one robot in SQ unit (r i ) that is connected to other robot in South of L B in West of L R and no robot in SQ unit (r i ) is connected to other robot in North of L B and West of L L ) ∨ (r i sees at least a robot in SP unit (r i ) and at least a robot in SQ unit (r i ) is connected to a robot in North of L B and West of L L ) then 20 set d i as the point vertically South at distance 1 − L ij on L B of SQ unit (r i ) (where L ij is the vertical distance from r i to L T ); /* Note: If r i be the topmost robot in SQ unit (r i ) then it moves distance 1 vertically South. */ /* Move: */ 21 r i moves to d i ; Since we ask the robots to always move east in a horizontal hop, we do not have a symmetric case for horizontal hops under both axis agreements. This case is similar to grid. If r i sees no other robot in SQ(r i ) except at least one robot r j in SQ 4 (r i ) on the diagonal corner point p br , r i hops to p br . Robot r i moves at a distance of exactly √ 2 if it performs this hop. • Robot r i hops diagonally at a distance of √ 2 − L ij (where L ij is the distance between r i and r j , the topmost which is also the leftmost robot of SQ unit (r i ) at point p TL ) to a point in SQ 4 (r i ), if the following conditions are satisfied:

-
No robot in SQ unit (r i ) is connected to any other robot at the north of L T .

-
No robot in SQ unit (r i ) is connected to any other robot at the west of L R , except the robots in SQ unit (r i ). -All robots in SQ unit (r i ) are in the diagonal line that passes through SQ 4 (r i ).

-
There is at least one robot on the diagonal point p BR of SQ unit (r i ).  Figure 5c.
Vertical Hops. If no robot in SQ unit (r i ) of a robot r i is connected to any other robot at the north of L i,t (of SQ(r i )), r i makes a vertical hop of distance 1 − L im (where L im is the vertical distance from r i to line L T ) in either of the following conditions: • Robot r i sees at least one robot at the intersection point of L i and L B . • Robot r i sees at least one robot each at both the east and west at horizontal distance ≥ 2. Figure 6b illustrates this case. • Robot r i sees at least one robot on L B of SQ unit (r i ), no robot in SQ unit (r i ) is connected to any other robot at the north of L B and west of L L , and the conditions for a diagonal hop are not satisfied for r i . Figure 6a illustrates this case. • Robot r i sees at least one robot in SQ unit (r i ) that is connected to a robot at the south of L B on or west of L R , and no robot in SQ unit (r i ) is connected to any other robot at the north of L B and west of L L . Figure 6a also illustrates this case. • Let SP unit (r i ) be a unit area at the west of L i,l and south of L B with L B being the topmost horizontal line L T of SP unit (r i ) and L i,l being the rightmost vertical line L R of SP unit (r i ). Robot r i sees that at least one robot in SQ unit (r i ) is connected to a robot at the north of L B and west of L L , r i sees at least one robot in SP unit (r i ), and the conditions for a horizontal hop are not satisfied. Figure 6c illustrates this case.

Remark 1.
Robot r i also makes a vertical hop if the symmetric situations in the last three conditions are satisfied. The above rules infer that the robots move only under certain situations. Robots do not move in all the remaining situations. This process repeats until all robots of Q are inside an (axis-aligned) 1 × 1-sized square area so that the special procedure for termination, as described in the next paragraph, can be applied.

The Termination Procedure
We will show in the analysis that the diagonal, horizontal, and vertical hops described above position all robots in Q in an axis-aligned 1 × 1-sized square area, say SA. We now discuss how the robots reach a point and terminate. Let r l , r b , and r r be the leftmost, bottommost, and rightmost robots in SA. We have that the unit area SQ unit (r i ) of each robot r i that is in SA overlaps. Therefore, if all the robots in SA are in a single diagonal line, then r b does not move, and all other robots in SA make a diagonal hop with their destination as the current position of r b . Otherwise, the robots first perform a horizontal hop, as the destination points the positions on the right vertical line L R of SA. The robots on L R do not move until all the robots in SA (the same for all robots) are positioned on L R . After that, the robots (now on L R ) perform a vertical hop to the destination, which is the position of the bottom most robot on L R , which does not move. Now, since all the robots reach the same position, they terminate in the next epoch.
We have the following immediate observation after all the robots in Q are positioned in an axis-aligned 1 × 1-sized square area SA.

Observation 2.
The robots within an axis-aligned 1 × 1-sized square area SA are positioned at a single point in at most two epochs.

Analysis of the Algorithm
We first prove correctness and then progress to providing a guarantee of the algorithm. We use SER(I) and other definitions as in Section 3 except L S . Here, we define L S as a horizontal line parallel to L 0 at distance D X south of L 0 . Figure 7 illustrates these definitions for the algorithm in the Euclidean plane.
Based on the movement of robots in horizontal, diagonal, and vertical hops, the following observation is immediately made. This is because the robots never make a horizontal hop to the west, and the robots making the horizontal hops never reach east of L D X . In the diagonal hops, robots move to the diagonal position that is closer to the other neighboring robots. Since all the robots are inside L 0 and L D X initially, there is no neighboring robot outside of those lines; hence, the diagonal hops will also be inside L 0 and L D X . In the vertical hops, robots always move vertically south. Since no robot has reached outside of L 0 and L D X with the horizontal as well as diagonal hops, this is true with the vertical hop as well.  Lemma 5. Given that G 0 (I) is connected, the visibility graph G t (I) at any time t > 0 remains connected.

Proof.
We extend the proof of Lemma 1. Similarly to the grid, a robot r i either does not move or performs either a diagonal, horizontal, or a vertical hop. Note also that r i never moves to any position at the north of L i . Furthermore, r i does not move when it sees at least one robot r j on line L i,t or at the north of L i,t .
First of all, if the robots move as in the grid case, Lemma 1 provides the connectivity proof for G t (I), t > 0, starting from connected G 0 (I). Therefore, we focus only on the cases that are particularly relevant to the Euclidean plane.
A diagonal hop for r i is possible only when the robots in SQ unit (r i ) are in the diagonal line that passes through SQ 4 (r i ) and are not connected to any other robot at the west of L R besides the robots in SQ unit (r i ) (the analogous case of SQ 3 (r i ) can be handled similarly). Moreover, there is at least one robot at point p BR . Robot r i then moves to p BR . This preserves connectivity for G t (I) since the robot at p BR must be connected to at least one robot at the east of L R if all the robots of Q are not inside SQ unit (r i ). Due to the ASY N C setting, the robot r j at p BR may perform its Look phase while r i is in transit to p BR . Let t be the time at which r j performs its Look. Let r i be at point p at distance √ 2 − x from p BR at time t. Let SQ p (r i ) be SQ(r i ) for r i when it is at position p. Even in this case, r j does not move in a position outside of SQ p (r i ) regardless of whether it performs a horizontal, vertical, or a diagonal hop, preserving connectivity.
A horizontal hop for r i is possible only when the robots in SQ unit (r i ) are not connected to any other robot at the west of L R similarly to the diagonal hop case with only the difference being that there is no robot on p BR so that even when all the robots in SQ unit (r i ) are in a diagonal line, r i cannot perform a diagonal hop. Even in this case, connectivity is preserved since, if the robots move at most the permitted distance, they would have moved in the grid case.
Similarly, in the vertical hop of robot r i , if it sees no robot at the north in SQ(r i ), it moves vertically south on L i with a distance of exactly one. If r i sees at least one robot r j at the north in SQ(r i ) and satisfies the conditions for vertical hopping, it hops 1 − L ij (where L ij is the vertical distance between r i and r j ) distance south to a position on L B (of SQ unit (r i )). In both cases, by the end of first epoch, each robot moves at most a distance of one toward the south, and the robots remain connected because r i reaches at most √ 2 distance away from the neighbor robot in SQ(r i ) (if the neighbor robot does not move in this epoch) and remains connected. Moreover, the robots connected to r i at the south of L B do not move as they find r i at the north and the connectivity with them remains unaffected. Thus, G t (I), t > 0 remains connected with a vertical hop. Figure 8 illustrates the movement of robots and how the connectivity is preserved. Note here that regardless of the grid case where robots are positioned on the grid points, in the Euclidean plane, robots can be positioned anywhere in the plane. The shaded regions in Figure 8 represent the arbitrary positions of robots within the equivalent grid areas in the Euclidean plane. Note that in the grid case, the robots were either on L D Y or on L D Y −1 , and we proved in Lemma 2 that the robots on L D Y reach L D Y −1 or the south in at most two epochs.
Consider SQ unit (r i ) of any robot r i in CA. We will show that all the robots in SQ unit (r i ) that are in CA reach L D Y −1 or below in at most two epochs. Since these robots do not see any robot on or north of L D Y , they perform at least one kind of hop (vertical, horizontal, or diagonal) in the first epoch except the robots positioned between L 1 and L 2 in the west and L D X −2 and L D X −1 in the east in CA (Figure 8). The robots between L 1 and L 2 and L D X −2 and L D X −1 may not satisfy any conditions for movement in the first epoch. If all the robots in SQ unit (r i ) in CA perform either a diagonal or a vertical hop, they reach L D Y −1 or south in one epoch because, with both the diagonal and vertical hops, robots in SQ unit (r i ) reach L B or below L B and L B is either L D Y −1 or below. If some robots perform a horizontal hop in the first epoch, we show that it performs either a vertical or a diagonal hop in the second epoch.
A robot makes a horizontal hop if it sees no other robot at the west of L R , except the robots in SQ unit (r i ), and there is no robot on L B of SQ unit (r i ). By the end of the first epoch, all the robots in SQ unit (r i ) reach the positions on or east of L R if all of them make a horizontal hop. In this case, the robots in CA between L 1 and L 2 do not move in the first epoch. If some robots performed horizontal hops and the rest performed vertical/diagonal hops, we only need to guarantee that the robots that performed a horizontal hop on the first epoch reached L B or south of it in the second epoch performing a vertical or a diagonal hop. Consider a robot r i that satisfies the conditions for a horizontal hop in the first epoch. We have it that there is no robot on L B , and the robots in SQ unit (r i ) are connected to no other robot besides the robots in SQ unit (r i ) at the west of L R . Let SQ E unit (r i ) be a square area adjacent to SQ unit (r i ) at the east between lines L T and L B . Let L B and L R be the bottom horizontal and right vertical lines of SQ E unit (r i ). If the robots in SQ E unit (r i ) are not on L B and not connected to any other robot below L B at the west of L R , they do not move until all the robots in SQ unit (r i ) reach L R or east of L R in SQ E unit (r i ). If there are robots on L B , let x be the robot on L B that is the closest from L R . Let L V be a line parallel to L R at some unit distance west of x. All the robots in SQ unit (r i ) at the west of L V perform one horizontal move each in the first epoch. The robots on L V or east in SQ unit (r i ) perform a vertical hop as there are robots on L B . The robots of SQ unit (r i ) that performed a horizontal hop on the first epoch now observe robots on L B in the second epoch and make a vertical move. Moreover, the robots in SQ E unit (r i ), which were waiting for the robots in SQ unit (r i ) to perform a horizontal hop in the first epoch, now see robots at their respective L B and, hence, perform either a vertical or a diagonal hop to L B . This means that the robots in CA between L 0 and L 2 also move to L D Y −1 or south in two epochs. Arguing similarly, if the robots in CA between L D X −2 and L D X −1 do not move in the first epoch, they also see a robot on their respective L B in the second epoch since the robots at the west of L D X −2 have already moved south in the first epoch. Thus, these robots also move south in the second epoch. In the same manner the remaining robots between L D X −1 and L D X in CA move to L D Y −1 or move south in the third epoch as they can observe at least one robot on their respective L B . Therefore, in three epochs, all the robots in CA reach L D Y −1 or south. The Lemma is described follows. Proof. We extend the proof of Lemma 3. Let X := {r 0 , . . . , r X } be the set of robots in the increasing order of their x-coordinates in the corridor area CA between L 1 and L 0 of SER(I). If the robots on set X see other robots at distance ≥ 1 north from their positions, they do not move and wait until they do not see any robot at the north at a distance ≥ 1. Therefore, similarly to Lemma 3, the robots in CA that do not see any robot in the north at distance ≥ 1 proceed to move south. This will take those robots to the next corridor CA adjacent to CA in the south. Suppose at some time t > 0, all the robots reach CA between L 0 and L 1 . Some robots might see no robots at the north at the distance ≥ 1 before time t, and they can perform their moves earlier, which does not affect our argument. Now, the robots in CA that are in a unit square area (i.e., between L 0 and L 1 ) in the east perform horizontal moves, and the robots in the next unit square area (i.e., between L 1 and L 2 ) do not move in the first epoch. Similarly, the robots in CA that are in two unit square areas in the west (i.e., between L D X −2 and L D X ) do not move in the first epoch. The remaining robots in CA between L 2 and L D X −2 move south. In the next epoch, the robots in CA between L 1 and L 2 (including the robots that moved horizontally to this area in the previous epoch) move south. The robots in CA between L D X −2 and L D X −1 also move south in the this epoch whereas the robots in CA between L D X −1 and L D X still do not move; they move in the third epoch. The robots in CA between L 2 and L 4 and L D X−4 and L D X−2 do not move first, and the other robots move south.
Following this, we can observe that as the robots move to the next corridor (of size one) in the south of L 0 , the width of the positions of robots decreases by one. This is because, at every corridor, the robots in the east most unit square area perform horizontal moves. Therefore, all the robots in X will be within a single unit square area in the corridor at distance D X south of L 0 (at most). When all the robots are within a unit square area, they follow the termination procedure and do not move further south. Figure 8 illustrates how the robots move south of L 0 . The figure also shows how the robot chains merge to eventually reach a unit square during execution so that the termination procedure can be executed.
The following observation is also immediate. Proof. Let r be a robot in Q. SQ unit (r) is computed based on the position of other robots in SQ(r), which may lie anywhere within SQ(r). For r to decide whether it is connected to other robots outside SQ unit (r), it has to see other robots in both the horizontal and vertical distance of at most one outside SQ unit (r). Therefore, the maximum distance between r and some other robot r in SQ unit (r) (or SQ(r)) is √ 2 and r may be connected to a robot at a distance of at most √ 2 away from r . Therefore, r needs to see at most a distance of √ 2 + √ 2 = 2 √ 2 = √ 8 to find out whether there is a robot outside SQ unit (r) or not. When r sees that no robot in SQ unit (r) is connected outside of SQ unit (r), it can execute the termination procedure. Now, for the vertical hops, there is one condition that requires r to see at least one robot each at horizontal distance ≥ 2 at both the east and west, within the corridor of L T and L B . To guarantee whether there is a robot at horizontal distance ≥ 2 or not, r needs to see up to a horizontal distance of < 3 and vertical distance of < 1. This is because if there is any robot at horizontal distance > 2, it must be connected to a robot at horizontal distance < 2. Therefore, r needs to see at most distance Figure 9 (left) illustrates this requirement.
The analysis of this section proves the following main result.  Proof. We have from Lemma 5 that, given a connected G 0 (I), G t (I), t > 0, remains connected during the execution of the algorithm. We have from Lemma 6 that all the robots at the topmost horizontal line L D Y of SER(I) move to L D Y −1 or south of L D Y −1 in at most two epochs. In other words, L D Y −1 becomes L D Y in at most two epochs and Lemma 6 applies again to L D Y −1 . Therefore, all the robots in SER(I) move to line L 0 or south of it in at most 2 · D Y epochs. After that, we have it that, from Lemma 7, these robots will be inside an axis-aligned unit area in at most next 2 · D X epochs, arguing similarly with respect to Lemma 6. After all the robots of Q reach the insides of an unit square area, we have from Observation 2 that they reach a single point in at most the next two epochs. Therefore, the robots gather to a single point in 2 · D Y + 2 · D X + 2 = O(D X + D Y ) = O(D E ) epochs. The algorithm terminates (Lemma 8).

Gathering under One-Axis Agreement
We discuss modifying the above algorithms when the robots agree on only one axis.

Grid
We first discuss changes in the model of Section 3. We say gathering is performed when the robot configuration satisfies the relaxed gathering configuration (Definition 3). We also relax the viewing range from 2 to 3.
We now discuss changes in Algorithm 1 (Section 3). The change is only on Rules 1 (termination) and 3 (horizontal hop). Regarding Rule 3, instead of r i moving only to the east (Figure 3 (middle)), r i can also move to the west as well if it sees no robots on or inside SQ(r i ), except for the situation where there is exactly one robot r j on the neighboring grid point on L i in the west. Regarding Rule 1, r i terminates if it sees all the robots at at most one unit apart in a horizontal line (i.e., all the robots are positioned in two horizontal neighboring grid points). Lemma 9. The viewing range of three is sufficient for gathering on a grid with guaranteed termination under a one-axis agreement.
Proof. Notice that a robot r i terminates if it sees all the robots in Q are at most two neighboring grid points (one is current position of r i and the other is either the left horizontal grid point only or the right horizontal neighboring grid point only). For r i to make a decision that the robots are not at any third grid point, it has to see all the neighboring grid points of its two horizontal neighboring grid points as well. The distance from r i to either of its horizontal neighboring grid point is one, and the distance of the neighboring grid points of r i 's horizontal neighboring grid points is at most √ 2. Therefore, r i needs the viewing range of (1 + √ 2) < 3. The connectivity range remains √ 2.
Having the viewing range of three, the analysis of the algorithm in Section 3 applies directly to the modified algorithm for the grid under the one axis agreement. Therefore, we summarize the main result in the following theorem. Theorem 4. Given any connected configuration of N ≥ 1 robots with the viewing range of three and the square connectivity range of √ 2 on a grid, the robots can gather in a unit length horizontal line segment (that is not known beforehand) in O(D E ) epochs in the ASY N C setting under a one-axis agreement.

Euclidean Plane
We first discuss changes in the model of Section 4. We say gathering is performed when the configuration satisfies the relaxed gathering configuration (Definition 3). The viewing and square connectivity ranges remain the same as in Section 4.
We now discuss changes in the algorithm. The change is on horizontal and vertical hops and on termination. Instead of computing SQ unit (r i ) using L L and L T as reference lines, SQ unit (r i ) also needs to be computed by using L R and L T as references. When r i sees no other robot on one side (say west) at a distance of >1 but does on the other side (east), it takes the topmost robot r j and leftmost robot r k in SQ(r i ) in order to compute SQ unit (r i ); for the symmetric case, it takes the topmost and rightmost robots in SQ(r i ) as a reference. This allows the robots to make horizontal hops in both directions (not necessarily only east under both axis agreement). Therefore, r i hops to the west of L i if the conditions for horizontal hop defined in Section 4 are satisfied symmetrically. Regarding vertical hopping, the following changes are made in the last three conditions: -Robot r i sees at least one other robot each on both sides of L i on L B or south of L B , which is connected to at least one robot of SQ unit (r i ). -Robot r i sees at least one other robot on L B or south of L B (which is connected SQ unit (r i )) at one side of L i (say east) and at least one other robot at horizontal distance ≥2 on the other side (west) (and vice-versa). -Robot r i sees other robot(s) on L B (or connected to other robot(s) at the south of L B ) only at one side of L i , say east, then finds the leftmost robot r l on L B of SQ unit (r i ) (or south of L B that is connected to SQ unit (r i )) and sees that no robot in SQ unit (r i ) is connected to another robot at its left (i.e., west) at a horizontal distance of ≥1 from r l (and vice-versa).
Regarding termination, r i terminates if all the robots it sees within its viewing range (including itself) are within a horizontal line segment of length 1. We will show in the analysis that, with these changes, the algorithm positions the robots in Q inside an axisaligned 1 × 1-sized square area SA in O(D E ) epochs.
We now discuss how the robots in SA reached a relaxed gathering configuration (Definition 3). Let r b be the bottommost robot in SA (if more than one, pick one arbitrarily). Let L B be the horizontal line passing through r b . The robots on L B (including r b ) do not move. The other robots move vertically to the positions of L B . The viewing range allows the robots to decide whether there are robots outside SA or not.

Proof of Theorem 1:
It is easy to see from the analysis of Section 4 that robots in Q reach inside an axis-aligned unit square area in O(D E ) epochs. The only change on the analysis is on horizontal hops, which does not increase the number of epochs for the robots in Q to reach the inside of the unit area. Finally, it takes at most one additional epoch for all the robots that are in the unit square area to reach L B . The robots that are not on L B move vertically to L B , and the robots on L B do not move. Therefore, the robots reach a relaxed gathering configuration (Definition 3) in O(D E ) epochs.

Concluding Remarks
We have presented, to the best of our knowledge, the first time-optimal O(D E )-epoch algorithm for gathering N ≥ 1 classic oblivious robots in a plane in the ASY N C setting under limited visibility, improving significantly on the previous O(D G )-round algorithm of [4] that works in the F SY N C setting. Our result assumes the viewing range of √ 10, the square connectivity range of √ 2, and the agreement on one axis. This is in contrast to the viewing range of one and the (circular) connectivity range of 1 − 1 √ 2 in [4] under the same one axis agreement. For future work, it will be interesting to relax our assumption of rigid moves to accommodate non-rigid moves. It will also be interesting to reduce the gap between the connectivity and viewing ranges without affecting time complexity.
Funding: This research received no external funding