Keywords

1 Introduction

The gathering problem requires a set of n mobile computational entities, usually called robots or agents, initially situated at different locations in a spatial universe, to gather at some unspecified location within finite time. When only two robots are involved, the problem is usually referred to as the rendezvous problem. In distributed computing, gathering has been extensively studied both in continuous and in discrete domains. In the continuous setting, the robots operate in the two-dimensional Euclidean space and in the discrete case, they operate in a network modeled as a graph. In the discrete setting, the problem has been previously studied in different graph topologies, e.g. rings [10, 18, 22, 23], grids [8, 31], trees [8] etc. The problem is particularly difficult in graphs that are highly symmetric and is solvable only in very limited cases. Hence, for characterization of gatherability, it is important to investigate the problem in highly symmetric graphs. In this paper, we investigate the problem in a hypercube graph.

1.1 The Model

A set of autonomous mobile robots is randomly deployed on the vertices of a d-dimensional hypercube network. The d-dimensional hypercube \(Q_d\) is an undirected graph with vertex set \(V(Q_d) = \mathbb {Z}_2^d = \{0, 1\}^d\), and two vertices are adjacent if and only if the two binary strings differ in exactly one coordinate. An oriented hypercube is an edge-labeled hypercube with the so-called dimensional labeling \(\lambda : E(Q_d) \rightarrow \{1,\ldots , d\}\) where \(\lambda (uv) = i\), if u and v differ in the ith coordinate. We shall denote an oriented hypercube by \(Q_d^{\mathcal {O}}\), and an unoriented hypercube by simply \(Q_d\). The binary string labels of the vertices are for descriptive purposes, and are not known to the robots. However, in an oriented hypercube, the edge-labels are known to the robots. It is traditionally assumed that the robots can only perceive the labels of the edges adjacent to the vertex on which it resides. But since the labels of edges adjacent to a single vertex determine the dimensional labels of all the edges in a hypercube (See Theorem 3.1 in [33]), we assume without loss of generality that the robots know the labels of all the edges.

The robots are oblivious (they have no memory of past configurations and previous actions), autonomous (there is no central control), homogeneous (they execute the same distributed algorithm), anonymous (they have no unique identifiers) and identical (they are indistinguishable by their appearance). The robots have global visibility, i.e., they are able to perceive the entire graph. The robots do not agree on any global coordinate system. Furthermore, there are no means of communication between the robots.

The robots, when active, operate according to the so-called Look-Compute-Move cycle. In each cycle, a previously idle or inactive robot wakes up and executes the following steps. In the Look phase, the robot takes the snapshot of the positions of all the robots, represented in its own coordinate system. Based on the perceived configuration, the robot performs computations according to a deterministic algorithm to decide whether to stay idle or to move to an adjacent vertex. Based on the outcome of the algorithm, the robot either remains stationary or makes an instantaneous move to an adjacent vertex. Since the moves are instantaneous, it implies that the robots are always seen on vertices, not on edges. In the fully synchronous setting (FSYNC), the activation phase of all robots can be logically divided into global rounds, where all the robots are activated in each round. The semi-synchronous (SSYNC) model coincides with the FSYNC model with the only difference that not all robots are necessarily activated in each round. The most general type of scheduler is the asynchronous scheduler (ASYNC). In ASYNC, the robots are activated independently, and the amount of time spent in Look, Compute, Move and inactive states are finite but unbounded and unpredictable. As a result, the robots do not have a common notion of time.

An important capability associated to the robots is multiplicity detection. During the Look phase, a robot may perceive a vertex occupied by more than one robot in different ways. In strong multiplicity detection, the robots perceive the actual number of robots in each vertex. In weak multiplicity detection, the robots are only able to detect whether a vertex is occupied by more than one robot, but not the exact number. If the robots have no multiplicity detection capability, they can only decide if a vertex is occupied or empty.

1.2 Related Works

The gathering problem has been extensively studied in continuous domain under various assumptions [1, 4,5,6,7, 16, 29, 30]. In discrete domains, both gathering and rendezvous have been studied in different graph topologies [2, 8, 11, 13,14,15, 22, 23, 25, 27, 28, 32]. The problem of gathering two robots on an anonymous ring was studied in [12, 26, 28]. The problem for more than two robots was studied in [15]. In [15], the robots had memory and used tokens to break symmetry. In [23], the problem was first considered in a very minimal setting with identical, asynchronous, memoryless robots without tokens or any kind of communication capability. They proved that without multiplicity detection, gathering is impossible on rings for \(n \ge 2\) robots. With weak multiplicity detection capability, they solved the problem for all configurations with an odd number of robots, and all the asymmetric configurations with an even number of robots by different algorithms. In [22], symmetric configurations with an even number of robots were studied, and the problem was solved for more than 18 robots. Some of the remaining configurations were solved in [9, 18, 24] in separate algorithms. In [10], a single unified algorithm was proposed, that achieves gathering for all gatherable initial configurations except some potentially gatherable configurations with 4 robots. The problem was studied with weak local multiplicity detection in [19,20,21]. A full characterization of gatherable configurations for finite grids and trees with weak multiplicity detection was provided in [8]. Gathering in finite grids in presence of crash-faults was studied in [3]. Optimal gathering in infinite grid with strong multiplicity detection was studied in [31].

