Pushing Lines Helps: Efficient Universal Centralised Transformations for Programmable Matter
Abdullah Almethen, Othon Michail, Igor Potapov

TL;DR
This paper introduces a new model for shape transformation in programmable matter using line pushes, demonstrating that efficient, sub-quadratic universal transformations are achievable with centralized control.
Contribution
The paper presents the first efficient universal transformation algorithms for a new line-pushing model, improving from quadratic to near-linear time complexity.
Findings
Transforming a diagonal shape to a line can be done in O(n log n) time.
Universal transformations are possible in O(n log n) time, significantly faster than previous models.
The model generalizes existing local movement models, enabling more efficient shape reconfiguration.
Abstract
In this paper, we study a discrete system of entities residing on a two-dimensional square grid. Each entity is modelled as a node occupying a distinct cell of the grid. The set of all nodes forms initially a connected shape . Entities are equipped with a linear-strength pushing mechanism that can push a whole line of entities, from 1 to , in parallel in a single time-step. A target connected shape is also provided and the goal is to \emph{transform} into via a sequence of line movements. Existing models based on local movement of individual nodes, such as rotating or sliding a single node, can be shown to be special cases of the present model, therefore their (inefficient, ) \emph{universal transformations} carry over. Our main goal is to investigate whether the parallelism inherent in this new type of movement can be exploited for efficient, i.e.,…
| Transformation | Problem | Running Time | Lower Bound |
|---|---|---|---|
| DL-Partitioning | Diagonal | ||
| DL-Doubling | Diagonal | ||
| DL-Recursion | Diagonal | ||
| DLC-Folding | Diagonal Connected | ||
| DLC-Extending | Diagonal Connected | ||
| U-Box-Partitioning | Universal | ||
| U-Box-Doubling | Universal |
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Department of Computer Science, University of Liverpool, [email protected] Department of Computer Science, University of Liverpool, [email protected] Department of Computer Science, University of Liverpool, [email protected]\CopyrightAbdullah Almethen, Othon Michail and Igor Potapov\ccsdesc[100]General and reference General literature \ccsdesc[100]General and reference\supplement
Acknowledgements.
\EventEditors \EventNoEds2 \EventLongTitle \EventShortTitle \EventAcronym \EventYear \EventDate \EventLocation \EventLogo \SeriesVolume \ArticleNo
Pushing Lines Helps: Efficient Universal Centralised Transformations for Programmable Matter
Abdullah Almethen
Othon Michail
Igor Potapov
Abstract
In this paper, we study a discrete system of entities residing on a two-dimensional square grid. Each entity is modelled as a node occupying a distinct cell of the grid. The set of all nodes forms initially a connected shape . Entities are equipped with a linear-strength pushing mechanism that can push a whole line of entities, from 1 to , in parallel in a single time-step. A target connected shape is also provided and the goal is to transform into via a sequence of line movements. Existing models based on local movement of individual nodes, such as rotating or sliding a single node, can be shown to be special cases of the present model, therefore their (inefficient, ) universal transformations carry over. Our main goal is to investigate whether the parallelism inherent in this new type of movement can be exploited for efficient, i.e., sub-quadratic worst-case, transformations. As a first step towards this, we restrict attention solely to centralised transformations and leave the distributed case as a direction for future research. Our results are positive. By focusing on the apparently hard instance of transforming a diagonal into a straight line , we first obtain transformations of time without and with preserving the connectivity of the shape throughout the transformation. Then, we further improve by providing two -time transformations for this problem. By building upon these ideas, we first manage to develop an -time universal transformation. Our main result is then an -time universal transformation. We leave as an interesting open problem a suspected -time lower bound.
keywords:
Line movement, programmable matter, transformation, shape formation, reconfigurable robotics, time complexity
category:
1 Introduction
As a result of recent advances in components such as micro-sensors, electromechanical actuators, and micro-controllers, a number of interesting systems are now within reach. A prominent type of such systems concerns collections of small robotic entities. Each individual robot is equipped with a number of actuation/sensing/communication/computation components that provide it with some autonomy; for instance, the ability to move locally and to communicate with neighbouring robots. Still, individual local dynamics are uninteresting, and individual computations are restricted due to limited computational power, resources, and knowledge. What makes these systems interesting is the collective complexity of the population of devices. A number of fascinating recent developments in this direction have demonstrated the feasibility and potential of such collective robotic systems, where the scale can range from milli/micro [6, 26, 28, 36, 43] down to nano [20, 35].
This progress has motivated the parallel development of a theory of such systems. It has been already highlighted [32] that a formal theory (including modelling, algorithms, and computability/complexity) is necessary for further progress in systems. This is because theory can accurately predict the most promising designs, suggest new ways to optimise them, by identifying the crucial parameters and the interplay between them, and provide with those (centralised or distributed) algorithmic solutions that are best suited for each given design and task, coupled with provable guarantees on their performance. As a result, a number of sub-areas of theoretical computer science have emerged such as mobile and reconfigurable robotics [1, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 25, 29, 30, 37, 41, 42, 43], passively-mobile systems [3, 4, 31, 32] including the theory of DNA self-assembly [19, 34, 39, 40], and metamorphic systems [21, 22, 23, 33, 38]; connections are even evident with the theory of puzzles [5, 13, 27]. A latest ongoing effort is to join these theoretical forces and developments within the emerging area of “Algorithmic Foundations of Programmable Matter” [24]. Programmable matter refers to any type of matter that can algorithmically change its physical properties. “Algorithmically” means that the change (or transformation) is the result of executing an underlying program.
In this paper, we embark from the model studied in [21, 22, 23, 30], in which a number of spherical devices are given in the form of a (typically connected) shape lying on a two-dimensional square grid, and the goal is to transform into a desired target shape via a sequence of valid movements of individual devices. In those papers, the considered mechanisms were the ability to rotate and slide a device over neighbouring devices (always through empty space). We here consider an alternative (linear-strength) mechanism, by which a line of one or more devices can translate by one position in a single time-step.
As our main goal is to determine whether the new movement under consideration can in principle be exploited for sub-quadratic worst-case transformations, we naturally restrict our attention to centralised transformations. We generally allow the transformations to break connectivity, even though we also develop some connectivity-preserving transformations on the way. Our main result is a universal transformation of worst-case running time that is permitted to break connectivity. Distributed transformations and connectivity-preserving universal transformations are left as interesting future research directions.
1.1 Our Approach
In [30], it was proved that if the devices (called nodes from now on) are equipped only with a rotation mechanism, then the decision problem of transforming a connected shape into a connected shape is in , and a constructive characterisation of the (rich) class of pairs of shapes that are transformable to each other was given. In the case of combined availability of rotation and sliding, universality has been shown [21, 30], that is, any pair of connected shapes are transformable to each other. Still, in these and related models, where in any time step at most one node can move a single position in its local neighbourhood, it can be proved (see, for instance, [30]) that there will be pairs of shapes that require steps to be transformed to each other. This follows directly from the inherent “distance” between the two shapes and the fact that this distance can be reduced by only a constant in every time step. An immediate question is then “How can we come up with more efficient transformations?”
Two main alternatives have been explored in the literature in an attempt to answer this question. One is to consider parallel time, meaning that the transformation algorithm can move more than one node (up to a linear number of nodes if possible) in a single time step. This is particularly natural and fair for distributed transformations, as it allows all nodes to have their chances to take a movement in every given time-step. For example, such transformations based on pipelining [23, 30], where essentially the shape transforms by moving nodes in parallel around its perimeter, can be shown to require parallel time in the worst case and this technique has also been applied in systems (e.g., [36]).
The other approach is to consider more powerful actuation mechanisms, that have the potential to reduce the inherent distance faster than a constant per sequential time-step. These are typically mechanisms where the local actuation has strength higher than a constant. This is different than the above parallel-time transformations, in which local actuation can only move a single node one position in its local neighbourhood and the combined effect of many such movements at the same time is exploited. In contrast, in higher-strength mechanisms, it is a single actuation that has enough strength to move many nodes at the same time. Prominent examples in the literature are the linear-strength models of Aloupis et al. [1, 2], in which nodes are equipped with extend/contract arms, each having the strength to extend/contract the whole shape as a result of applying such an operation to one of its neighbours and of Woods et al. [40], in which a whole line of nodes can rotate around a single node (acting as a linear-strength rotating arm). The present paper follows this approach, by introducing and investigating a linear-strength model in which a node can push a line of consecutive nodes one position (towards an empty cell) in a single time-step.
In terms of transformability, our model can easily simulate the combined rotation and sliding mechanisms of [21, 30] by restricting movements to lines of length 1 (i.e., individual nodes). It follows that this model is also capable of universal transformations, with a time complexity at most twice the worst-case of those models, i.e., again . Naturally, our focus is set on exploring ways to exploit the parallelism inherent in moving lines of larger length in order to speed-up transformations and, if possible, to come up with a more efficient in the worst case universal transformation.
As reversibility of movements is still valid for any line movement in our model, we adopt the approach of transforming any given shape into a spanning line (vertical or horizontal). This is convenient, because if one shows that any shape can transform fast into a line , then any pair of shapes and can then be transformed fast to each other by first transforming fast into and then into by reversing the fast transformation of into .
We start this investigation by identifying the diagonal shape (which is considered connected in our model and is very similar to the staircase worst-case shape of [30]) as a potential worst-case initial shape to be transformed into a line . This intuition is supported by the individual node distance between the two shapes and by the initial unavailability of long lines: the transformation may move long lines whenever available, but has to pay first a number of movements of small lines in order to construct longer lines. In this benchmark (special) case, the trivial lower and upper bounds and , respectively, hold. Moreover, observe that a sequential gathering of the nodes starting from the top right and collecting the nodes one after the other into a snake-like line of increasing length is still quadratic, because, essentially, for each sub-trip from one collection to the next, the line has to make a “turn”, meaning to change both a row and a column, and in this model this costs a number of steps equal to the length of the line, that is, roughly, total time.
We first prove that by partitioning the diagonal into diagonal segments of length each, we can first transform each segment in time quadratic in its length into a straight line segment, then push all segments down to a “collection row” in time and finally re-orient all line segments to form a horizontal line in , paying a linear additive factor. Thus, this transformation takes total time , which constitutes our first improvement compared to the lower bound of [30]. We then take this algorithmic idea one step further, by developing two transformations building upon it, that can achieve the same time-bound while preserving connectivity throughout their course: one is based on folding segments and the other on extending them.
As the length of uniform partitioning into segments is optimal for the above type of transformation, we turn our attention into different approaches, aiming at further reducing the running time of transformations. Allowing once more to break connectivity, we develop an alternative transformation based on successive doubling. The partitioning is again uniform for individual “phases”, but different phases have different partitioning length. The transformation starts from a minimal partitioning into lines of length 2, then matches them to the closest neighbours via shortest paths to obtain a partitioning into lines of length , and, continuing in the same way for phases, it maintains the invariant of having individual lines in each phase , for . By proving that the cost of pairwise merging through shortest paths in each phase is linear in , we obtain that this approach transforms the diagonal into a line in time , thus yielding a substantial improvement. Observe that the problem of transforming the diagonal into a line seems to involve solving the same problem into smaller diagonal segments (in order to transform those into corresponding line segments). Then, one may naturally wonder whether a recursive approach could be applied in order to further reduce the running time. We provide a negative answer to this, for the special case of uniform recursion and at the same time obtain an alternative transformation for the diagonal-to-line problem.
Our final aim is on attempting to generalise the ideas developed for the above benchmark case in order to come up with equally efficient universal transformations. We successfully generalise both the and the approaches, obtaining universal transformations of worst-case running times and , respectively. We achieve this by enclosing the initial shape into a square bounding box and then subdividing the box into square sub-boxes of appropriate dimension. For the bound, a single such partitioning into sub-boxes of dimension turns out to be sufficient. For the bound we again employ a successive doubling approach through phases of an increasing dimension of the sub-boxes, that is, through a new partitioning in each phase. Therefore, our ultimate theorem (followed by a constructive proof, providing the claimed transformation) states that: “In this model, when connectivity need not necessarily be preserved during the transformation, any pair of connected shapes and can be transformed to each other in sequential time ”.
Table 1 summarises the running times of all the transformations developed in this paper.
Section 2 brings together all definitions and basic facts that are used throughout the paper. In Section 3, we study the problem of transforming a diagonal shape into a line, without and with connectivity preservation. Section 4 presents our universal transformations. In Section 5, we conclude and discuss further research directions that are opened by our work.
2 Preliminaries and Definitions
The transformations considered here run on a two-dimensional square grid. Each cell of the grid possesses a unique location addressed by non-negative coordinates , where denotes columns and indicates rows. A shape is a set of nodes on the grid, where each individual node occupies a single cell , therefore we may also refer to a node by the coordinates of the cell that it occupies at a given time. Two distinct nodes , are neighbours (or adjacent) iff and (i.e., their cells are adjacent vertically, horizontally or diagonally). A shape is connected iff the graph defined by and the above neighbouring relation on is connected. Throughout, denotes the number of nodes in a shape under consideration.
A line, , is defined by one or more consecutive nodes in a column or row. That is, , for , is a line iff and , or and . A line move, is an operation by which all nodes of a line move together in a single step, towards an empty cell adjacent to one of ’s endpoints. A line move may also be referred to as step (or move or movement) and time is discrete and measured in number of steps throughout. A move in this model is equivalent to choosing a node and a direction and moving one position in direction . This will additionally push by one position the whole line of nodes in direction , (possibly empty) starting from a neighbour of in and ending at the first empty cell. More formally and in slightly different terms: A line of length , where , can push all nodes rightwards in a single step to positions iff there exists an empty cell to the right of at . The “down”, “left”, and “up” movements are defined symmetrically, by rotating the whole system 90°, 180°, and 270° clockwise, respectively.
Definition 2.1** (A permissible line move).**
Let be a line of nodes, where . Then, can move as follows (depending on its original orientation, i.e. horizontal or vertical):
Horizontal.* Can push all nodes rightwards in a single step from to positions iff there exists an empty cell to the right of at . Similarly, it can push all nodes to the left to occupy , iff there exists an empty cell at .* 2. 2.
Vertical.* Can push all nodes upwards in a single step from into , iff there exists an empty cell above at . Similarly, it can push all nodes down to occupy , iff there exists an empty cell below at .*
The following definitions from [30] shall be useful for our study. Let us first agree that we colour black any cell occupied by a node (as in Figure 1).
Definition 2.2**.**
A hole is a set of empty cells that are unoccupied and enclosed by nodes , where , such that every infinite spanning single path starting from the hole and moving, only vertically and horizontally, certainly passes through a black cell of a node .
Definition 2.3**.**
A compact shape contains all cells of and the hole , such that has no holes, . For instance, the black and grey cells in Figure 1 are forming a connected compact shape .
Definition 2.4**.**
A perimeter (border) of is defined as a polygon of unit length line segments, which surrounds the minimum-area of the interior of , such as the blue line in Figure 1.
Definition 2.5**.**
A surrounded layer of is consisting of cells that are not occupied by nodes of and contribute to the perimeter by at least one of its sides or corners (e,g the red cells in Figure 1). Normally, each cell in a 2D grid owns four line-segment sides and four corners.
Definition 2.6**.**
The external surface of is another shape , which includes all cells occupied by nodes of and adjacent to the perimeter vertically or horizontally. The external surface of is also a connected shape itself, and that is proved in [30].
Proposition 2.7**.**
The surrounded layer of any connected shape is always another connected shape.
Proof 2.8**.**
It follows from [30]. Since is connected, then the perimeter of is connected too, and hence, forms a cycle. Each segment of the perimeter is contributed by two cells, belonging to the external surface and the surrounded layer. Now, if one walks on the perimeter (vertically or horizontally) or turns (left or right) clockwise or anticlockwise at any segment, one of the following cases will occur: {bracketenumerate}
Pass through two adjacent vertical or horizontal cells on the surrounded layer and the external surface of .
Stay put at the same position (cell) on the external surface and move through three neighbouring cells connected perpendicularly on the surrounded layer of .
Stay put at the same position (cell) on the surrounded layer and pass through three neighbouring cells connected perpendicularly on the external surface of .
Stay put at the same position (cell) on the surrounded layer and pass through two neighbouring cells connected diagonally on the external surface of and one cell of the surrounded layer. Subsequently, all cases above preserve connectedness of the surrounded layer and the external surface of .
As already mentioned, we know that there are related settings in which any pair of connected shapes and of the same order (“order” of a shape meaning the number of nodes of throughout the paper) can be transformed to each other111We also use to denote that shape can be transformed to shape . while preserving the connectivity throughout the course of the transformation.222In this paper, whenever transforming into a target shape , we allow any placement of on the grid, i.e., any shape obtained from through a sequence of rotations and translations. This, for example, has been proved for the case in which the available movements to the nodes are rotation and sliding [21, 30]. We now show that the model of [21, 30] is a special case of our modeld, including universal transformations, are also valid transformations in the present model.
Proposition 2.9**.**
The rotation and sliding model of [21, 30] is a special case of the present model.
Proof 2.10**.**
We establish a technique to prove that our model is capable of simulating rotation and sliding models of a two-dimension square grid appeared in [21, 30]. First, the sliding operation is equivalent in all those models, that is, if a node is located at a cell of the grid, , then can slid right to any empty cell at over a horizontal line of length 2, such as in Figure 2 (a). The “down”, “left”, and “up” movements are defined symmetrically, by rotating the whole system 90°, 180°, and 270° clockwise, respectively. By Definition 2.1, our model is exploited sliding rule to push a line of 1 node into an adjacent empty cell, whether vertically or horizontally. For rotation, all mentioned models perform a single operation to rotate a node around another by a clockwise iff there exits two empty cells at and , see Figure 2(b). Analogously, this holds for all possible rotations by again rotating the whole system 90°, 180°, and 270° clockwise, respectively. Still, the rotation mechanism is also adopted by this model following Definition 2.1, and actually it costs twice for a single rotation to take place, compared with others. Subsequently, it implies that all transformations established there (with their running time at most doubled, including universal transformations, are also valid transformations in the present model).
Consider a line of nodes occupying and empty cells at for all , where . Now, we aim to transfer all nodes to the right to fill in all empty cells. As usual, any transformation of a single motion would move all nodes in a total of moves, since each transfers a distance of . On the contrary, the nodes move altogether in parallel distance to occupy the empty cells in a total of steps, by exploiting the linear-strength of this model. Now, we are ready to show a more beneficial property in the following lemma:
Lemma 2.11**.**
The minimum number of line moves by which a line of length , , can completely change its orientation333From vertical to horizontal and vice versa., is .
Proof 2.12**.**
Assume a 2D square grid contains only a line of nodes at for all , where , and empty cells on , as depicted in Figure 3. Now, the first bottommost node, , moves one step right to occupy an empty cell on . Consequently, a new empty cell is created at , and the length of decreases by . By the linear-strength, pushes all nodes down altogether in parallel in a single-time-move to occupy . Hence, two line steps have been performed to move and push down all nodes. Therefore, it implies that each of requires two steps to transfer into the bottommost row, . Thus, we conclude that any line of length ( nodes) requires at most twice of its length, , to change its orientation, which is bounded above by .
For the matching lower bound consider w.l.o.g. a horizontal line. A complete change of orientation requires the nodes of the line to occupy consecutive rows (from just one originally). The bound follows by observing that in any two consecutive steps, at most one new row can become occupied.
A property that typically facilitates the development of universal transformations, is reversibility of movements. To this end, we next show that line movements are reversible.
Lemma 2.13** (Reversibility).**
Let be a pair of connected shapes of the same number of nodes . If (“” denoting “can be transformed to via a sequence of line movements”) then .
Proof 2.14**.**
First, we should prove that each single line step is reversible. Figure 4 (a) shows a simple connected shape of four nodes forming two horizontal and one vertical lines at , and , respectively. Assume this configuration has no more space to the left, beyond the dashed line; therefore, moves one step to occupy the empty cell . Now, all nodes are moving altogether to fill in positions and , as depicted in Figure 4 (b). Consequently, the previous line step creates another empty cell at , which then gives the ability to to move back reversibly to fill in this new empty cell on the left. Thus, we conclude that any single line step is reversible, which implies that any finite sequence of line steps are reversible too.
Still, reversibility is valid for any line movement in our model by transforming any given shape into a line (vertical or horizontal). This is sufficient because if any shape transforms into a line , then any pair of shapes and can then be transformed to each other, via an intermediate connected shape , by first transforming into and then to , by reversing the transformation of to .
2.1 Nice shapes
A family of shapes, denoted , is introduced in this study to probably act as efficient intermediate shapes of the transformation. A nice shape is, informally, any connected shape that contains a particular line called the central line (denoted ). Intuitively, one may think of as a supporting (say horizontal) base of the shape, where each node not on must be connected to through a vertical line.
Definition 2.15** (Nice Shape).**
A connected shape if there exists a central line , such that every node is connected to via a line perpendicular to (Figure 5 shows some examples of a nice shape and non nice shapes).
By reversibility (Lemma 2.13), a nice shape is exploited as an intermediate shape that simplifies the universal transformations. The following proposition shows that:
Proposition 2.16**.**
Let be a nice shape and a straight line, both of the same order . Then (and ) in steps.
Proof 2.17**.**
By Definition 2.15, any of nodes must have a central line of nodes, , where other nodes are connecting to via a line. By Lemma 2.11, each of the nodes requires at most two line steps to be included into in a maximum total of steps for all . Then, requires at most steps to transform into . As a consequence, the connected pair of shapes of the same order are transformable to each other by Lemma 2.13, in steps.
2.2 Problem Definitions
We now formally define the problems to be considered in this paper.
DiagonalToLine**.** Given an initial connected diagonal line and a target vertical or horizontal connected spanning line of the same order, transform into , without necessarily preserving the connectivity during the transformation.
DiagonalToLineConnected**.** Restricted version of DiagonalToLine in which connectivity must be preserved during the transformation.
UniversalTransformation**.** Give a general transformation, such that, for all pairs of shapes of the same order, where is the initial shape and the target shape, it will transform into , without necessarily preserving connectivity during its course.
3 Transforming the Diagonal into a Line
We begin our study from the case in which the initial shape is a diagonal line of order . Our goal throughout the section is to transform into a spanning line , i.e.,f= solve the DiagonalToLine and/or DiagonalToLineConnected problems. We do this, because these problems seem to capture the worst-case complexity of transformations in this model.
Consider a of nodes occupying , such as the diagonal line of 6 nodes depicted in Figure 5 (c). Observe that the diagonal comprises some special properties which cannot be found in other connected shapes, that is, each single node of enjoys a unique - and - axis, in other words . Below, we give three -time strategies to transform the diagonal into a line. In Section 3.1, the algorithm allows the shape to break its connectivity throughout transformation, whilst connectedness is preserved in Sections 3.2 and 3.3.
3.1 An -time Transformation
We start from DiagonalToLine (i.e., no requirement to preserve connectivity). Our strategy is as follows. We divide the diagonal into several segments, as in Figure 6 (a). Then in each segment, we perform a trivial (inefficient, but enough for our purposes) line formation by moving each node independently to the leftmost column in that segment (Figure 6 (b)). Therefore, all segments are transformed into lines (Figure 6 (c)). Then, we transfer each line segment all the way down to the bottommost row of the diagonal (Figure 6 (d)). Finally, we change the orientation of all line segments to form the target spanning line (Figure 6 (e)).
More formally, let be a diagonal, occupying , such that and are the leftmost column and the bottommost row of , respectively. is divided into segments, , each of length , apart possibly from a single smaller one. Figure 6 (a) illustrates the case of integer and in what follows, w.l.o.g., we present this case for simplicity. This strategy (called DL-Partitioning) consists of three phases:
- •
Phase 1: Transforms each diagonal segment into a line segment. Notice that segment , , contains nodes occupying positions , for ; see Figure 6 (b). Each of these nodes moves independently to the leftmost column of , namely column , and the new positions of the nodes become . By the end of Phase 1, vertical line segments have been created (Figure 6 (c)).
- •
Phase 2: Transfers all line segments from Phase 1 down to the bottommost row of the diagonal . Observe that line segment has to move distance (see Figure 6 (d)).
- •
Phase 3: Turns all line segments into the bottommost row (Figure 6 (e)). In particular, line will be occupying positions .
Now, we are ready to analyse the running time of all phases of DL-Partitioning.
Theorem 3.1**.**
Given an initial diagonal of nodes, DL-Partitioning solves the DiagonalToLine problem in steps.
Proof 3.2**.**
From the above reasoning, the proof follows by analysing all phases of DL-Partitioning. In the first phase, the cost of the trivial line formation is the run of all distances for nodes to be gathered at the leftmost column of a single segment for all , where . Observe that in Figure 6 (b), the nodes of have to move distances of . Therefore, the total run of all distances in (except the bottommost node which stays still in place), is:
[TABLE]
From (1), the total run for all segments is given by:
[TABLE]
Next, in phase 2, all line segments transfer down into the bottommost of the diagonal except the one already there. As mentioned above, any line segment has to transfer a distance of to reach the bottommost row in a total as follows:
[TABLE]
The last phase is basically to turn (re-orientate) every line segments of nodes into the bottommost row of length . Now, each line segment contributes a single node at the bottommost row , therefore, we have nodes are sitting on row , and the other nodes are waiting to be pushed (turned) into the bottommost row of length , in order to form the goal spanning line. By Lemma 4.7 and 2.11, the transformation starts re-orientating each towards the bottommost row , until it is being completely filled in by nodes of all segments. Recall that turning each node of the into the bottommost row costs two line steps, therefore, the total for all is:
[TABLE]
Altogether, the sum of (2), (3) and (4) gives the total cost , in steps, for all phases,
[TABLE]
3.2 Preserving Connectivity through Folding
In this section, our purpose is to transom the diagonal into a line by exploiting the line mechanism, with preserving connectivity of the shape throughout transformations. This strategy, called DLC-Folding, is as follows; we partition into several segments of the same lengths, as we did previously in DL-Partitioning (see Figure 6 (a)). Then, in each segment, we perform three operations: turn, push and turn. From the topmost segment of , form a line segment by a trivial brute-force line formation, that is, move each node to the bottommost row in that segment. After that, push the line segment towards the leftmost column of by a distance of . Lastly, we fold this line segment diagonally to align above the next following diagonal segment, therefore two parallel diagonal segments are formed, as illustrated in Figure 7. The strategy keeps folding segments above each other in this way, until finishing at the bottommost segment of . In the end, transforms into a nice shape, which is trivially converted into a line. Figures 8, 9, 10, 11 and 12 demonstrate the above transformations on a diagonal of 25 nodes.
3.2.1 Formal Description
Let be a diagonal of nodes occupying , such that and are the leftmost column and the bottommost row of , respectively. is then divided into segments, , each of which has a length of , where and are the topmost and bottommost segments of , respectively. Observe that segment , , consists of nodes occupying , where and , for . Here, has a base point , which is the bottommost node of . Moreover, DLC-Folding completes its course in phases, in each phase , we apply three operations (turn, push and turn) to fold the corresponding segment(s) around the base point . The first segment folds around in the first phase as follows (due to symmetry, it is sufficient to demonstrate one orientation): {alphaenumerate}
turn. Moves all nodes into the bottommost row of (brute-force line formation). Notice that the nodes change their positions from into . By the fist operation, a horizontal line segment of length have been formed, and the base point keeps place at .
push. Pushes the line segment steps towards the leftmost column of the diagonal , i.e., the column. All nodes of transfer altogether into .
turn. Converts the line segment into diagonal again by moving its nodes down to align above the nodes of the next following diagonal segment . This takes place by transferring them into positions , (except the bottommost node-base point which stays still in place at ()). By the end of this phase, two parallel diagonal segments and have been created, as in Figure 7.
The two parallel segments and are consisting of nodes and comprising of vertical lines. Consequently, a new connected shape has been formed and is defined below.
Definition 3.3**.**
*A is a connected shape of nodes consisting of two parts, and . For a given phase , where , we have , where and are connected via a base point , such that:
*- , is a diagonal line containing nodes occupying , such that and are the leftmost column and the bottommost row of , respectively, where . is connected to via its topmost node at .
- , is parallelogram consists of parallel diagonal segments of size nodes formed lines. is connected to via its bottommost node at , as depicted in Figure 13.
Throughout this section, we prove that at any phase of DLC-Folding, there are parallel (diagonal) segments containing nodes and forming vertical lines. We now prove that the three operations (turn, push and turn) transforms into a by the end of the first phase of DLC-Folding.
Lemma 3.4**.**
Let be a diagonal of order partitioned into segments . DLC-Folding converts into a by the end of the first phase.
Proof 3.5**.**
Consider a diagonal of nodes as defined previously, which is partitioned into segments of length each. Now, perform the three operations (turn, push and turn) described above on the topmost segment of (it is sufficient due to symmetry), we will obtain a connected shape consists of two parts, a diagonal line whose nodes occupy and two parallel diagonal segments of nodes. Both are connected via the base point , which is the topmost node of the diagonal part and the bottommost of the two parallel diagonal segments. As a result, a one can easily find out that the new shape constructed by the end of the first phase meets all conditions mentioned in Definition 3.3, therefore, it is a .
The following lemma shows that the three operations of DLC-Folding hold in any phase , where , such that in phase , the size of increases by , and conversely the length decreases by .
Lemma 3.6**.**
Consider a of nodes in phase , where . Then, in phase , DLC-Folding increases the size of by and decreases the length of by .
Proof 3.7**.**
The size of the must be the same each phase and all time over transformations. In phase , a consists of two parts, and , where both are connected via a common node (see Definition 3.3). Now, perform the three operations (turn, push and turn) on the part that contains segments of length aligned diagonally on top of each other. Let assume that the segments form vertical lines since the same argument applies symmetrically to a different orientation. First, we move all vertical lines downwards to the bottommost row of , which shall form horizontal lines by completely filling in the bottom rows of . Therefore, those horizontal lines create a rectangle, as depicted in Figure 14 (a). Then, the second operation pushes the vertical lines of the rectangle steps horizontally towards the leftmost column of the , as in Figure 14 (b). Lastly, the strategy completes folding by translating the vertical lines downwards, until each of them stays above a node of the next following segment (notice that every vertical line is moved except the rightmost one), see Figure 14 (c). By the end of phase , a new has been created, which is consisting of and connected via the common base point at . Hence, we conclude that in phase , the size of increased by nodes, while the length of decreased by , and this holds trivially and inductively for any phase , where .
Now, we prove that DLC-Folding transforms into a nice shape in phases.
Lemma 3.8**.**
Given a diagonal of order partitioned into segments, DLC-Folding converts into a nice shape in phases.
Proof 3.9**.**
By following Lemma 3.4, converts into a which consists of two parts and . Then, by Lemma 3.6, through the final phase , all segments are being folded diagonally over each other, therefore the diagonal part of the will be exhausted , whilst the parallelogram part acquires all nodes, . The resulting shape of vertical (horizontal) lines at the end of the final phase is no longer and complies perfectly with all standards and properties of nice shapes, see Definition 2.15; as a result, it is a nice shape.
At this point, we are ready to analyse the running time of DLC-Folding that preserves connectivity over its course.
Lemma 3.10**.**
Given a diagonal of order partitioned into segments, DLC-Folding folds the topmost (bottommost) segment in steps.
Proof 3.11**.**
In the first phase, we perform turn, push and turn on the first topmost (bottommost) segment of of length . The first operation (turn) is a brute-force line formation that is trivially computed by:
[TABLE]
Then, the second operation pushes a line of length in line steps. Again, the last operation costs as much as the first turn, namely . Altogether, the total cost required to fold the first segment thoroughly is at most:
[TABLE]
Lemma 3.12**.**
By the end of phase , for all , DLC-Folding folds in steps.
Proof 3.13**.**
In phase , holds two parts, and . In the first operation of DLC-Folding, by exploiting the linear mechanisms, all lines of translate in a distance equals to (5), namely . Now, the lines have moved and formed another lines in a different orientation. Therefore, in the second operation, we push those lines steps in a total of:
[TABLE]
And the third move is completing the process by (folding) the lines diagonally above the next segment, with the same cost of (5):
[TABLE]
With this, by summing (5) , (6) and (7), the total steps performed by the end of phase is given by:
[TABLE]
This holds trivially from phase 2 and inductively for every phase , for all .
Altogether, Proposition 2.16 and Lemmas 3.10 and 3.12, the running time of DLC-Folding is,
Theorem 3.14**.**
Given an initial connected diagonal of nodes, DLC-Folding solves the DiagonalToLineConnected problem in steps.
Proof 3.15**.**
By Lemma 3.10, DLC-Folding creates a in a total of:
[TABLE]
Now, Lemma 3.12 provides the running time of phase , for all , therefore the total run for all phases is computed by (except the first phase):
[TABLE]
Then, the total cost for all phases of DLC-Folding is given by summing (9) and (10) :
[TABLE]
Finally, the resulting shape of DLC-Folding is a nice shape, which transforms into a line in steps(see Proposition 2.16), then the total cost required to transform into , is bounded above by:
[TABLE]
3.3 Preserving Connectivity through Extending
The current transformation, called DLC-Extending, is another strategy to transform the diagonal into a line in steps, with preserving connectivity throughout transformations. As mentioned earlier, is partitioned into segments of length each. The implementation of this strategy lasts for phases equal to the number of segments. In each phase, we perform two types of movements, and . Generally speaking, DLC-Extending starts building the spanning line by first performing a line formation on the topmost (bottommost) diagonal segment of ; after that, convert the rest of the diagonal segments into lines and include them to the main spanning line, sequentially one after the other. Notice that DLC-Extending extends the main spanning line gradually every phase by a length of . Figure 15 shows the performance of DLC-Extending on a diagonal of 25 nodes.
3.3.1 Formal Description
Consider an initial diagonal of nodes defined and partitioned as in Section 3.2.1. In phase , for all , we perform two line operations, turn and push, on a diagonal segment of length nodes. Assume occupies , where and , for . Here, the bottommost node is the base point of . Due to symmetry, we only show transformations starting vertically from the topmost segment of . In the first phase, DLC-Extending forms a line at the topmost segment , by performing a brute-force line formation to transfer all nodes into the leftmost column of . Consequently, all nodes move from into . Secondly, it pushes this line segment steps towards the bottommost row of to occupy . By the end of the first phase, DLC-Extending shall construct a spanning line of length . For example, Figure 16 demonstrates the two operations (turn and push) of the first phase.
In the second phase, DLC-Extending turns into a line by sending all nodes towards its bottommost row(in a sequential order). Observe that and are now connected perpendicularly via (Figure 17), which then provides the ability to push into a distance of vertically towards the leftmost column of . By the end of this phase, the length of the spanning line is extended by . As a result, we have obtained a specific connected shape, called and defined as follows;
Definition 3.16**.**
*A is a connected shape of consisting of two parts, and . Both are connected via a common intersection point . Figure 18 shows an example of in phase for all , such that , where
{alphaenumerate}*
*- , is a diagonal line containing nodes and occupying , such that and are the leftmost column and the bottommost row of , respectively, where .
- , is a horizontal or vertical line of length nodes occupying or , respectively, where and .
We turn now to prove correctness of DLC-Extending. First, we show that the first and second phase converts a diagonal into a .
Lemma 3.17**.**
Let be a diagonal of order partitioned into segments . By the end of the second phase, DLC-Extending converts into a .
Proof 3.18**.**
By performing the above two main operations (turn and push) on the two topmost segments, and , respectively, we shall acquire a connected shape of two parts: 1) A diagonal at , where and , and 2) A horizontal or vertical line of length occupying or , respectively. Observe that the two parts will have the same common intersection point at in all cases. Therefore, the resulting shape of the second phase meet all properties of Definition 18, and hence, we conclude that this shape is a .
The following lemma shows that the two operations of DLC-Extending hold in any phase , for all .
Lemma 3.19**.**
Let a of nodes be in phase , for all . Therefore, in phase , DLC-Extending increases and decreases the length of and by , respectively.
Proof 3.20**.**
By Definition 18, in phase holds two segments, a diagonal occupies and vertical (horizontal) line at , where both intersect at a common point , as shown in Figure 19 top-left. Assume that is horizontal (due to symmetry, it is sufficient to focus on only one orientation). Therefore, we turn the topmost diagonal segment of by performing a line formation to collect all nodes at the leftmost column in that segment. Therefore, they move from cells into . Notice that the shape still maintains connectivity.
Next, we push to include the new constructed line segment, which subsequently extends vertically with an increase of in length, in order to occupy . in phase , we obtain a new connected shape consists of of length and of , and they both intersect at a common point , as shown in Figure 19. Therefore, we derive that DLC-Extending in phase decreases the length of by and increases by .
Here, we show that the last phase of DLC-Extending converts a into a spanning line .
Lemma 3.21**.**
Given a diagonal of nodes and partitioned into segments, DLC-Extending transforms a into a spanning line by the end of the last phase.
Proof 3.22**.**
It follows from Lemmas 3.17 and 3.19. At any phase , for all , decreases and increases by . Thus, we shall obtain the following in phase ;
[TABLE]
As a result, we acquire of length and of nodes. At this moment, in the last phase , we can trivially turn and push the diagonal and include it to by the line formation and pushing mechanism, in order to form the final spanning line .
To sum up, the total running time for all phases of DLC-Extending is analysed below.
Theorem 3.23**.**
Given an initial connected diagonal of nodes, DLC-Extending solves the DiagonalToLineConnected problem in steps.
Proof 3.24**.**
By Lemmas 3.17, 3.19 and 3.21, DLC-Extending carries out transformations in phases. In phase , for all , the two main operations, turn and push, is performed. Here, the first operation turns a corresponding segment by applying a brute-force line formation on its nodes (except the base point) as follows;
[TABLE]
Multiply 12 by to obtain the total turns for all phases:
[TABLE]
The second operation of phase pushes the spanning line by steps horizontally or vertically in at most (see Lemma 2.11):
[TABLE]
Now, observe that the last phase only turns and pushes the last diagonal segment of length (dose not push the whole spanning line, see Lemma 3.21). Therefore, the total of push operations for all phases is the summation of 14 plus pushing the last segment of length :
[TABLE]
Finally, putting 13 and 15 together, DLC-Extending completes its course in a total cost computed by,
[TABLE]
3.4 An -time Transformation
We now investigate another approach (called DL-Doubling) for DiagonalToLine (i.e., without necessarily preserving connectivity). The main idea is as follows. The initial configuration can be viewed as lines of length 1. We start (in phases) to successively double the length of lines (while halving their number) by matching them in pairs through shortest paths, until a single spanning line remains. Let the lines existing in each phase be labelled from top-right to bottom-left. In each phase, we shall distinguish two types of lines, free and stationary, which correspond to the odd () and even () lines from top-right to bottom-left, respectively. In any phase, only the free lines move, while the stationary stay still. In particular, in phase , every free line moves via a shortest path to merge with the next (top-right to bottom-left) stationary line . This operation merges two lines of length into a new line of length residing at the column of the stationary line. In general, at the beginning of every phase , , there are lines of length each. These are interchangeably free and stationary, starting from a free top-right one, and at distance from each other. The minimum number of steps by which any free line of length , , can be merged with the stationary next to it is roughly at most (by two applications of turning of Lemma 2.11). By the end of phase (as well as the beginning of phase ), there will be lines of length each, at distances from each other. The total cost for phase is obtained then by multiplying free lines, each is paying at most to merge with the next stationary, thus, a linear cost in each one of phases in total.
See Figure 20 for an illustration of DL-Doubling.
3.4.1 Formal Description
Consider an initial diagonal line of nodes occupying cells , therefore, we can define the odd and even nodes into two different types of line of length 1, free and stationary. In any phase of DL-Doubling, the permission of move is only given to free lines, i.e., stationary lines cannot move in that phase. The nodes in are free, on the contrary, are occupied by stationary lines. Since DL-Doubling keeps doubling the length of lines from 1 up to , it consequently lasts for phases. In the first phase , , each of the free lines of length 1 moves a distance of to their left to occupy , in order to merge with the next following stationary lines. As a result, we obtain (vertical) lines of length 2, where their bottommost nodes occupying , as depicted in the top of Figure 20. Due to symmetry, it is sufficient to show transformations occurring on one orientation, i.e., horizontal doubling holds.
In the second phase, we divide the vertical lines of length 2 each into free and stationary lines interchangeably, starting from a free top-right one at , and at distance from each other. Now, the free lines must move at least steps to line up with the next following stationary line to the left. Consequently, all free joint stationary lines, which forms (vertical) lines of length 4 each. Eventually, when DL-Doubling repeats this process phases, it will form the goal spanning line of order by the end of phase .
Here, we should also take into account all turns and delays of which a free line asks for moving and reallocating above the next following stationary line to the left. In particular, each line must first convert from vertical into horizontal, move one further step to fill the empty cell above the topmost node of the stationary and finally converts again into vertical. By Lemma 2.11, at any phase , for all , a free line of length , where , performs at most steps to merge with closest stationary line. Therefore, the following lemma shows that holds in all phases.
Lemma 3.25**.**
By the end of phase , for all , DL-Doubling has created lines, each of length , by performing steps in that phase.
Proof 3.26**.**
We use induction to prove this argument. Following the above reasoning of DL-Doubling in Section 3.4.1, by the end of first phase (base case), each of free lines of length 1 moves only step to form lines of length 2, which costs at most steps in total. Hence, the base case is true for phase 1. Now, assume that holds in phase , for all , where each free line of length pays at most steps to match with the closest stationary lines (two applications of Lemma 2.11), therefore, a total cost required to form lines of length in phase is given as follows;
[TABLE]
Now, we prove that this must hold in phase ,
[TABLE]
As a result, our assumption is also true for phase , therefore, from 16 and 17, we conclude that DL-Doubling pays at most steps in each phase.
Utilising Lemma 3.25, we can now formulate the following:
Theorem 3.27**.**
DL-Doubling* transforms any diagonal of order n into a line in steps.*
Proof 3.28**.**
DL-Doubling* constructs the goal spanning line of length in phases, while increases exponentially in each phase. Given that, the total running time of this transformation is computed by summing all steps of 16 over all phases, as follows:*
[TABLE]
Let us compute the right summation of 18,
[TABLE]
By multiplying 19 by 2 and subtracting it again by itself,
[TABLE]
Then, by plugging 20 into 18, this yields,
[TABLE]
Thus, it has been proved that DL-Doubling transforms of nodes into in a total of steps.
3.5 An -time Transformation Based on Recursion
An interesting observation for DiagonalToLine (i.e., without necessarily preserving connectivity), is that the problem is essentially self-reducible. This means that any transformation for the problem can be applied to smaller parts of the diagonal, resulting in small lines, and then trying to merge those lines into a single spanning line. An immediate question is then whether such recursive transformations can improve upon the best upper bound established so far. The extreme application of this idea is to employ a full uniform recursion (call it DL-Recursion), where is first partitioned into two diagonals of length each, and each of them is being transformed into a line of length , by recursively applying to them the same halving procedure. Finally, the top-right half has to pay a total of at most to merge with the bottom-left half and form a single spanning line (and the same is being recursively performed by smaller lines).
More formally, consider a diagonal of nodes where the bottom-left and top right nodes occupy and , respectively. Then, the goal is to collect all nodes at the leftmost column, say . The collection can be arranged in a recursive way by creating stop points (partitions) on in which each stop point always creates equal partitions of the same length. This can be parametrized by for each partition, where . For example, if , we have a stop point that halves into partitions of length . As a consequence, the first node on the top will stop at the middle of and wait for all nodes to its right to gather at that point (column) and then continue directly to the gathering (column) .
Now, let us repeat the same precess on each of the partitions recursively, by considering the partition as a diagonal of length roughly , which is divided into sub-partitions each of length roughly. Every recursion shrinks the partitions by a factor of . For example, in the case, we halve the length of the partitions every time we subdivide, therefore, we will end the recursion when it arrives at partitions of length , which will happen after repetitions. That occurs similarly for the general case by simply end after repetitions. For example, Figure 21 demonstrates this procedure.
Next, we draw an abstract underlying tree of the partitioning process to trace all necessary computations required to travel from the diagonal into a bottommost left column . Figure 22 presents the tree of nodes and weighted edges indicate the minimum distances (shortest paths) between them, with a degree and depth of , which is also the number of phases that are needed to cease the segmentation recursively. Here, node is the root of the tree occupies the target column at , and it has child nodes (stop points) of distances , respectively. Now, the distance between a parent and child node defines two basic properties: 1) the number of sub-child nodes (siblings) of , namely each child node gets sub-child nodes, and 2) the maximum cost by which a child node requires to merge with its parent , and it is computed by (a reader may consult Lemma 3.25 and Theorem 3.27). For example, the child node needs steps to join its parent node in a distance of , and at the same time, this tells us that this child node is also holding sub-child nodes. On the contrary, node got no sub-child since , so it is a leaf and requires steps to reach its parent node . The same idea follows for other sub-trees, such as .
Having said that, the steps of any transformation strategy that solves the above recursion problem can generally be reordered without affecting the cost, and each stop point takes place in the reordered version. That is because the abstract tree representation remains conveniently invariant, (inherits the same cost), for any arrangement by which a transformation can exploit to collect nodes into the target point (column or row). However, this recursion proceeds in cost phases, where in each phase , for all , we upper bound a cost that the transformation pays at most to move all nodes in each phase (even though may move them in an entirely different order). In phase 1, works on nodes , each of which posses roughly a single node (leaf) and eventually moves all of them. Therefore, no matter in what order they move, performs at most steps to transfer all leaves in the first phase of the tree.
In the second phase, nodes in the tree are occupied by nodes (a line of length 2). Those pairs of nodes principally move at some point (even together or as part of other nodes going through them) to its parent nodes (the next occupied column or row), with paying a cost of at most each. Repeat the same argument for the rest phases of the tree, the upper bound now is based on the following observation: whenever nodes, where , all move as maximum as steps to merge with the next stop point (parent node). In other words, suppose that nodes are a line of nodes, it walks at most steps to merge with a line in the next occupied row or column.
Generally, we can say that at any phase of any transformation solves the recursion problem, where , there is a node with other nodes occupying the same column (row), where the distance between and its parent (the next occupied column (row) is . Then, our purpose is to upper bound ’s cost for to reach and merge with ; therefore, walks at most steps to form a line with .
By analysing the running time of such a uniform recursion, we obtain that it is still , partially suggesting that recursive transformations might not be enough to improve upon (also possibly because of an matching lower bound, which is left as an open question). If we denote by the total time needed to split and merge lines of length , then the recursion starts from 1 line incurring and ends up with lines incurring . In particular, we analyse the recurrence relation:
[TABLE]
Since , we get,
[TABLE]
Finally, we give the following theorem,
Theorem 3.29**.**
DL-Recursion* transforms any diagonal of order into a line of the same order in steps.*
4 Universal Transformations
4.1 An -time Universal Transformation
In this section, we develop a universal transformation, called U-Box-Partitioning, which exploits line movements in order to transform any initial connected shape into any target shape of the same order , in steps. Due to reversibility (Lemma 2.13), it is sufficient to show that any initial connected shape can be transformed into a spanning line (implying then that any pair of shapes can be transformed to each other via the line and by reversing one of the two transformations). We maintain our focus on transformations that are allowed to break connectivity during their course.
Observe that any initial connected shape of order can be enclosed in an appropriately positioned square (called a box). Our universal transformation is divided into three phases:
Phase A: Partition the box into sub-boxes ( in total in order to cover the whole box). For each sub-box move all nodes in it down towards the bottommost row of that sub-box as follows. Start filling in the bottommost row from left to right, then if there is no more space continue to the next row from left to right and so on until all nodes in the sub-box have been exhausted (resulting in zero or more complete rows and at most one incomplete row). Moving down is done via shortest paths (where in the worst case a node has to move distance ); see Figure 23.
Phase B: Choose one of the four length- boundaries of the box, say w.l.o.g. the left boundary. This is where the spanning line will be formed. Then, transfer every line via a shortest path to that boundary (incurring a maximum distance of per line).
Phase C: Turn all lines (possibly consisting of more than one line on top of each other), by a procedure similar to that of Figure 6 (e), to end up with a spanning line of nodes on the left boundary.
However, there are two variants of sub-boxes:
Occupied sub-box: Denoted by and contains nodes of , where . 2. 2.
Unoccupied sub-box: An empty sub-box (has no nodes).
Now, we show some important properties of occupied sub-boxes. Given an occupied sub-box of nodes, where , therefore, the maximum number of lines which can be formed inside is at most . As mentioned above, those lines can be aligned horizontally at bottommost rows or vertically at leftmost columns of the occupied sub-box, such as Figure 23. The following lemma gives an upper bound on the number of sub-boxes that any connected can occupy.
Lemma 4.1**.**
Any connected shape of order occupies at most sub-boxes.
Proof 4.2**.**
It follows directly from Corollary 4.18, which states that for a given connected shape of nodes enclosed by a square box of size and any uniform partitioning of that box into sub-boxes of dimension , then, it holds that can occupy at most sub-boxes. Here, U-Box-Partitioning is dividing the square box into sub-boxes of dimension , therefore, occupies at most sub-boxes.
Below, we prove correctness and analyse the running time of phase A.
Lemma 4.3**.**
Starting from any connected shape of order , Phase A completes in steps each.
Proof 4.4**.**
By Lemma 4.1, let be a connected shape of nodes occupies sub-boxes of size each, and be any occupied sub-box of nodes, where . Then, performs a trivial line formation to collect all nodes at its bottommost (or leftmost) boundary. Consider the worst case of a node occupies the top-right corner and wants to gather at the bottom-left of , therefore, it is incurring a distance (shortest path) of at most to arrive there. Now, the nodes fill in the bottommost row from left to right, and then start filling in the next row from left to right and so on until all nodes in is exhausted. For example, Figure 23 shows the line formation at the bottommost rows of a sub-box of nodes. Consequently, forms at least one complete line of length or one incomplete of less than . Recall that is connected. So there are at most occupied sub-boxes, which means there are at most lines (complete or incomplete) inside all those occupied sub-boxes. This is trivial to prove, assume that the occupied sub-box formed more than lines, resulting in , which is a contradiction.
With that, the total cost required to form a line of nodes, for all , inside is:
[TABLE]
Multiply 21 by , to obtain total steps to form all lines inside all occupied sub-boxes;
[TABLE]
Finally, we conclude that Phase A finishes its course in steps.
In phase B, set any (length-) boundary of the square box as the gathering boundary of all lines formed inside the occupied sub-boxes in phase A. Then, the following lemma computes the total steps required to transfer all those lines to that gathering boundary.
Lemma 4.5**.**
Starting from any connected shape of order , Phase B completes in steps.
Proof 4.6**.**
It follows from Lemmas 4.1 and 4.3. Let be a connected shape of order enclosed by a box and then partitioned into occupied sub-boxes of nodes each, where . By phase A, there are lines, for all , formed inside all occupied sub-boxes. Without loss of generality, define the left border of the box as the gathering boundary for all those lines. Now, the distance between any line inside an occupied sub-box and the defined boundary is no longer than . Thus, the number of steps (distance ) by which a line requires to reach that boundary is therefore . As there are at most lines in the occupied sub-boxes, then the total steps for all lines to transfer and arrive at the left border is at most,
[TABLE]
By the end of phase B, all lines have transferred and arrived at the length- gathering boundary, where each contributes a node to that boundary. Therefore, in phase , all those lines ought to push and include themselves to the length- border, in order to form the goal spanning line of length nodes. Formally, we give the following Lemma.
Lemma 4.7**.**
Consider any length- boundary and nodes forming lines, where , that are perpendicular to that boundary. Then, by line movements, the lines require at most steps to form a line of length on that boundary. This implies that Phase C is completed in steps.
Proof 4.8**.**
See the example in Figure 24, where the length- gathering border denoted by the dashed line, and the lines of nodes are depicted by bold black lines, where . Without doubt, the nodes shall completely fill up the border of length . Now, pick the first line of nodes and start to push into the topmost point of the boundary, until either 1) are exhausted, or 2) reaching the topmost point of the boundary and still have nodes waiting to be pushed, therefore, it can easily begin to push them down towards the bottommost point of the boundary. By performing the same strategy for all other lines, they shall eventually fill in the length- border completely by nodes.
Observe that, in our case, the lines connect to length- boundary by nodes. Therefore, there is still nodes need to be pushed into the boundary. According to Lemma 2.11, each of the nodes requires 2 steps to be included, therefore all nodes shall perform a total of steps to fully filled up the boundary of length . Following that, for any lines of nodes that are connected perpendicularly to a border of length-, U-Box-Partitioning pushes the nodes of lines into the length- border by line mechanisms in a total of at most,
[TABLE]
Now, we prove that any connected shape transforms into a line in at most steps.
Lemma 4.9**.**
U-Box-Partitioning* transforms any connected shape into a straight line of the same order , in steps.*
Proof 4.10**.**
By the above Lemmas 4.1, 4.3 and 4.7, we sum 22, 23 and 24 to compute the overall moves as follows;
[TABLE]
This provides an upper bound of U-Box-Partitioning to transform any arbitrary connected shape into a single spanning line of the same number of nodes.
Putting Lemma 4.9 and reversibility (Lemma 2.13) together gives:
Theorem 4.11**.**
For any pair of connected shapes and of the same order , transformation U-Box-Partitioning can be used to transform into (and into ) in steps.
4.2 An -time Universal Transformation
We now present an alternative universal transformation, called U-Box-Doubling, that transforms any pair of connected shapes, of the same order, to each other in steps. Given a connected shape of order , do the following. Enclose into an arbitrary box as in U-Box-Partitioning (Section 4.1). For simplicity, we assume that is a power of 2, but this assumption can be dropped. Proceed in phases as follows: In every phase , where , partition the box into sub-boxes, disjoint and completely covering the box. Assume that from any phase , any sub-box is either empty or has its , where , bottommost rows completely filled in with nodes, possibly followed by a single incomplete row on top of them containing , where , consecutive nodes that are left aligned on that row. This case holds trivially for phase 1 and inductively for every phase. That is, in odd phases, we assume that nodes fill in the leftmost columns of boxes in a symmetric way. Every sub-box (of phase ) consists of four sub-boxes from phase , each of which is either empty or occupied as described above.
Consider the case where is odd, thus, the nodes in the sub-boxes are bottom aligned. For every sub-box, move each line from the previous phase that resides in the sub-box to the left as many steps as required until that row contains a single line of consecutive nodes, starting from the left boundary of the sub-box, as shown in Figure 25 (a). With a linear procedure similar to that of Figure 12 (and of nice shapes), start filling in the columns of the sub-box from the leftmost column and continuing to the right. If an incomplete column remains, push the nodes in it to the bottom of that column; see Figure 25 (b) for an example.
The case of even is symmetric, the only difference being that the arrangement guarantee from is left alignment on the columns of the sub-boxes and the result will be bottom alignment on the rows of the sub-boxes of the current phase. This completes the description of the transformation. We first prove correctness:
Lemma 4.12**.**
Starting from any connected shape of order , U-Box-Doubling forms by the end of phase a line of length .
Proof 4.13**.**
In phase , the procedure partitions into a single box, which is the whole original box. Independently of whether gathering will be on the leftmost column or on the bottommost row of the box, as all nodes are contained in it, the outcome will be a single line of length , vertical or horizontal, respectively.
Now, we shall analyse the running time of U-Box-Doubling. To facilitate exposition, we break this down into a number of lemmas.
Lemma 4.14**.**
In every phase , the “super-shape” formed by the occupied sub-boxes is connected.
Proof 4.15**.**
By induction on the phase number . For the base of the induction, observe that for it holds trivially because the initial is a connected shape. Assuming that it holds for phase , we shall now prove that it must also hold for phase . By the inductive assumption, the occupied sub-boxes form a connected super-shape. Observe that, by the way the original box is being repetitively partitioned, any box contains complete sub-boxes from previous phases, that is, no sub-box is ever split into more than one box of future phases. Additionally, observe that a sub-box is occupied iff any of its own sub-boxes (of any size) had ever been occupied, because nodes cannot be transferred between sub-boxes before phase . Assume now, for the sake of contradiction, that the super-shape formed by sub-boxes is disconnected. This means that there exists a “cut” of unoccupied sub-boxes as in Figure 26.
Replacing everything by sub-boxes, yields that this must also be a cut of sub-boxes, because a node cannot have transferred between sub-boxes before phase . But this contradicts the assumption that sub-boxes form a connected super-shape. Therefore, it must hold that the sub-boxes super-shape must have been connected.
Next, we give an upper bound on the number of occupied sub-boxes in a phase .
Lemma 4.16**.**
Given that U-Box-Doubling starts from a connected shape of order , the number of occupied sub-boxes in any phase is .
Proof 4.17**.**
First, observe that a sub-box of phase is occupied in that phase iff was originally going through that sub-box. This follows from the fact that nodes are not transferred by this transformation between sub-boxes before phase . Therefore, the sub-boxes occupied in (any) phase are exactly the sub-boxes that the original shape would have occupied, thus, it is sufficient to upper bound the number of sub-boxes that a connected shape of order can occupy. Or equivalently, we shall lower bound the number of nodes needed to occupy sub-boxes.
In order to simplify the argument, whenever occupies another unoccupied sub-box, we will award it a constant number of additional occupations for free and only calculate the additional distance (in nodes) that the shape has to cover in order to reach another unoccupied sub-box. In particular, pick any node of and consider as freely occupied that sub-box and the sub-boxes surrounding it, as depicted in Figure 27 (a). Giving sub-boxes for free can only help the shape, therefore, any lower bound established including the free sub-boxes will also hold for shapes that do not have them (thus, for the original problem). Given that free sub -boxes are surrounding the current node, in order for to occupy another sub-box, at least one surrounding sub-box must be exited. This requires covering a distance of at least , through a connected path of nodes.
Once this happens, has just crossed the boundary between an occupied sub-box and an unoccupied sub-boxs. Then, by giving it for free at most 5 more unoccupied sub-boxes, has to pay another nodes to occupy another unoccupied sub-box; see Figure 27 (b). We then continue applying this 5-for-free strategy until all nodes have been used.
To sum up, the shape has been given sub-boxes for free, and then for every sub-box covered it has to pay and gets 5 sub-boxes. Thus, to occupy sub-boxes, at least nodes are needed, that is,
[TABLE]
But, that leads to
[TABLE]
[TABLE]
But shape has order , which means that the number of nodes available is upper bounded by , i.e., , which gives:
[TABLE]
We conclude that the number of sub-boxes that can be occupied by a connected shape , and, thus, also the number of sub-boxes that are occupied by U-Box-Doubling in phase , is at most .
As a corollary of this, we obtain:
Corollary 4.18**.**
Given a uniform partitioning of square box containing a connected shape of order into sub-boxes, it holds that can occupy at most sub-boxes.
We are now ready to analyse the running time of U-Box-Doubling.
Lemma 4.19**.**
Starting from any connected shape of nodes, U-Box-Doubling performs steps during its course.
Proof 4.20**.**
We prove this by showing that in every phase , , the transformation performs at most a linear number of steps. We partition the occupied sub-boxes into two disjoint sets, and , where sub-boxes in have at least 1 complete line (from the previous phase), i.e., a line of length , and sub-boxes in have 1 to 4 incomplete lines, i.e., lines of length between 1 and . For , we have that . Moreover, for every complete line, we pay at most to transfer it left or down, depending on the parity of . As there are at most such complete lines in phase , the total cost for this is at most .
Each sub-box in may also have at most 4 incomplete lines from the previous phase, as in Figure 25 left, where at most two of them may have to pay a maximum of to be transferred left or down, depending on the parity of (as the other two are already aligned). As there are at most sub-boxes in , the total cost for this is at most .
Therefore, the total cost for pushing all lines towards the required border in sub-boxes is at most:
[TABLE]
For , we have (by Lemma 4.16) that the total number of occupied sub-boxes in phase is at most , therefore, (taking into account also the worst case where every occupied sub-box may be of type ). There is again a maximum of 2 incomplete lines per such sub-box that need to be transferred a distance of at most , therefore, the total cost for this to happen in every sub-box is at most:
[TABLE]
By paying the above costs, all occupied sub-boxes have their lines aligned horizontally to their left or vertically to their bottom border, and the final task of the transformation for this phase is to apply a linear procedure in order to fill in the left (bottom) border of the box. This procedure costs at most for every nodes aligned as above (Lemma 2.11), therefore, in total at most:
[TABLE]
This completes the operation of U-Box-Doubling for phase . Putting (29), (30) and (31) together, we obtain that the total cost , in steps, for phase is,
[TABLE]
As there is a total of phases, we conclude that the total cost of the transformation is,
[TABLE]
Finally, together Lemma 4.12, Lemma 4.19 and reversibility (Lemma 2.13) imply that:
Theorem 4.21**.**
For any pair of connected shapes and of the same order , transformation U-Box-Doubling can be used to transform into (and into ) in steps.
5 Conclusions
In this work, we studied a new linear-strength model extending upon the model of [21, 30]. The nodes can now move in parallel by translating a line of any length by one position in a single time-step. This model, having the model of [21, 30] as a special case, adopts all its transformability results (including universal transformations). Then, our focus naturally turned to investigating if pushing lines can help achieve a substantial gain in performance (compared to the of those models). Even though it can be immediately observed that there are instances in which this is the case (e.g., initial shapes in which there are many long lines, thus, much initial parallelism to be exploited), it was not obvious that this holds also for the worst case. By identifying the diagonal as a potentially worst-case shape (essentially, because in it any parallelism to be exploited does not come for free), we managed to first develop an -time transformation for transforming the diagonal into a line, then to improve upon this by two transformations that achieve the same bound while preserving connectivity, and finally to provide an -time transformation (that breaks connectivity). Going one step further, we developed two universal transformations that can transform any pair of connected shapes to each other in time and , respectively.
There is a number of interesting problems that are opened by this work. The obvious first target (and apparently intriguing) is to answer whether there is an -time transformation (e.g., linear) or whether there is an -time lower bound matching our best transformations. We suspect the latter, but do not have enough evidence to support or prove it. The tree representation of the problem that we discuss in Section 3.5 (see, e.g., Figure 22), might help in this direction. Moreover, we didn’t consider parallel time in this paper. If more than one line can move in parallel in a time-step, then are there variants of our transformations (or alternative ones) that further reduce the running time? In other words, are there parallelisable transformations in this model? In particular, it would be interesting to investigate whether the present model permits an parallel time (universal) transformation, i.e., matching the best transformation in the model of Aloupis et al. [2]. It would also be worth studying in more depth the case in which connectivity has to be preserved during the transformations. In the relevant literature, a number of alternative types of grids have been considered, like triangular (e.g, in [14]) and hexagonal (e.g., in [38]), and it would be interesting to investigate how our results translate there. Finally, an immediate next goal is to attempt to develop distributed versions of the transformations provided here.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] Greg Aloupis, Nadia Benbernou, Mirela Damian, Erik D Demaine, Robin Flatland, John Iacono, and Stefanie Wuhrer. Efficient reconfiguration of lattice-based modular robots. Computational geometry , 46(8):917–928, 2013.
- 2[2] Greg Aloupis, Sébastien Collette, Erik D Demaine, Stefan Langerman, Vera Sacristán, and Stefanie Wuhrer. Reconfiguration of cube-style modular robots using O(logn) parallel moves. In International Symposium on Algorithms and Computation , pages 342–353. Springer, 2008.
- 3[3] Dana Angluin, James Aspnes, Zoë Diamadi, Michael J. Fischer, and René Peralta. Computation in networks of passively mobile finite-state sensors. Distributed Computing , 18(4):235–253, March 2006.
- 4[4] Dana Angluin, James Aspnes, David Eisenstat, and Eric Ruppert. The computational power of population protocols. Distributed Computing , 20(4):279–304, November 2007.
- 5[5] Aaron T Becker, Erik D Demaine, Sándor P Fekete, Jarrett Lonsford, and Rose Morris-Wright. Particle computation: complexity, algorithms, and logic. Natural Computing , pages 1–21, 2017.
- 6[6] Julien Bourgeois and Seth Copen Goldstein. Distributed intelligent mems: progresses and perspectives. IEEE Systems Journal , 9(3):1057–1068, 2015.
- 7[7] Zack Butler, Keith Kotay, Daniela Rus, and Kohji Tomita. Generic decentralized control for lattice-based self-reconfigurable robots. The International Journal of Robotics Research , 23(9):919–937, 2004.
- 8[8] Mark Cieliebak, Paola Flocchini, Giuseppe Prencipe, and Nicola Santoro. Distributed computing by mobile robots: Gathering. SIAM J. Comput. , 41(4):829–879, 2012. doi:10.1137/100796534 . · doi ↗
