Cellular Automata Supporting n-Connectivity

We propose a new algorithm based on cellular automation (CA) for preserving n-connectivity, n > 1.The CA algorithm transforms an initial grid configuration in a grid with same number of holes but without 1-connected components. Also, maximal thinning of n-connected components, n > 1, is achieved. The grid can be used as initial for investigating properties of initial grid. Computational performances are evaluated and measured on real cases. The obtained results indicate that the proposed approach achieves comparable complexity as standard approaches; however, the speed-up and scalability of the proposed algorithm are not limited by the number of processing nodes.


Introduction
The cellular automata (CA) can be considered as an alternative way of computation based on local data flow principles.The concept of CA was first proposed by Neumann in 1950s through self-reproducing systems [1].Later, the formalization was improved by different authors [2][3][4][5] emphasizing different perspectives.The application areas of CA become very different, ranging from biology [6,7], sociology [8], image processing [9], diffusion of soil pores [10], and so forth.
A CA can be informally represented as a set of regularly and locally connected identical elements.The elements can be in a finite set of states.The CA evolves in discrete time steps, changing the states of elements according to a local rule, which is the same for all elements.The new state of each element depends on its previous state and on the state of its neighbourhood.The neighbourhood is composed of all directly connected elements.The characteristic properties of CAs are therefore locality, discreetness, and synchrony.
Identification of isolated regions in binary images is important problems in image processing, machine vision, porous materials analysis, and many other fields of science.The shrinking of binary picture patterns, which is a step towards the recognition of image objects, has been first investigated, using CAs, by Neumann [1], Thatcher [2], and Levialdi [11].Parallel versions of these algorithms have been developed in [3,12].An improved algorithm with a linear complexity has been proposed in [4,13].
In this paper we propose a new algorithm for thinning of an arbitrary binary rectangular grid.The algorithm preserves 2 or more levels of connectivity of all components on the grid.Hence, the number of isolated parts is preserved.Also, the thinning is maximal in sense of -connectivity of all components in initial grid,  > 1.
The rest of the paper is organized as follows.In Section 2, basic definitions of -connectivity and CAs are introduced.In Section 3, our CA is defined with its properties.Section 4 is devoted to implementation and performance analysis.Finally, the work is summarized in Section 5.
Configuration conf  (,  0 ) of the cellular automation  is the assignment of states to all cells in the grid in a moment  ≥ 0 starting from an initial configuration  0 .CA is often simulated on a finite grid.In our simulation, boundary cells are in fixed state and remain constant throughout the simulation.
Two cells ( 1 ,  1 ) and ( 2 ,  2 ) are (weakly Two black (white) cells ( 1 ,  1 ) and (  ,   ) are connected if there exists a sequence of black (white) cells (  ,   ), 2 ≤  ≤ , such that each pair ( −1 ,  −1 ) and (  ,   ) is adjacent.That sequence (  ,   ), 1 ≤  ≤ , is a path which connects cells ( 1 ,  1 ) and (  ,   ).Length of the path is  − 1. Cell ( 1 ,  1 ) is start cell and (  ,   ) is end cell of the path.Cycle or closed path is a path with same start and end cell.-cycle is a closed path of length .According to the adjacency, we do not have 3-cycle.2-cycle is a "column" or "row" with two cells.A maximum connected region of black cells is called a component.
Similary, black (white) cells ( 1 ,  1 ) and (  ,   ) are weakly connected if there exists a sequence of black (white) cells (  ,   ), 2 ≤  ≤ , such that each pair ( −1 ,  −1 ) and (  ,   ) is weakly adjacent.A maximum weakly connected region of white cells is called a hole.Always there is a single external (infinite) hole.A maximum weakly connected region of black cells is called a weakly component.
For the moment, suppose that we have just one component  on the grid.Then, we say that component  is kconnected if its complement  has (−1) finite holes.Number  is the level of connectivity of the component .Now, on the same way we can find the level of connectivity for all other components in the grid.For example, in configuration  0 from Figure 2(a), we have three components (one is 3-connected ( 1 ), one is 2-connected ( 2 ), and one is 1connected ( 3 )) and three finite holes ( 1 ,  2 , and  3 ).
Let  be a cell.Two black (white) cells are (weakly) connected in neighbourhood of  if there exists a black (white) connected path of cells from the neighbourhood which (weakly) connect these two cells.
We solve the problem of thinning an initial configuration to a configuration with the same number of holes.

Cellular Automation 𝐴 1 and Its Properties
Define a CA  1 with a local transition function   1 which is defined by where   or    , 1 ≤  ≤ 5, 6 ≤  ≤ 8, 0 ≤  ≤ 3, presents local states of the central cell and its neighbourhoods in some moment  ≥ 0 from Figure 3.
Applying the local transition function to all cells of an configuration simultaneously, we get the sequence of configurations conf  1 (,  0 ),  ≥ 1, started from some initial configuration  0 .For example, if  0 is the configuration from Figure 2(a), then in Figures 2(b) and 2(c) we have conf  1 (1,  0 ) and conf  1 (,  0 ),  > 7.
Theorem 1.Let  0 be a configuration.CA  1 has the following properties.
(1) A finite number of time steps  > 0 exist in which each 1-connected component in  0 vanishes after  steps.
( Proof of Theorem 1. Notice, those white cells remain always white ( 5 in Figure 3).From this fact, it follows that CA  1 cannot connect two disconnected components.So, each component can be observed independently and for each component we can assume that its complement has all white cells.
Let  be 1-connected component.For the component  we will prove that in any time step there are one or more black cells that are transformed in white.Hence, because of finiteness, after some time steps, the component will vanish.
If  = 1 or  = 1, component  is "column" or "row" and  has two ends which are transformed in white cells according to  1 ,  2 ,  3 , or  4 from Figure 3.
Suppose that  > 1 and  > 1.If component  has a cell with 3 or 4 adjacent white cells, then according to  1 ,  2 ,  3 , or  4 from Figure 3 this cell is transformed in white.
So, we suppose that all cells have no more than 2 adjacent white cells.Traversing boundary cells in negative direction (component is always on the left side), we create a closed path Supose that we observe a time step , where ( + 1) mod 4 = 0. Denote by V 1 and V  ,  ∈ 2, 3, . . ., , the bottom rightest and top rightest cells in the component, respectively.Similar, we can observe time steps , where ( + 1) mod 4 ∈ {1, 2, 3}.
In case 1, cells V 1 , V  have the neighbourhoods as  0 7 ,  0 6 from Figure 3.If this is not case, then one of them, for example V 1 = (, ), has the neighbourhood (, 0, , 0, 1, 1, , 1, 0).Then, the white cell in ( − 1,  + 1) position surrounded by the path   which is in contradiction with  is 1-connected (path   surrounds a finite hole).In case 2, there exists a closed path  (see Figure 4): in which all cells are different, except ends.In the closed path , as we already proved in the previous paragraph, there exists a cell with neighbourhood as  0 6 or  0 7 from Figure 3.With this we proved Theorem 1, property 1.All neighbourhoods from Figure 3 are such that if central cell changes its black state to white, then connectivity of its neighbouring black cells is preserved or "new" central white cell connects already weakly connected neighbouring white cells.So, local transition function of the CA  1 preserves the level of connectivity for each component.With this we proved Theorem 1, property 2.
Because of finiteness of components and deterministic rules, Theorem 1, property 3 is obvious.
Suppose that black cell  = (, ) ∈   .We will prove that the cell  has at least two white cells in its neighbourhood.So, we can suppose that (1) cell  has no neighbouring white cells, (2) cell  has one neighbouring white cell.
Same consideration holds for case 2. Now, we will prove that cell  has at least two nonweakly connected, in the neighbourhood, white neighbours.Because cell  has at least two connected black neighbours ( 1 ,  2 ,  3 ,  4 from Figure 3), we have three cases.
(1) Cell  has exactly two connected black neighbours.
(2) Cell  has exactly three connected black neighbours.
This case is obvious.
Hence, in every case we have two white cells in the neighbourhood of the cell  which are nonweakly connected, in the neighbourhood.
If these two neighbours are weakly connected in the configuration conf  1 (  ,  0 ), then they are from the same hole.Changing state of the cell  will increase the number of components in conf  1 (  ,  0 ).
If these two neighbours are not weakly connected in the configuration conf  1 (  ,  0 ), then they are from different holes.Hence, changing state of the cell  will decrease the number of holes in conf  1 (  ,  0 ).Now, we consider the theoretical complexity of the algorithm by means of the required number of time steps.Let  be a configuration.Let  have components  1 ,  2 , . . .,   ,  ≥ 1. Suppose that dimension of circumscribing rectangle of component   is   ×   , 1 ≤  ≤ .From the proof of the Theorem 1 we have the following.

Implementation and Experimental Results
Implementations of the algorithm are made in NetLogo 5.0.4 (agent-based programming language and integrated modelling environment).The CA model is represented by 2-dimensional grid of square cells and each cell can exist in two different sates, white or black.Any cell is coloured black with probability  and white with probability 1 .These probabilities are independent for every cell.Within an iteration, the whole grid is processed at once; namely, each cell is transformed to a new state without affecting the other cells.After the update, algorithm proceeds to a new iteration.The iteration takes place as long as at least one cell is changed.The global operations in the algorithm are the  steady state checking and alternating numbers from 0, 1, 2, 3.However, here we emphasize that the alternation of numbers from 0, 1, 2, 3 is possible to substitute by randomly choosing a number from 0, 1, 2, 3.With this we obtain nondeterministic CA with no need for the global operation.
In Figure 5

Conclusions
We proposed a new CA algorithm for thinning with property of preserving -connectivity,  > 1, of all components in any random binary grid.Simple definition of used CA has several advantages; for example, CA is not limited by the number of elements, its evolution is inherently parallel, it has a strong resemblance to the important approaches in the nature like principles of cells that are building blocks for large systems or elementary particles, and so forth.However, several drawbacks can also be identified, for example, lack of global communication, which implies problems, related to global synchronization, inability for calculation of complex mathematical operations, and so forth.However, the heterogeneous computing, supported today with data flow approaches, field programmable gate array (FPGA), and graphic processing unit (GPU) systems, systems on chips, are promising platforms for the implementation of the efficient CA algorithms.Finally, further work is also in the investigation of necessary extensions of the algorithm for 3D grids.

Figure 4 :
Figure 4: (a) Component  with its circumscribing rectangle; (b) boundary path   of the .
(a) Probability for black cell is 0.55 (b) Probability for black cell is 0.60 (c) Probability for black cell is 0.65

Figure 5 :
Figure 5: Examples of grids with resolution 201 × 201.Left is original and right is after CA  1 implementation.
we present examples of the implementation.In all examples 201 × 201 grid is used.Differences are in generating initial grid.In Figures 5(a), 5(b), and 5(c) random grid with densities 0.55, 0.50, and 0.65 is used, respectively.