2 Theoretical Preliminaries

2.1 Group of Automorphisms

An automorphism of a graph \(G = (V, E)\) is a bijection \(\varphi : V \longrightarrow V\) such that for all \(u, v \in V\), uv are adjacent if and only if \(\varphi (u), \varphi (v)\) are adjacent. The set of all automorphisms of G forms a group, called the automorphism group of G and is denoted by Aut(G).

The automorphism group of a hypercube is generated by two types of automorphisms, namely translation and rotation.

Translation: For \(a \in \mathbb {Z}_2^d\), the map \(\tau _a : V(Q_d) \longrightarrow V(Q_d)\) given by \(u \mapsto u \oplus a\) is called translation by a. Here, \(u \oplus a\) is the vertex obtained by adding the binary strings u and a componentwise. The set \(T = \{ \tau _a \mid a \in \mathbb {Z}_2^d \}\) of all translations forms a subgroup of \(Aut(Q_d)\).

Rotation: For \(\sigma \in S_d\), the map \(r_{\sigma } : V(Q_d) \longrightarrow V(Q_d)\) given by \(u \mapsto \sigma (u)\) is called rotation by \(\sigma \), where \(\sigma (u)\) is the vertex obtained by permuting the binary string u by \({\sigma } : \{1, \ldots , d \} \longrightarrow \{1, \ldots , d \}\). The set \(R = \{ r_{\sigma } \mid \sigma \in S_d \}\) of all rotations forms a subgroup of \(Aut(Q_d)\).

Theorem 1

[17]. \(Aut(Q_d) = TR\).

Hence, for any automorphism \(\varphi \in Aut(Q_d)\), \(\exists \) a unique pair \((a, \sigma ) \in (\mathbb {Z}_2^d, S_d)\), such that \(\varphi : V \longrightarrow V\) can be written as \(u \mapsto \sigma (u) \oplus a\).

It is easy to see that \(|T| = 2^d\) and \(|R| = d!\). Since \(T \cap R\) is trivial, |TR| \(= |T||R|/|T \cap R|\) \(= 2^dd!\). Therefore, we have the following corollary.

Corollary 1

[17]. \(|Aut(Q_d)| = 2^dd!\).

The definition of automorphism of graphs can be extended to edge-labeled graphs in a natural way. Given an edge-labeled graph \(G = (V, E, \lambda )\) with edge-labeling \(\lambda : E \longrightarrow \mathbb {N}\), an automorphism of G is a bijection \(\varphi : V \longrightarrow V\) such that for all \(u, v \in V\), \(\varphi (u)\varphi (v) \in E\) if and only if (1) \(uv \in E\) and (2) \(\lambda (\varphi (u)\varphi (v))\) \(= \lambda (uv)\). In view of this definition, it is easy to see that the dimensional labeling of a hypercube kills all rotational automorphisms. Thus the automorphism group of an oriented hypercube consists of only translations.

Theorem 2

\(Aut(Q^{\mathcal {O}}_d) = T\).

2.2 Feasibility of Gathering

Consider a set of robots placed on the vertices of a simple undirected connected graph \(G=(V,E)\). Define a function \(f:V \longrightarrow \mathbb {N} \cup \{0\}\), where f(v) is the number of robots on the vertex v. The pair (Gf) is called a configuration of robots on G, or simply a configuration. If all the robots in a configuration reside on a single vertex, then it is called final configuration; otherwise it is called a non-final configuration. Given a configuration (Gf), we define the multiplicity function \(\tilde{f}\) in the following way. If the model assumes robots with strong multiplicity detection capability, then \(\tilde{f}(v) = f(v)\) for all \(v \in V\). If the robots have weak multiplicity detection capability, then \(\tilde{f}:V \longrightarrow \{0, 1, 2\}\) is defined as,

If the robots have no multiplicity detection capability, then \(\tilde{f}:V \longrightarrow \{0, 1\}\) is defined as,

Given a configuration (Gf), the pair \((G,\tilde{f})\) is called the perceived configuration.

An automorphism of a perceived configuration \((G,\tilde{f})\) is a graph automorphism \(\varphi \in Aut(G)\) such that \(\tilde{f}(v)= \tilde{f}(\varphi (v))\) for all \(v \in V\). The set of all automorphisms of \((G,\tilde{f})\) also forms a group that will be denoted by \(Aut(G,\tilde{f})\). If \(|Aut(G,\tilde{f})|=1\), we say that \((G,\tilde{f})\) is asymmetric, otherwise it is said to be symmetric.

For an automorphism \(\varphi \in Aut(G,\tilde{f})\), let \({<}\varphi {>} \subseteq Aut(G,\tilde{f})\) be the cyclic subgroup generated by \(\varphi \). Elements of this group are \(\{\varphi ^0, \varphi ^1, \varphi ^2,\dots , \varphi ^{p-1}\}\), where \(\varphi ^0\) is the identity, \(\varphi ^k=\underbrace{\varphi \circ \varphi \circ \cdots \circ \varphi }_{k\,\text {times}}\) and p is the order of \(\varphi \).

For any subgroup H of \(Aut(G,\tilde{f})\), define the equivalence relation on V given by: \(x \sim y\) if and only if \(x = \varphi (y)\) for some \(\varphi \in H\). This equivalence relation induces a partition on V. The orbit of a vertex \(v \in V\) under the action of H is the set \(H_v\)= {\(\sigma (v) | \sigma \in H\)}, which is the corresponding equivalence class containing v.

Partitive Automorphism: Let \(\mathcal {C} = ((V, E),\tilde{f})\) be a perceived configuration. A non-trivial automorphism \(\varphi \in Aut(\mathcal {C})\) is said to be partitive on V if \(|H_v|=p\) for all \(v\in V\), where \(p>1\) is the order of \(\varphi \) and \(H = {<}\varphi {>}\).

Lemma 1

In \(Q_d\), any non-trivial translation is partitive.

Theorem 2 in [32], stated for configurations of robots with strong multiplicity detection capability can be easily generalized to the following theorem.

Theorem 3

Let \(\mathcal {C}=((V, E), \tilde{f})\) be a non-final perceived configuration. If there exists a \(\varphi \in Aut(\mathcal {C})\) partitive on V, then \(\mathcal {C}\) is not gatherable.

Theorem 4

Without multiplicity detection capability, gathering in (both oriented and unoriented) hypercubes is not deterministically solvable in SSYNC.

Proof

Assume that there exists a correct gathering algorithm \(\mathcal {A}\). In the SSYNC model, time can be logically divided into discrete global rounds. So, starting from some non-final initial configuration, consider a synchronous execution of algorithm \(\mathcal {A}\), in which gathering is achieved in round t.

Case 1: Suppose that in round \(t-1\), exactly two vertices in \(Q_d\) are occupied. Hence, the perceived configuration in round \(t-1\) is \((Q_d, \tilde{f})\) where \(\tilde{f}(v) = \tilde{f}(w) = 1\) for two distinct vertices \(v, w \in V(Q_d)\), and \(\tilde{f}(u) = 0\) \(\forall u \in V(Q_d){\setminus }\{v,w\}\). But, then the perceived configuration \((Q_d, \tilde{f})\) admits a partitive automorphism given by \(x \mapsto x \oplus v \oplus w\). Hence by Theorem 3, gathering can not be deterministically achieved from this configuration.

Case 2: Assume that at least three vertices in \(Q_d\) are occupied in round \(t-1\). Then algorithm \(\mathcal {A}\) brings all the robots to a common vertex, say u, in one step. But the adversary can choose to activate all the robots except one that is not placed at u. Then all but one robot will reach u. This will create a configuration with exactly two vertices occupied. Since this configuration admits a partitive automorphism, gathering can not be deterministically achieved from here by Theorem 3.    \(\square \)

Corollary 2

Without multiplicity detection capability, gathering in (both oriented and unoriented) hypercubes is not deterministically solvable in ASYNC.

2.3 Weber Point

Given a configuration (Gf), with \(G = (V, E)\), the centrality of \(v \in V\) is defined as \(c_{G,f}(v) = \sum \limits _{u \in V}^{} d(u,v) \cdot f(u)\). When there is no ambiguity, we shall write \(c_f(v)\), or simply c(v).

Weber Point: Given a configuration \(\mathcal {C} =(G = (V,E),f)\), a vertex \(v \in V\) is a Weber point of \(\mathcal {C}\), if c(v) \(= min \{c(u) | u \in V\}\).

By definition, a Weber point is a vertex with minimum centrality. In other words, a vertex \(w \in V\) is a Weber point if the sum of the lengths of the shortest paths from all robots to w is minimum. Therefore, an algorithm that gathers all the robots at a Weber point via the shortest paths is optimal with respect to the total number of moves performed by the robots. However, a configuration may have more than one Weber point. Given a configuration (Gf), we shall denote the set of Weber points by \(\mathcal {W}_{G,f}\), or simply \(\mathcal {W}_{f}\) or \(\mathcal {W}\) when there is no ambiguity.

Theorem 5

[32]. Let (Gf) be a configuration with Weber points \(\mathcal {W}_{f}\). If a robot moves towards a Weber point \(w \in \mathcal {W}_{f}\), resulting in a new configuration \((G,f')\), then

  1. 1.

    \(c_{f'}(v) = c_f(v) - 1\) for each \(v \in \mathcal {W}_{f'}\)

  2. 2.

    \(w \in \mathcal {W}_{f'}\)

  3. 3.

    \(\mathcal {W}_{f'} \subseteq \mathcal {W}_{f}\).

We shall now discuss about the Weber points of configurations on a hypercube. Consider a set of n robots \(\{ r_1, r_2, \ldots , r_n \}\) on a d-dimensional hypercube \(Q_d\). Suppose that the robots \(r_1, r_2, \ldots , r_n\) are placed on the vertices \(v_1, v_2, \ldots , v_n\) respectively. For \(i = 1, 2, \ldots , n\), let the binary string representation of \(v_i\) be \(b_{i1}b_{i2} \ldots b_{id}\), where \(b_{ij} \in \{0,1\}\). For \(j = 1, 2, \ldots , d\), let us define sets \([b]_j \subseteq \{0,1\}\) in the following way.

In Theorem 6, we show that the set of Weber points of the configuration is

$$\mathcal {W} = [b]_1 \times [b]_2 \times \ldots \times [b]_d.$$

For instance, consider a configuration of a set of 8 robots \(\{ r_1, r_2, \ldots , r_8 \}\) on a 4-dimensional hypercube \(Q_4\). Suppose that the robots are positioned on the following vertices respectively: 0110, 0111, 1000, 1110, 0000, 0001, 1110, 1101. Then the set of Weber points of this configuration is given by

$$\begin{aligned} \mathcal {W}&= \{0,1\} \times \{1\} \times \{0,1\} \times \{0\} \\&= \{0100, 0110, 1100, 1110\}. \end{aligned}$$

Theorem 6

Let \(\{r_i\}_{i=1}^{n}\) be a set of robots placed on the vertices of \(Q_d\) with binary string representations \(\{b_{i1}b_{i2} \ldots b_{id}\}_{i=1}^{n}\) respectively. Then the set of Weber points of the configuration is \(\mathcal {W} = [b]_1 \times [b]_2 \times \ldots \times [b]_d\).

Proof

The distance between any two vertices in \(Q_d\) is the number of positions in which their binary string representations differ. Then it can be easily seen that (1) the centrality of all \(w \in [b]_1 \times [b]_2 \times \ldots \times [b]_d\) are equal, (2) the centrality of any \(v \in V(Q_d){\setminus }[b]_1 \times [b]_2 \times \ldots \times [b]_d\) is strictly greater than the centrality of \(w \in [b]_1 \times [b]_2 \times \ldots \times [b]_d\).    \(\square \)

Corollary 3

The subgraph induced by the set of Weber points \(\mathcal {W}\) of a configuration on a hypercube \(Q_d\) is also a hypercube.

Corollary 4

The number of Weber points of a configuration on a hypercube \(Q_d\) is \(2^k\), where \(0 \le k \le d\).

2.4 Leading Weber Point

A configuration of robots on a hypercube can have more than one Weber point. We want to devise an algorithm that gathers all the robots at one of the Weber points via the shortest paths. Our proposed algorithm requires to solve a subproblem called LeadingWeberPoint. Let us formally define the problem LeadingWeberPoint. Consider a configuration in which no vertex contains more than one robot, and that has no partitive automorphism. Let \(\mathcal {W}\) be the set of Weber points of this configuration. The problem LeadingWeberPoint asks to devise an algorithm so that every robot that perceives this configuration in its local view, deterministically elects a unique Weber point \(w_{\ell } \in \mathcal {W}\). We shall call the vertex \(w_{\ell }\) the leading Weber point.

Since we have assumed that the robots are positioned at distinct vertices, there is no distinction between the configuration and the perceived configuration. In other words, given such a configuration (Gf), we have \(\tilde{f} = f\). A vertex \(v \in V\) is called a fixed vertex if \(\varphi (v) = v,\) \(\forall \varphi \in Aut(G, f)\).

Theorem 7

LeadingWeberPoint can be deterministically solved only if \(\mathcal {W}\) has at least one fixed vertex.

Proof

See Appendix A.

Theorem 8

LeadingWeberPoint may not be deterministically solvable in an unoriented hypercube.

Proof

Consider a configuration \((Q_5, f)\) of a set of 14 robots on the 5-dimensional unoriented hypercube \(Q_5\). The robots are placed on the following vertices: 00100, 00001, 11000, 10010, 01100, 01010, 00101, 00011, 11010, 10110, 11001, 10101, 01111, 11111. It is easy to see that \(\mathcal {W}_f = V(Q_5)\). It can be shown that \(Aut(Q_5,f)\) \(= \{e, \varphi _1, \varphi _2, \varphi _3\}\), with each \(\varphi _i\) given by \(u \mapsto \sigma _i(u) \oplus a_i\), where \(a_i \in \mathbb {Z}_2^5, \sigma _i \in S_5\) are the following: \(a_1 = 00000,~\sigma _1 = (1)(2 4)(3 5)\), \(a_2 = 10000,~\sigma _2 = (1)(2 5 4 3)\), \(a_3 = 10000,~\sigma _3 = (1)(2 3 4 5)\). Then it can be easily verified that (1) there is no partitive automorphism in \(Aut(Q_5,f)\), (2) there is no fixed vertex in \(\mathcal {W}_f = V(Q_5)\). So by Theorem 7, LeadingWeberPoint is deterministically unsolvable.

   \(\square \)

Now we show that LeadingWeberPoint can be deterministically solved in an oriented hypercube.

Lemma 2

Given a vertex \(u_0\) in an oriented hypercube \(Q_d^{\mathcal {O}}\), \(\exists \) exactly one coordinate assignment (bijection) \(\varPsi : V(Q_d^{\mathcal {O}}) \longrightarrow \{0,1\}^d\) such that

  1. 1.

    \(\varPsi (u_0) = 00\ldots 0 \in \{0,1\}^d\)

  2. 2.

    uv are adjacent if and only if \(\varPsi (u), \varPsi (v)\) differ in exactly one bit

  3. 3.

    for \(uv \in E(Q_d^{\mathcal {O}})\), \(\lambda (uv) = i\) if and only if \(\varPsi (u), \varPsi (v)\) differ in the ith position.

Proof

The coordinates given to \(u_0\) are \(00\ldots 0\). Then by rule (2) and (3), the coordinates of all its neighbors are uniquely determined. If the coordinates of all vertices at distance \(i (< d)\) from \(u_0\) are uniquely determined, then again by rule (2) and (3), the coordinates of all vertices at distance \(i+1\) can be determined uniquely. Hence by induction, the coordinates assigned to all the vertices are unique.    \(\square \)

Now for any \(w \in V(Q_d^{\mathcal {O}})\), we define a binary string \(\zeta (w)\) of length \(2^d\) in the following the way:

  1. 1.

    First, give \(Q_d^{\mathcal {O}}\) the unique coordinate assignment \(\varPsi : V(Q_d^{\mathcal {O}}) \longrightarrow \{0,1\}^d\) with \(\varPsi (w) = 00\ldots 0\).

  2. 2.

    Now we define a total ordering \(\prec \) on \(V(Q_d^{\mathcal {O}})\) as: \(u \prec v\)

    where d(uw) is the distance of u from w. For example, when \(d=4\), the assigned coordinates of the vertices written in increasing order will be: \(\underbrace{0000}_\text {distance 0}\), \(\underbrace{1000, 0100, 0010, 0001}_\text {distance 1}\), \(\underbrace{1100, 1010, 1001, 0110, 0101, 0011}_\text {distance 2}\), \(\underbrace{1110, 1101, 1011, 0111}_\text {distance 3}\), \(\underbrace{1111}_\text {distance 4}\).

  3. 3.

    Finally, scan the vertices of the hypercube according to the above ordering. For each vertex, put a 0 if it is empty, or 1 if it is occupied by a robot. Recall that any vertex can be occupied by at most one robot. The string of length \(2^d\) thus obtained is \(\zeta (w)\). In the previous example, if the occupied vertices are 0000, 1000, 0010, 1001, 0011, 1011, 1111, then \(\zeta (w) = 1101000100100101\).

Lemma 3

For any two distinct vertices \(u,v \in V(Q_d^{\mathcal {O}})\), if \(\zeta (u) = \zeta (v)\), then the configuration has a partitive automorphism.

Proof

It can be easily seen that if \(\zeta (u) = \zeta (v)\), then the configuration has the automorphism (translation) given by \(x \mapsto x \oplus u \oplus v\).    \(\square \)

Theorem 9

LeadingWeberPoint is solvable in an oriented hypercube.

Proof

Since the configuration has no partitive automorphism, \(\zeta (w_1) \ne \zeta (w_2)\) for any distinct \(w_1, w_2 \in \mathcal {W}\). Hence the robots can unanimously elect \(w \in \mathcal {W}\) with the lexicographically (strictly) largest \(\zeta (w)\) as the leading Weber point.    \(\square \)

3 The Algorithm

Our plan is to solve the problem in two stages. In stage 1, we create a multiplicity at a Weber point and then in stage 2, we sequentially bring the remaining robots to that vertex. Before describing the algorithm, we first give two definitions.

Anchor: Let \((Q_d^{\mathcal {O}},\tilde{f})\) be a non-final perceived configuration on an oriented hypercube with at most one multiplicity and no partitive automorphism. The anchor of \((Q_d^{\mathcal {O}},\tilde{f})\) is a vertex \(\alpha \in V(Q_d^{\mathcal {O}})\) defined as the following. If \((Q_d^{\mathcal {O}},\tilde{f})\) has no multiplicity, then \(\alpha \) is the leading Weber point; otherwise \(\alpha \) is the unique vertex with multiplicity. Note that all the robots observing the configuration \((Q_d^{\mathcal {O}},\tilde{f})\) agree on which vertex is the anchor.

Leader: Since all the robots observing the configuration \((Q_d^{\mathcal {O}},\tilde{f})\) agree on the anchor \(\alpha \), they also agree on a common coordinate system, which is the unique coordinate system \(\varPsi \) described in Lemma 2 with \(\varPsi (\alpha ) = 00\ldots 0\). This also allows the robots to order the vertices of the hypercube as described in the previous section. In this ordering, the first robot appearing on a non-anchor vertex will be called the leader.

3.1 2k + 1 (k > 0) Robots

Theorem 10

Any configuration on a hypercube with odd number of robots has exactly one Weber point.

Proof

Using the same notations as in Theorem 6, the set of Weber points is given by \(\mathcal {W} = [b]_1 \times [b]_2 \times \ldots \times [b]_d\). Since there are odd number of robots, the multiset \(\{ b_{1j}, b_{2j}, \ldots , b_{nj} \}\) can never have equal number of 0’s and 1’s. Hence, \([b]_j = \{0\}\) or \(\{1\}\), \(\forall j \in \{1, \ldots , d\}\). Thus \(|\mathcal {W}| = 1\).    \(\square \)

Theorem 11

Gathering in \(Q_d^{\mathcal {O}}\) is optimally solvable in ASYNC with weak multiplicity detection for any configuration of odd number of robots.

Proof

We simply ask only the leader to move towards the anchor. The anchor \(\alpha \) is the unique Weber point of the configuration. As the leader moves towards it, the Weber point remains invariant by Theorem 5. After one or two robots reach \(\alpha \), a multiplicity is created at \(\alpha \). Throughout stage 2, \(\alpha \) remains the unique multiplicity in the configuration, since only the leader moves. Thus, all the remaining robots will sequentially reach \(\alpha \). The algorithm is clearly optimal with respect to the total number of moves executed by the robots.    \(\square \)

3.2 4k (k > 0) Robots

In view of Theorems 2, 3 and Lemma 1, any configuration with non-trivial automorphism group is ungatherable. We show that for all the remaining configurations, gathering can be optimally solved. Again our strategy is to move the leader towards the anchor. However, in this case the leader has to judiciously choose the edge via which it should approach the anchor. Unlike the previous case, the anchor may change after a move.

Consider the first stage of the algorithm, when there is no multiplicity in the configuration. Then the anchor is the leading Weber point \(w_\ell \). We classify all the non-anchor vertices into two types: type 1 and type 2. If the configuration has \(2^m\) (\(0 \le m \le d\)) Weber points, then among the d neighbors of \(w_\ell \), m are also Weber points. This is because of Lemma 3. Let us call these Weber points \(w_1, \ldots , w_m\). Since the coordinates assigned to \(w_\ell \) are \(0\ldots 0\), the coordinates of each \(w_i \in \{w_1, \ldots , w_m\}\) have exactly one 1. For each \(w_i\), assume that its assigned coordinates have the 1 at the \(p_i\)th place, which implies that the edge joining \(w_i\) and \(w_\ell \) has label \(p_i\). Also, the set of Weber points, in the assigned coordinates, is given by \(\mathcal {W} = [b]_1 \times [b]_2 \times \ldots \times [b]_d\), where \([b]_l\) is \(\{0,1\}\) if \(l \in \{p_1, \ldots , p_m\}\), and \(\{0\}\) otherwise.

Type 1 Vertex: A non-anchor vertex v will be called a type 1 vertex if the following holds: there is at least one \(p_i \in \{p_1 \ldots p_m \}\) such that the assigned coordinates of v have 1 at \(p_i\)th place. Also the edge incident to v with label \(p_i\) will be called a type 1 edge.

Type 2 Vertex: If a non-anchor vertex v is not type 1, then it will be called a type 2 vertex. This implies that the \(p_1\)th, \(\ldots p_m\)th terms of the assigned coordinates of v are 0. Note that if the configuration has only one Weber point, i.e., \(m = 0\), then all non-anchor vertices are vacuously type 2.

figure a

Theorem 12

Let \((Q_d^{\mathcal {O}},f)\) be a configuration of 4k \((k > 0)\) robots with no multiplicities and no partitive automorphisms. Let \(w_\ell \) be the leading Weber point, and hence the anchor. Assume that the leader r is placed at a type 1 vertex u. Suppose that it moves via a type 1 edge with label \(p_i\) to an empty vertex v, and gives rise to configuration \((Q_d^{\mathcal {O}},f')\). Then the following holds.

  1. 1.

    \(w_\ell \in \mathcal {W}_{f'}\)

  2. 2.

    If \(|\mathcal {W}_{f}| = 2^m (m > 0),\) then \(|\mathcal {W}_{f'}| = 2^{m-1}\)

  3. 3.

    \((Q_d^{\mathcal {O}},f')\) has no partitive automorphism.

Proof

  1. (1)

    Assume that r moves via a type 1 edge with label \(p_i\). Then the assigned coordinates of u and v differ in exactly one bit at the \(p_i\)th position. At the \(p_i\)th place, u has 1, while v has 0. Then v has less 1’s than u, and hence v is closer to \(w_\ell \) than u, i.e., r has moved towards \(w_\ell \). Hence, by Lemma 5, \(w_\ell \in \mathcal {W}_{f'}\).

  2. (2)

    It is easy to see that, as r moves from u to v, (i) its distance from all Weber points whose coordinates have 1 at \(p_i\)th place (there are \(2^{m-1}\) of them), increases by one, and (ii) its distance from all Weber points whose coordinates have 0 at \(p_i\)th place, decreases by one. Hence the move reduces the set of Weber points by half.

  3. (3)

    If possible, assume that \((Q_d^{\mathcal {O}},f')\) admits a partitive automorphism, i.e., a non-trivial translation \(\tau \). Assume that the translation, in the assigned coordinate system, is given by \(x \mapsto x \oplus a\), for some \(a \in \{0,1\}^d\). Let \(\mathcal {R}\) and \(\mathcal {R'}\) be the set of vertices occupied by robots in \((Q_d^{\mathcal {O}},f)\) and \((Q_d^{\mathcal {O}},f')\) respectively. Since \(\tau \) maps any vertex of \(\mathcal {R'}\) to another vertex of \(\mathcal {R'}\), the group \({<}\tau {>}\) induces an equivalence relation on \(\mathcal {R'}\), partitioning it into 2k disjoint sets of cardinality 2: \(\mathcal {R'} = \bigcup \limits _{j=1}^{2k} \{x_j, \tau (x_j)\}\). Let \(\mathcal {R}_{p_i}\) and \(\mathcal {R'}_{p_i}\) be the multiset containing the \(p_i\)th terms of the assigned coordinates of vertices of \(\mathcal {R}\) and \(\mathcal {R'}\) respectively. Clearly \(\mathcal {R}_{p_i}\) contains 2k number of 0’s and 2k number of 1’s. In \(\mathcal {R}_{p_i}'\), we have \(2k + 1\) number of 0’s and \(2k - 1\) number of 1’s.

  • Case 1: Let the \(p_i\)th term of a be 0. Hence, if \(p_i\)th term of x is \(b \in \{0,1\}\), then the \(p_i\)th term of \(\tau (x) = x \oplus a\) is also b. This implies that \(\mathcal {R'}_{p_i}\) has even number of 0’s and 1’s. This is a contradiction, as we have shown that number of 0’s and 1’s in \(\mathcal {R'}_{p_i}\) is \(2k + 1\) and \(2k - 1\) respectively.

  • Case 2: Let the \(p_i\)th term of a be 1. So, if \(p_i\)th term of x is \(b \in \{0,1\}\), then the \(p_i\)th term of \(\tau (x) = x \oplus a\) is \(\overline{b}\). This implies that \(\mathcal {R'}_{p_i}\) has equal number of 0’s and 1’s. This is again a contradiction.   \(\square \)

Theorem 13

Let \((Q_d^{\mathcal {O}},f)\) be a configuration of 4k \((k > 0)\) robots with no multiplicities and no partitive automorphisms. Let \(w_\ell \) be the leading Weber point, and hence the anchor. Suppose that the leader r is placed at a type 2 vertex u. If it moves towards \(w_\ell \) to an empty vertex, then

  1. 1.

    the new configuration \((Q_d^{\mathcal {O}},f')\) has no partitive automorphism

  2. 2.

    \(\mathcal {W}_{f} = \mathcal {W}_{f'}\)

  3. 3.

    \(w_\ell \) is the leading Weber point of \((Q_d^{\mathcal {O}},f')\)

  4. 4.

    r is the leader in \((Q_d^{\mathcal {O}},f')\).

Proof

We use the same notations as in the proof of the previous theorem. For each \(w \in \mathcal {W}_{f}{\setminus }\{w_\ell \}\) the following holds: (i) among the \(p_1\)th, \(\ldots , p_m\)th terms of the assigned coordinates, there is at least one 1, (ii) all the terms except the \(p_1\)th, \(\ldots , p_m\)th ones are 0. Exactly the opposite is true for the type 2 vertex u. It implies that the distance of r from \(w_\ell \) is strictly less than its distance from any other Weber point in \(\mathcal {W}_{f}){\setminus }\{w_\ell \}\). Also, after the move, its distances from all Weber points reduce by exactly 1. Hence, after the move, \(\zeta (w_\ell )\) remains lexicographically strictly largest among \(\{\zeta (w) \mid w \in \mathcal {W}_{f'}\}\). All the statements of the theorem easily follow from these observations.    \(\square \)

Lemma 4

Let \(G = (V,E)\) be an arbitrary graph. Let \(\mathcal {P} = v_0 e_0 v_1 e_1 v_2 \ldots v_{l-1} e_{l-1}v_l\) be a path from \(v_0\) to \(v_l\). Suppose that for any \(e_j\), a move through it by a robot from \(v_j\) to \(v_{j+1}\) reduces its distance from \(v_l\) by 1. Then \(\mathcal {P}\) is a shortest path from \(v_0\) to \(v_l\) in G.

Lemma 5

Suppose that a robot moves from a vertex u to an adjacent vertex v in a hypercube \(Q_d\). Then for any \(w \in V(Q_d)\), either its distance from w reduces by 1 or increases by 1, i.e., its distance from w does not remain unchanged.

Theorem 14

Algorithm 1 achieves optimal gathering in ASYNC, for all asymmetric configurations of 4k \((k > 0)\) robots with weak multiplicity detection.

Proof

By Theorems 12 and 13, no move in the first stage creates a partitive automorphism. Since at any time, only the leader is allowed to move, a multiplicity can only be created at the anchor. Since throughout stage 2, there is a unique multiplicity, a configuration with a partitive automorphism is never created. Notice that in both stages, an anchor is always a Weber point. Hence, the robots always move towards some Weber point. So, after each move, the centrality of the surviving set of Weber points is reduced by 1. Therefore, eventually the centrality of one Weber point becomes 0, which implies that gathering is accomplished.

It remains to prove that Algorithm 1 is optimal with respect to the total number of moves executed by the robots. Suppose that the algorithm gathers all the robots at w, which was a Weber point of the initial configuration. In view of Theorem 12, it is sufficient to show that every movement executed by any robot is towards w. Since every movement executed by a robot is towards some Weber point, according to Theorem 5, the set of Weber points of the configurations starting from the initial to the final configuration form the following nested series: \(\mathcal {W}_0 \supseteq \mathcal {W}_1 \supseteq \ldots \supseteq \mathcal {W}_{final} = \{w\}\). In other words, w remains a Weber point throughout the progress of the algorithm. If at some step, a move by a robot is not towards w, then by Theorem 13, it moves away from w. Then the centrality of w is increased by 1, while the centrality of some other Weber point is decreases by 1. This means that w does not remain a Weber point after the move. This is a contradiction.    \(\square \)

4 Concluding Remarks

This is the first paper that investigates the gathering problem on a hypercube graph. We have provided a complete characterization of all gatherable configurations in ASYNC for \(2k + 1\) and 4k \((k > 0)\) number of robots with weak multiplicity detection in an oriented hypercube. This leaves unsettled only the configurations with \(4k + 2\) \((k > 0)\) number of robots. Note that our strategy for 4k robots does not work for \(4k + 2\) robots. To see this, consider a configuration in \(Q_9\) of 10 robots placed on the following vertices: 000000000, 110111000, 101111000, 011111000, 000111000, 001000111, 010000111, 100000111, 111000111, 111000000. Here, the anchor, i.e., the leading Weber point is 000000000 and the leader is 111000000. It can be seen that a move by the leader towards the anchor via any edge creates a configuration with a partitive automorphism. Another challenging direction of future research would be to study the problem with limited visibility. It would also be interesting to consider randomized algorithms to bypass the impossibility results.