algorithm for identification of infinite clusters based on...

8
Research Article Algorithm for Identification of Infinite Clusters Based on Minimal Finite Automaton Biljana Stamatovic 1 and Goran Kilibarda 2 1 Faculty of Information Systems and Technologies, University of Donja Gorica, Podgorica, Montenegro 2 Faculty of Project and Innovation Management, Educons University, Belgrade, Serbia Correspondence should be addressed to Biljana Stamatovic; [email protected] Received 5 April 2017; Revised 25 August 2017; Accepted 27 September 2017; Published 24 October 2017 Academic Editor: Yakov Strelniker Copyright © 2017 Biljana Stamatovic and Goran Kilibarda. is is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. We propose a finite automaton based algorithm for identification of infinite clusters in a 2D rectangular lattice with cells. e algorithm counts infinite clusters and finds one path per infinite cluster in a single pass of the finite automaton. e finite automaton is minimal according to the number of states among all the automata that perform such task. e correctness and efficiency of the algorithm are demonstrated on a planar percolation problem. e algorithm has a computational complexity of O() and could be appropriate for efficient data flow implementation. 1. Introduction Aſter the publication of Shannon’s paper in 1951 [1], many sci- entists considered the behavior of systems of finite automata (FAs) in labyrinths, for example, in connected sets of cells of a grid or lattice. An overview of the obtained results is given in [2, 3]. Some problems of finite automaton (FA) traversing labyrinths can be found in [4, 5]. Many results indicate a limited power of FA. But, by introducing a collective of FAs, it was proved that there exists a collective of two FAs which can traverse all planar mosaic finite labyrinths [6]. Also, in [7, 8], the problem of FA recognition of some infinite classes of labyrinths (e.g., digits and letters) is studied. Recognizing and labeling connected regions in binary images are important problems in image processing, machine vision, porous matter analysis, and many other fields of science. Studying site and bond percolation on any lattice is an important problem in computational physics [9–12]. Some algorithms from these studies are presented in [13– 18]. In [19–21], polymerizing systems are presented, with branched or cross-linked polymers, which may go through distinct gelation transitions; a formed gel is seen as a two- dimensional lattice-percolation cluster and the authors use a “hull-generating walk” (HGW) algorithm. e similarity between the papers [19–21] and the present paper consists in the fact that here we use a similar algorithm (in fact, HGW algorithm and the algorithm from our paper are in the class of the so-called “maze solving algorithms” [22]). But in contrast to papers [19–21], where HGW algo- rithm is used for generating perimeters of clusters in a 2D random binary grid, we use our algorithm for identifying and counting infinite clusters in such grid. is is a new, purely mathematical approach, in terms of the theory of finite automata, to the problem considered in our paper. It consists in the construction of a minimal finite automaton (FA) which can traverse the border of any cluster on any 2D binary grid and always stops in the planar site percolation model. e planar site percolation model is represented by a 2D grid of square cells and each cell can exist in two different states, white or black. Any cell is colored black with probability and white with probability 1−. ese probabilities are independent for each cell. We use open boundary conditions with boundary cells on the top and on the bottom of the grid in different states, blue and red, respectively. Cells on the leſt and right boundaries are white. We construct an initial FA A 0 which can traverse the border of any cluster in every planar 2D grid in accordance with the leſt-hand rule (which is also a kind of a HGW Hindawi Mathematical Problems in Engineering Volume 2017, Article ID 8251305, 7 pages https://doi.org/10.1155/2017/8251305

Upload: others

Post on 12-Sep-2019

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Algorithm for Identification of Infinite Clusters Based on ...downloads.hindawi.com/journals/mpe/2017/8251305.pdf · ResearchArticle Algorithm for Identification of Infinite Clusters

Research ArticleAlgorithm for Identification of Infinite Clusters Based onMinimal Finite Automaton

Biljana Stamatovic1 and Goran Kilibarda2

1Faculty of Information Systems and Technologies University of Donja Gorica Podgorica Montenegro2Faculty of Project and Innovation Management Educons University Belgrade Serbia

Correspondence should be addressed to Biljana Stamatovic biljanastamatovicudgedume

Received 5 April 2017 Revised 25 August 2017 Accepted 27 September 2017 Published 24 October 2017

Academic Editor Yakov Strelniker

Copyright copy 2017 Biljana Stamatovic and Goran Kilibarda This is an open access article distributed under the Creative CommonsAttribution License which permits unrestricted use distribution and reproduction in any medium provided the original work isproperly cited

We propose a finite automaton based algorithm for identification of infinite clusters in a 2D rectangular lattice with 119871 = 119883 times 119884cells The algorithm counts infinite clusters and finds one path per infinite cluster in a single pass of the finite automaton Thefinite automaton is minimal according to the number of states among all the automata that perform such taskThe correctness andefficiency of the algorithm are demonstrated on a planar percolation problem The algorithm has a computational complexity ofO(119871) and could be appropriate for efficient data flow implementation

1 Introduction

After the publication of Shannonrsquos paper in 1951 [1] many sci-entists considered the behavior of systems of finite automata(FAs) in labyrinths for example in connected sets of cells ofa grid or lattice An overview of the obtained results is givenin [2 3] Some problems of finite automaton (FA) traversinglabyrinths can be found in [4 5] Many results indicate alimited power of FA But by introducing a collective of FAsit was proved that there exists a collective of two FAs whichcan traverse all planar mosaic finite labyrinths [6] Also in[7 8] the problem of FA recognition of some infinite classesof labyrinths (eg digits and letters) is studied

Recognizing and labeling connected regions in binaryimages are important problems in image processingmachinevision porous matter analysis and many other fields ofscience Studying site and bond percolation on any latticeis an important problem in computational physics [9ndash12]Some algorithms from these studies are presented in [13ndash18] In [19ndash21] polymerizing systems are presented withbranched or cross-linked polymers which may go throughdistinct gelation transitions a formed gel is seen as a two-dimensional lattice-percolation cluster and the authors use aldquohull-generating walkrdquo (HGW) algorithm

The similarity between the papers [19ndash21] and the presentpaper consists in the fact that here we use a similar algorithm(in fact HGW algorithm and the algorithm from our paperare in the class of the so-called ldquomaze solving algorithmsrdquo[22]) But in contrast to papers [19ndash21] where HGW algo-rithm is used for generating perimeters of clusters in a 2Drandom binary grid we use our algorithm for identifyingand counting infinite clusters in such grid This is a newpurelymathematical approach in terms of the theory of finiteautomata to the problem considered in our paper It consistsin the construction of aminimal finite automaton (FA) whichcan traverse the border of any cluster on any 2D binary gridand always stops in the planar site percolation model

The planar site percolation model is represented by a2D grid of square cells and each cell can exist in twodifferent states white or black Any cell is colored blackwith probability 119901 and white with probability 1 minus 119901 Theseprobabilities are independent for each cell We use openboundary conditions with boundary cells on the top andon the bottom of the grid in different states blue and redrespectively Cells on the left and right boundaries are white

We construct an initial FA A1199020 which can traverse theborder of any cluster in every planar 2D grid in accordancewith the left-hand rule (which is also a kind of a HGW

HindawiMathematical Problems in EngineeringVolume 2017 Article ID 8251305 7 pageshttpsdoiorg10115520178251305

2 Mathematical Problems in Engineering

(a) (b)

Figure 1 Examples of percolation site models on 13 times 13 grid generated with probability 119901 = 055 without infinite cluster (a) and generatedwith probability 119901 = 060 with infinite cluster (b)

algorithm) The automaton A1199020 can be launched from anycell of a grid In any moment the input ofA1199020 is informationabout von Neumann neighborhood of the present cell givenin the form of a 5-tuple representing the state of the centralcell and the states of its four neighbors In the next momentdepending on its present state and its input the FA proceedsfrom the present cell in one of the directions defined by theoutput symbols 119890 119899 119908 or 119904 (denoting the correspondingdirections east north west or south resp) and moves intoa corresponding neighbor cell or stays at the same place ifoutput symbol is 0 (which means ldquono moverdquo) and passesinto a new state On the bases of this automaton we givean algorithm which can be used for findingidentifying andcounting infinite clusters in the given grid Such algorithmis simple to implement and does not need extra memoryor stacks The time complexity of the algorithm is linearand not larger than the time complexity of already existingalgorithms The FA has only four states including the initialstate We have proved that this is the minimal FA accordingto the number of states

The paper is organized as follows In Section 2 generalgrid-related definitions and definitions of the FA and itsproperties are given In Section 3 the FA-based algorithm forcounting connected paths is described and its complexity isproved The main conclusions and results are summarized inSection 4

2 Definition

21 General Definitions The planar site percolation model(see Figure 1) is represented by a two-dimensional latticenetwork (grid) of unit squares (cells) whose centers are in theinteger lattice with 119871 = 119883times119884 cells119883119884 ge 4The cell positionis determined by its center Each cell can exist in two differentstates 0 or 1 where state 0 is usually called ldquowhiterdquo and state 1is usually called ldquoblackrdquo The boundary cells of the simulatedgrid are in a fixed state which remains constant throughout

the simulationThe boundary cells on the bottom edge of thegrid are in state 2 which is called ldquoredrdquo and the boundarycells on the top edge of the grid are in state 3 which is calledldquobluerdquo The boundary cells on the left and right edge of thegrid are white State 4 which is called ldquoorangerdquo is used forthe notation of labeled cells in the grid

Two different cells (1198941 1198951) and (1198942 1198952) from a grid areadjacent (weakly adjacent) if |1198941 minus 1198942| + |1198951 minus 1198952| = 1 (max|1198941 minus1198942| |1198951 minus 1198952| = 1) Two black (white) cells (1198941 1198951) and (119894119899 119895119899)are connected if there exists a sequence of black (white) cells(119894119896 119895119896) 2 le 119896 le 119899 such that each pair (119894119896minus1 119895119896minus1) and (119894119896 119895119896)are adjacent such sequence is called a path Blue-red path isa path whose one end is adjacent to a blue and the other to ared cell A set of cells is connected if any two cells from theset are connected A maximum connected set of black cells iscalled a cluster The infinite cluster is a cluster that contains ablue-red path

Similarly black (white) cells (1198941 1198951) and (119894119899 119895119899) are weaklyconnected if there exists a sequence of black (white) cells(119894119896 119895119896) 2 le 119896 le 119899 such that each pair (119894119896minus1 119895119896minus1) and (119894119896 119895119896)are weakly adjacent A maximum weakly connected set ofwhite cells is called a hole

22 Definition of the Initial Finite Automaton A1199020 Let 119890 =(1 0) 119899 = (0 1) 119908 = (minus1 0) and 119904 = (0 minus1) be basicEuclidean vectors Denote by119881 the set 119890 119899 119908 119904 We use thenotations 119890 = 119908119908 = 119890 119904 = 119899 and 119899 = 119904 For a cell 119888 = (119894 119895) ina grid its neighbors are cells 119888 + 119890 = (119894 + 1 119895) 119888 +119899 = (119894 119895 + 1)119888+119908 = (119894minus1 119895) and 119888+119904 = (119894 119895minus1) Hence the vonNeumannneighborhood is used in this paper (see Figure 2(a))

Let 119904119888 = 119904(119894119895) be the state of the cell 119888 andN(119888) = 120572 isin 119881 |119904119888+120572 = 1

Let 120587 = (119890 119899 119908 119904) be a cyclic permutation For 119872 sube119881 119872 = 0 and 120572 isin 119881 denote by 120587119872(120572) the element 1205871198990(120572)where 1198990 = min119899 isin N | 120587119899(120572) isin 119872 where N is the set ofnatural numbers

Mathematical Problems in Engineering 3

(a)

ci+1jminus1cijminus1ciminus1jminus1

ci+1jciminus1j

ci+1j+1cij+1ciminus1j+1

cij

(b)

Figure 2 Von Neumann neighborhood and enumeration

By a finite automaton (FA) A we mean a quintuple(119860 119876 119861 120593 120595) where the finite nonempty sets119860119876 and 119861 arethe input alphabet the set of states and the output alphabetof the automaton respectively 120595 119876 times 119860 rarr 119861 is its outputfunction and 120593 119876times119860 rarr 119876 is its state-transition function Ifwemark a state 1199020 isin 119876 as an initial state ofA we get an initialautomatonA1199020 = (119860119876 119861 120593 120595 1199020) (in other wordsA1199020 is aMealy machine)

Further we consider the initial FA A119902119890 = (119860119876 119861 120593

120595 119902119890) supposing that 119860 = 0 1 2 3 45 119876 = 119902119890 119902119899 119902119908 119902119904and 119861 = 0 119890 119899 119908 119904 The starting cell of this automaton ina grid is always the lowest right corner cell of the grid Ifthe output symbol of A119902119890 is 120572 isin 119890 119899 119908 119904 we say that FAproceeds in the direction 120572 If the output symbol is 0 theFA stops This way FA simulates movements (goes aroundtraverses) through a grid

An input symbol 119886 = (1198860 1198861 1198862 1198863 1198864) = (119904(119894119895) 119904(119894+1119895)

119904(119894119895+1) 119904(119894minus1119895) 119904(119894119895minus1)) isin 119860 = 0 1 2 3 45 represents thestate of a cell and the states of its von Neumann neighborsconsistent with the enumeration in Figure 2(b) For the inputsymbol 119886 by 119888(119886) we denote the central cell

The FA starts in state 119902119890 and uses states from set 119876 untilit finds a boundary cell on the top of the grid (blue one) Inthismoment the algorithm increments the counter of infiniteclusters and starts labeling cells with an orange color Thealgorithm labels a path until the FA finds a boundary cell onthe bottom edge of the grid (red one) After finding the lowestleft end of an infinite cluster the FA proceeds in the 119908 (west)direction and it is on a white cell and in state 119902119890 After thatthe algorithm breaks labeling and starts with new counting ofinfinite clusters and the FA repeats the process of traversingThe algorithm stops when the output of the FA is 0

The functions 120593 and 120595 are defined in the followingway Let 119888 = (119894 119895) be a cell and let 119886 = (119904(119894119895) 119904(119894+1119895)119904(119894119895+1) 119904(119894minus1119895) 119904(119894119895minus1)) 119909 isin 0 1 2 3 and 119910 isin 1 4 Thenfor 120572 isin 119890 119899 119908 119904 and input 119886 = (119910 119909 119909 119909 119909) the functions120593 and 120595 are defined by 120593(119902120572 119886) = 119902120573 and 120595(119902120572 119886) =

120573 where 120573 = 120587N(119888(119886))(120572) (see Figure 3) except for someldquostartingrdquo ldquoendingrdquo or ldquochangingrdquo parts which are given bythe following

(i) If 119894 lt 119883 then

(a) for 119886 = (0 119909 119909 119909 2) or 119886 = (1 119909 0 119909 2)120593(119902119890 119886) = 119902119890 and 120595(119902119890 119886) = 119908

(b) for 119886 = (1 119909 1 119909 2)120593(119902119890 119886) = 119902119904 and120595(119902119890 119886) =119899

(c) for 119886 = (119910 119909 119909 0 2) and 119902 isin 119902119899 119902119890 120593(119902 119886) =119902119890 and 120595(119902 119886) = 119908

(ii) If 119894 = 119883 then for 119886 = (119910 119909 119909 119909 2) 120593(119902119890 119886) = 119902119890 and120595(119902119890 119886) = 0

Notice two properties of the FAA119902119890

(1) In the initial state the FA is on the cell that has redcell on the south (119904(119894119895minus1) = 2) The FA goes in the westdirection until it finds the black cell with black cell onthe north If it cannot find it the FA stops

(2) Themeaning of the fact that the FA is on the cell 119888 andis in the state 119902120572 is that the FA has arrived on the cell119888 from the direction 120572 120572 isin 119881 (see Figure 3)

The initial automaton A119902119890 and the initial planarsite percolation model (1198620 119888(0)) where 119888(0) is thecell on the lowest right corner of a grid 1198620 create thesequence 119878(119860119902119890 (1198620 119888(0))) = ((119888(0) 119902119890 1198860 1198870) (119888(1) 11990211198861 1198871) (119888(119894) 119902119894 119886119894 119887119894) (119888(119894 + 1) 119902119894+1 119886119894+1 119887119894+1) ) where119886119894 represents the neighborhood of the cell 119888(119894) (119888(119894) = 119888(119886119894))119887119894 = 120595(119902119894 119886119894) 119888(119894 + 1) = 119888(119894) + 119887119894 119902119894+1 = 120593(119902119894 119886119894) 119894 ge 0

Let 119877119904 = (119894 119895) isin 1198620 | 119904(119894119895) = 1 119904(119894+1119895) = 0 119904(119894119895minus1) = 2Properties of the FA A119902119890 which will be crucial for the

algorithm are defined by the following theorem

Theorem 1 A blue-red path exists in the planar site percola-tion model 1198620 if and only if there exists a cell 1198881015840(0) isin 119877119904 suchthat the sequence (1198881015840(0) 1198881015840(1) 1198881015840(119899)) 119899 ge 0 of the cells inthe sequence 119878(A119902119890 (1198620 119888(0))) creates a blue-red path

Choosing the cyclic permutation120587 in the definition of theFAA119902119890 we define an orientation Namely if the FA comes onthe cell 119888 from direction 120572 isin 119881 then the right ahead left andbehind cell (from the cell 119888) are 119888 + 120587(120572) 119888 + 1205872(120572) 119888 + 1205873(120572)and 119888 + 1205874(120572) = 120572 respectively

Let 119875 be a blue-red path in the grid 1198620 and 119870119875 be theinfinite cluster that encloses path 119875 Let 119888119903119904 isin 119877119904 be the lowestright cell in the cluster119870119875 and119867119875 be the subset of the infinitehole which is on the right side of the cluster Right boundaryof the cluster 119870119875 119870119867119875 = 119888 isin 119870119875 | 119888 is weakly adjacentto some cell from 119867119875 is connected and encloses a blue-redpath Notice that 119888119903119904 isin 119870119867119875

It is not hard to see that the FA A119902119890 implementsldquoleft-hand-on-wallrdquo algorithm ([23]) Starting from the cell

4 Mathematical Problems in Engineering

n

e

e

X 0 X

1 1 1

XxX

X 0 x

0 1 1

X 1 x

X 1 X

x 1 0

X 1 X

X 1 X

1 1 0

X 0 x

X 0 X

1 1 0

X 0 XX 1X

x 1 1

x xX

X 0 X

1 1 0

x 1 X

X 0 x

1 1 0

X 1 X

X 1 X

0 1 0

X 0 XX 1 x

x 1 1

XxX

X 0 x

0 1 1

X 0 x

X 1 X

0 1 x

X 1 X

X 0 X

0 1 0

X 1 X

X 1 x

1 1 x

x xX

x x x

x 1 1

X 1 X

X 0 X

1 1 1

XxX

n

n

w

w

e

w

s

s

s

s

n

w

e

qe

qs

qn

qw

Figure 3 Traversing part of the FAA119902119890 where 119909 isin 0 1 2 3 before starting labeling

119888119903119904 the FA traverses 119870119867119875 and the subsequence (1198881015840(0) =

119888119903119904 1198881015840(1) 1198881015840(119899)) for some 119899 isin N of the sequence

119878(A119902119890 (1198620 119888(0))) creates a blue-red pathIf there is not a connected path between red and blue cells

in the grid 1198620 then for all cells 119888 isin 119877119904 the sequence (119888 =1198880 1198881 119888119899 ) 119899 ge 0 will not contain a cell with blue northneighbor The grid is finite and the FA will stop on the lowestleft cell of the grid

Theorem 2 According to the number of states the FA A119902119890 isthe minimal initial finite automaton

In the example from Figure 1(b) notice cell 119886 It is in theinfinite cluster and it is weakly adjacent by the right infinitehole Traversing the cluster by the left-hand rule the FAA119902119890is four times in the cell 119886 (from south east north and westsides) All the visits must be done in different automaton

states (input is the same) Otherwise the FA makes a cycleHence for traversing a border of a cluster it is necessary tohave 4 states

3 The FA Traversing Algorithm andIts Time Complexity

The algorithm for identification of infinite clusters is basedon the FA A119902119890 To ensure appropriate counting of infiniteclusters the algorithm uses three global variables countlabeling and countingClusterThe count counts the number ofinfinite clusters labeling is an indicator for labeling cells andcountingCluster is an indicator for the counting of the infinitecluster

Let (1198620 119888(0)) be an initial grid where1198620 is a grid and 119888(0)is its lowest right corner Let 119902119890 be the initial state of the FAA119902119890 The algorithm is presented as Algorithm 1

Mathematical Problems in Engineering 5

Data Initial grid (1198620 119888(0))Result 119888119900119906119899119905 is number of infinite clusters and labeled blue-red paths119888119900119906119899119905 = 0119888119906119903119903119890119899119905119878119905119886119905119890 = 119902119890119888119906119903119903119890119899119905119862119890119897119897 = 119888(0)Labeling = falsecountingCluster = true119886 = neighbor of the 119888119906119903119903119890119899119905119862119890119897119897while 120595(119888119906119903119903119890119899119905119878119905119886119905119890 119886) ltgt 0 do

if labeling == 119905119903119906119890 thenlabel 119888119906119903119903119890119899119905119862119890119897119897

endif north neighbor of 119888119906119903119903119890119899119905119862119890119897119897 is blue cell and countingClusterthen119888119900119906119899119905 = 119888119900119906119899119905 + 1labeling = 119905119903119906119890countingCluster = false

endif 119904 119908 neighbor of currentCell is red white respectly and119888119906119903119903119890119899119905119878119905119886119905119890 isin 119902119890 119902119899 thenlabeling = falsecountingCluster = true

end119888119906119903119903119890119899119905119862119890119897119897 = 119888119906119903119903119890119899119905119862119890119897119897 + 120595(119888119906119903119903119890119899119905119878119905119886119905119890 119886)119888119906119903119903119890119899119905119878119905119886119905119890 = 120593(119888119906119903119903119890119899119905119878119905119886119905119890 119886)119886 = neighbor of the 119888119906119903119903119890119899119905119862119890119897119897

end

Algorithm 1 FA traversing algorithm

The FA starts in state 119902119890 and uses states from set 119876until it finds a boundary cell on the top of the grid (blueone) In this moment the algorithm increments the counter119888119900119906119899119905 and sets the indicator labeling on true and the variablecountingCluster is set on false The algorithm labels a pathuntil the FA finds the lowest left cell on the bottom edge ofthe cluster After finding the lowest left end of an infinitecluster the FA goes in state 119902119890 and sets labeling on false andthe countingCluster is set on true After that the algorithmrepeats the process of traversing

The algorithm stops when the FA outputs 0

Lemma 3 The algorithm has linear time complexity

The FA uses von Neumann neighborhood with fourneighbors for each grid cell The automaton A119902119890 is never onthe same cell in the same state Therefore the FA cannot bemore than four times in a particular cell during the executionof the algorithmThe complexity of the algorithm is thereforeO(119871) where 119871 is the number of grid cells

The algorithm was simulated in NetLogo programmingenvironment The algorithm was extensively evaluated onvarious test cases for different sizes of grid and initial densityof black cells in initial configuration In Figure 4 the last stateson the initial grids from Figure 1 are shown In Figure 5 a

grid of dimension 201 times 201 with probability 062 for a blackcell is shown with two infinity clusters after terminationof the FA algorithm By increasing the probability of blackcells infinite clusters more often appear as predicted also bythe percolation theory Also the results of the algorithm arein accordance with site percolation thresholds in the squarelattice ([16 24])

4 Conclusions

A FA-based algorithm for identification of connected pathsbetween top and bottomboundary cells in an arbitrary squaregrid is proposedThe constructed FA is minimal according tothe number of statesThe algorithm is based on four essentialstates 119902119890 119902119899 119902119908 and 119902119904 Using these states as FA input andassuming von Neumann neighborhood of the grid cells wecan traverse the boundaries of clusters Because the FA isindependent there is a possibility of putting more than oneautomaton in different initial cells Such a parallel approachcould further speed up the proposed algorithm Combiningthe property of FA which is never on the same cell in thesame state with labeling there is a possibility of using theFA in the detection of articulation cells ([25]) Finally furtherinvestigation can be focused on the necessary extensions ofthe algorithm for 3D grids

6 Mathematical Problems in Engineering

Figure 4 The FA traversing algorithm for the two examples from Figure 1

Figure 5 The FA traversing algorithm finds two infinite clusters ina grid of dimensions 201 times 201

Conflicts of Interest

The authors declare that there are no conflicts of interestregarding the publication of this paper

Acknowledgments

This work is supported by the Program of Science-Techno-logical Cooperation between governments of Montenegroand Serbia 2016ndash2018

References

[1] C E Shannon ldquoPresentation of a maze-solving machineCybernetics Transrdquo in proceedings of the 8th Conf of the JosiahMacu Jr Found pp 173ndash180 1951

[2] V B Kudryavtsev S M Uscumlic and G Kilibarda ldquoThebehavior of automata in labyrinthsrdquo Discrete mathematics andapplications vol 4 pp 3ndash28 1992

[3] G Kilibarda V B Kudryavtsev and S M Uscumlic ldquoCol-lectives of automata in labyrinthsrdquo Discrete Mathematics andApplications vol 15 pp 3ndash39 2003

[4] G Kilibarda ldquoUniversal labyrinth traps for finite sets ofautomatardquoDiscreteMathematics andApplications vol 2 pp 72ndash79 1990

[5] G Kilibarda ldquoOn the complexity of traversing labyrinths by anautomatonrdquo Discrete mathematics and applications vol 5 pp116ndash124 1993

[6] M Blum and D Kozen ldquoOn the power of the compassrdquo inProceedings of the 19th Annual Symposium on Foundations ofComputer Science pp 132ndash142 1978

[7] B Stamatovic ldquoOn recognizing labyrinth with automatardquo Dis-crete Mathematics and Applications vol 12 pp 51ndash65 2000

[8] B Stamatovic ldquoAutomata recognition two-connected labyrinthwith finite cycle diameterrdquo Programming and Computer Soft-ware vol 36 pp 149ndash157 2010

[9] S Kirkpatrick ldquoPercolation and conductionrdquo Reviews of Mod-ern Physics vol 45 no 4 pp 574ndash588 1973

[10] B I Shklovskii and A L Efros Electronic Properties of DopedSemiconductors Springer-Verlag 1984

[11] D Stauffer Introduction to PercolationTheory Taylor amp FrancisAbingdon UK 1992

[12] Fractals and Disordered Systems A Bunde and S Havlin EdsSpringer-Verlag Berlin Germany 1996

[13] J Hoshen P Klymko and R Kopelman ldquoPercolation andcluster distribution III Algorithms for the site-bond problemrdquoJournal of Statistical Physics vol 21 no 5 pp 583ndash600 1979

[14] E Stoll ldquoA fast cluster counting algorithm for percolation onand off latticesrdquoComputer Physics Communications vol 109 no1 pp 1ndash5 1998

[15] R C Brower P Tamayo and B York ldquoA parallel multigridalgorithm for percolation clustersrdquo Journal of Statistical Physicsvol 63 no 1-2 pp 73ndash88 1991

[16] M E J Newman and R M Ziff ldquoEfficient Monte Carloalgorithm and high-precision results for percolationrdquo PhysicalReview Letters vol 85 no 19 pp 4104ndash4107 2000

[17] R Trobec and B Stamatovic ldquoAnalysis and classification offlow-carrying backbones in two-dimensional latticesrdquoAdvancesin Engineering Software vol 103 pp 38ndash45 2017

Mathematical Problems in Engineering 7

[18] B Stamatovic and R Trobec ldquoCellular automata labeling ofconnected components in n-dimensional binary latticesrdquo TheJournal of Supercomputing vol 72 no 11 pp 4221ndash4232 2016

[19] R M Ziff P T Cummings and G Stells ldquoGeneration ofpercolation cluster perimeters by a random walkrdquo Journal ofPhysics A General Physics vol 17 no 15 article no 018 pp3009ndash3017 1984

[20] R M Ziff ldquoHull-generating walksrdquo Physica D Nonlinear Phe-nomena vol 38 no 1-3 pp 377ndash383 1989

[21] R M Ziff ldquoSpanning probability in 2D percolationrdquo PhysicalReview Letters vol 69 no 18 pp 2670ndash2673 1992

[22] H Fleischner ldquoEulerian graphs and related topicsrdquo Annals ofDiscrete Mathematics No 50 Part 1 vol 2 1991

[23] T Y Kong and A Rosenfeld ldquoDigital topology Introductionand surveyrdquo Computer Vision Graphics and Image Processingvol 48 no 3 pp 357ndash393 1989

[24] M J Lee ldquoPseudo-random-number generators and the squaresite percolation thresholdrdquo Physical Review E Statistical Non-linear and Soft Matter Physics vol 78 no 3 Article ID 0311312008

[25] W-G Yin and R Tao ldquoAlgorithm for finding two-dimensionalsite percolation backbonesrdquo Physica B Condensed Matter vol279 no 1-3 pp 84ndash86 2000

Submit your manuscripts athttpswwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 201

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 2: Algorithm for Identification of Infinite Clusters Based on ...downloads.hindawi.com/journals/mpe/2017/8251305.pdf · ResearchArticle Algorithm for Identification of Infinite Clusters

2 Mathematical Problems in Engineering

(a) (b)

Figure 1 Examples of percolation site models on 13 times 13 grid generated with probability 119901 = 055 without infinite cluster (a) and generatedwith probability 119901 = 060 with infinite cluster (b)

algorithm) The automaton A1199020 can be launched from anycell of a grid In any moment the input ofA1199020 is informationabout von Neumann neighborhood of the present cell givenin the form of a 5-tuple representing the state of the centralcell and the states of its four neighbors In the next momentdepending on its present state and its input the FA proceedsfrom the present cell in one of the directions defined by theoutput symbols 119890 119899 119908 or 119904 (denoting the correspondingdirections east north west or south resp) and moves intoa corresponding neighbor cell or stays at the same place ifoutput symbol is 0 (which means ldquono moverdquo) and passesinto a new state On the bases of this automaton we givean algorithm which can be used for findingidentifying andcounting infinite clusters in the given grid Such algorithmis simple to implement and does not need extra memoryor stacks The time complexity of the algorithm is linearand not larger than the time complexity of already existingalgorithms The FA has only four states including the initialstate We have proved that this is the minimal FA accordingto the number of states

The paper is organized as follows In Section 2 generalgrid-related definitions and definitions of the FA and itsproperties are given In Section 3 the FA-based algorithm forcounting connected paths is described and its complexity isproved The main conclusions and results are summarized inSection 4

2 Definition

21 General Definitions The planar site percolation model(see Figure 1) is represented by a two-dimensional latticenetwork (grid) of unit squares (cells) whose centers are in theinteger lattice with 119871 = 119883times119884 cells119883119884 ge 4The cell positionis determined by its center Each cell can exist in two differentstates 0 or 1 where state 0 is usually called ldquowhiterdquo and state 1is usually called ldquoblackrdquo The boundary cells of the simulatedgrid are in a fixed state which remains constant throughout

the simulationThe boundary cells on the bottom edge of thegrid are in state 2 which is called ldquoredrdquo and the boundarycells on the top edge of the grid are in state 3 which is calledldquobluerdquo The boundary cells on the left and right edge of thegrid are white State 4 which is called ldquoorangerdquo is used forthe notation of labeled cells in the grid

Two different cells (1198941 1198951) and (1198942 1198952) from a grid areadjacent (weakly adjacent) if |1198941 minus 1198942| + |1198951 minus 1198952| = 1 (max|1198941 minus1198942| |1198951 minus 1198952| = 1) Two black (white) cells (1198941 1198951) and (119894119899 119895119899)are connected if there exists a sequence of black (white) cells(119894119896 119895119896) 2 le 119896 le 119899 such that each pair (119894119896minus1 119895119896minus1) and (119894119896 119895119896)are adjacent such sequence is called a path Blue-red path isa path whose one end is adjacent to a blue and the other to ared cell A set of cells is connected if any two cells from theset are connected A maximum connected set of black cells iscalled a cluster The infinite cluster is a cluster that contains ablue-red path

Similarly black (white) cells (1198941 1198951) and (119894119899 119895119899) are weaklyconnected if there exists a sequence of black (white) cells(119894119896 119895119896) 2 le 119896 le 119899 such that each pair (119894119896minus1 119895119896minus1) and (119894119896 119895119896)are weakly adjacent A maximum weakly connected set ofwhite cells is called a hole

22 Definition of the Initial Finite Automaton A1199020 Let 119890 =(1 0) 119899 = (0 1) 119908 = (minus1 0) and 119904 = (0 minus1) be basicEuclidean vectors Denote by119881 the set 119890 119899 119908 119904 We use thenotations 119890 = 119908119908 = 119890 119904 = 119899 and 119899 = 119904 For a cell 119888 = (119894 119895) ina grid its neighbors are cells 119888 + 119890 = (119894 + 1 119895) 119888 +119899 = (119894 119895 + 1)119888+119908 = (119894minus1 119895) and 119888+119904 = (119894 119895minus1) Hence the vonNeumannneighborhood is used in this paper (see Figure 2(a))

Let 119904119888 = 119904(119894119895) be the state of the cell 119888 andN(119888) = 120572 isin 119881 |119904119888+120572 = 1

Let 120587 = (119890 119899 119908 119904) be a cyclic permutation For 119872 sube119881 119872 = 0 and 120572 isin 119881 denote by 120587119872(120572) the element 1205871198990(120572)where 1198990 = min119899 isin N | 120587119899(120572) isin 119872 where N is the set ofnatural numbers

Mathematical Problems in Engineering 3

(a)

ci+1jminus1cijminus1ciminus1jminus1

ci+1jciminus1j

ci+1j+1cij+1ciminus1j+1

cij

(b)

Figure 2 Von Neumann neighborhood and enumeration

By a finite automaton (FA) A we mean a quintuple(119860 119876 119861 120593 120595) where the finite nonempty sets119860119876 and 119861 arethe input alphabet the set of states and the output alphabetof the automaton respectively 120595 119876 times 119860 rarr 119861 is its outputfunction and 120593 119876times119860 rarr 119876 is its state-transition function Ifwemark a state 1199020 isin 119876 as an initial state ofA we get an initialautomatonA1199020 = (119860119876 119861 120593 120595 1199020) (in other wordsA1199020 is aMealy machine)

Further we consider the initial FA A119902119890 = (119860119876 119861 120593

120595 119902119890) supposing that 119860 = 0 1 2 3 45 119876 = 119902119890 119902119899 119902119908 119902119904and 119861 = 0 119890 119899 119908 119904 The starting cell of this automaton ina grid is always the lowest right corner cell of the grid Ifthe output symbol of A119902119890 is 120572 isin 119890 119899 119908 119904 we say that FAproceeds in the direction 120572 If the output symbol is 0 theFA stops This way FA simulates movements (goes aroundtraverses) through a grid

An input symbol 119886 = (1198860 1198861 1198862 1198863 1198864) = (119904(119894119895) 119904(119894+1119895)

119904(119894119895+1) 119904(119894minus1119895) 119904(119894119895minus1)) isin 119860 = 0 1 2 3 45 represents thestate of a cell and the states of its von Neumann neighborsconsistent with the enumeration in Figure 2(b) For the inputsymbol 119886 by 119888(119886) we denote the central cell

The FA starts in state 119902119890 and uses states from set 119876 untilit finds a boundary cell on the top of the grid (blue one) Inthismoment the algorithm increments the counter of infiniteclusters and starts labeling cells with an orange color Thealgorithm labels a path until the FA finds a boundary cell onthe bottom edge of the grid (red one) After finding the lowestleft end of an infinite cluster the FA proceeds in the 119908 (west)direction and it is on a white cell and in state 119902119890 After thatthe algorithm breaks labeling and starts with new counting ofinfinite clusters and the FA repeats the process of traversingThe algorithm stops when the output of the FA is 0

The functions 120593 and 120595 are defined in the followingway Let 119888 = (119894 119895) be a cell and let 119886 = (119904(119894119895) 119904(119894+1119895)119904(119894119895+1) 119904(119894minus1119895) 119904(119894119895minus1)) 119909 isin 0 1 2 3 and 119910 isin 1 4 Thenfor 120572 isin 119890 119899 119908 119904 and input 119886 = (119910 119909 119909 119909 119909) the functions120593 and 120595 are defined by 120593(119902120572 119886) = 119902120573 and 120595(119902120572 119886) =

120573 where 120573 = 120587N(119888(119886))(120572) (see Figure 3) except for someldquostartingrdquo ldquoendingrdquo or ldquochangingrdquo parts which are given bythe following

(i) If 119894 lt 119883 then

(a) for 119886 = (0 119909 119909 119909 2) or 119886 = (1 119909 0 119909 2)120593(119902119890 119886) = 119902119890 and 120595(119902119890 119886) = 119908

(b) for 119886 = (1 119909 1 119909 2)120593(119902119890 119886) = 119902119904 and120595(119902119890 119886) =119899

(c) for 119886 = (119910 119909 119909 0 2) and 119902 isin 119902119899 119902119890 120593(119902 119886) =119902119890 and 120595(119902 119886) = 119908

(ii) If 119894 = 119883 then for 119886 = (119910 119909 119909 119909 2) 120593(119902119890 119886) = 119902119890 and120595(119902119890 119886) = 0

Notice two properties of the FAA119902119890

(1) In the initial state the FA is on the cell that has redcell on the south (119904(119894119895minus1) = 2) The FA goes in the westdirection until it finds the black cell with black cell onthe north If it cannot find it the FA stops

(2) Themeaning of the fact that the FA is on the cell 119888 andis in the state 119902120572 is that the FA has arrived on the cell119888 from the direction 120572 120572 isin 119881 (see Figure 3)

The initial automaton A119902119890 and the initial planarsite percolation model (1198620 119888(0)) where 119888(0) is thecell on the lowest right corner of a grid 1198620 create thesequence 119878(119860119902119890 (1198620 119888(0))) = ((119888(0) 119902119890 1198860 1198870) (119888(1) 11990211198861 1198871) (119888(119894) 119902119894 119886119894 119887119894) (119888(119894 + 1) 119902119894+1 119886119894+1 119887119894+1) ) where119886119894 represents the neighborhood of the cell 119888(119894) (119888(119894) = 119888(119886119894))119887119894 = 120595(119902119894 119886119894) 119888(119894 + 1) = 119888(119894) + 119887119894 119902119894+1 = 120593(119902119894 119886119894) 119894 ge 0

Let 119877119904 = (119894 119895) isin 1198620 | 119904(119894119895) = 1 119904(119894+1119895) = 0 119904(119894119895minus1) = 2Properties of the FA A119902119890 which will be crucial for the

algorithm are defined by the following theorem

Theorem 1 A blue-red path exists in the planar site percola-tion model 1198620 if and only if there exists a cell 1198881015840(0) isin 119877119904 suchthat the sequence (1198881015840(0) 1198881015840(1) 1198881015840(119899)) 119899 ge 0 of the cells inthe sequence 119878(A119902119890 (1198620 119888(0))) creates a blue-red path

Choosing the cyclic permutation120587 in the definition of theFAA119902119890 we define an orientation Namely if the FA comes onthe cell 119888 from direction 120572 isin 119881 then the right ahead left andbehind cell (from the cell 119888) are 119888 + 120587(120572) 119888 + 1205872(120572) 119888 + 1205873(120572)and 119888 + 1205874(120572) = 120572 respectively

Let 119875 be a blue-red path in the grid 1198620 and 119870119875 be theinfinite cluster that encloses path 119875 Let 119888119903119904 isin 119877119904 be the lowestright cell in the cluster119870119875 and119867119875 be the subset of the infinitehole which is on the right side of the cluster Right boundaryof the cluster 119870119875 119870119867119875 = 119888 isin 119870119875 | 119888 is weakly adjacentto some cell from 119867119875 is connected and encloses a blue-redpath Notice that 119888119903119904 isin 119870119867119875

It is not hard to see that the FA A119902119890 implementsldquoleft-hand-on-wallrdquo algorithm ([23]) Starting from the cell

4 Mathematical Problems in Engineering

n

e

e

X 0 X

1 1 1

XxX

X 0 x

0 1 1

X 1 x

X 1 X

x 1 0

X 1 X

X 1 X

1 1 0

X 0 x

X 0 X

1 1 0

X 0 XX 1X

x 1 1

x xX

X 0 X

1 1 0

x 1 X

X 0 x

1 1 0

X 1 X

X 1 X

0 1 0

X 0 XX 1 x

x 1 1

XxX

X 0 x

0 1 1

X 0 x

X 1 X

0 1 x

X 1 X

X 0 X

0 1 0

X 1 X

X 1 x

1 1 x

x xX

x x x

x 1 1

X 1 X

X 0 X

1 1 1

XxX

n

n

w

w

e

w

s

s

s

s

n

w

e

qe

qs

qn

qw

Figure 3 Traversing part of the FAA119902119890 where 119909 isin 0 1 2 3 before starting labeling

119888119903119904 the FA traverses 119870119867119875 and the subsequence (1198881015840(0) =

119888119903119904 1198881015840(1) 1198881015840(119899)) for some 119899 isin N of the sequence

119878(A119902119890 (1198620 119888(0))) creates a blue-red pathIf there is not a connected path between red and blue cells

in the grid 1198620 then for all cells 119888 isin 119877119904 the sequence (119888 =1198880 1198881 119888119899 ) 119899 ge 0 will not contain a cell with blue northneighbor The grid is finite and the FA will stop on the lowestleft cell of the grid

Theorem 2 According to the number of states the FA A119902119890 isthe minimal initial finite automaton

In the example from Figure 1(b) notice cell 119886 It is in theinfinite cluster and it is weakly adjacent by the right infinitehole Traversing the cluster by the left-hand rule the FAA119902119890is four times in the cell 119886 (from south east north and westsides) All the visits must be done in different automaton

states (input is the same) Otherwise the FA makes a cycleHence for traversing a border of a cluster it is necessary tohave 4 states

3 The FA Traversing Algorithm andIts Time Complexity

The algorithm for identification of infinite clusters is basedon the FA A119902119890 To ensure appropriate counting of infiniteclusters the algorithm uses three global variables countlabeling and countingClusterThe count counts the number ofinfinite clusters labeling is an indicator for labeling cells andcountingCluster is an indicator for the counting of the infinitecluster

Let (1198620 119888(0)) be an initial grid where1198620 is a grid and 119888(0)is its lowest right corner Let 119902119890 be the initial state of the FAA119902119890 The algorithm is presented as Algorithm 1

Mathematical Problems in Engineering 5

Data Initial grid (1198620 119888(0))Result 119888119900119906119899119905 is number of infinite clusters and labeled blue-red paths119888119900119906119899119905 = 0119888119906119903119903119890119899119905119878119905119886119905119890 = 119902119890119888119906119903119903119890119899119905119862119890119897119897 = 119888(0)Labeling = falsecountingCluster = true119886 = neighbor of the 119888119906119903119903119890119899119905119862119890119897119897while 120595(119888119906119903119903119890119899119905119878119905119886119905119890 119886) ltgt 0 do

if labeling == 119905119903119906119890 thenlabel 119888119906119903119903119890119899119905119862119890119897119897

endif north neighbor of 119888119906119903119903119890119899119905119862119890119897119897 is blue cell and countingClusterthen119888119900119906119899119905 = 119888119900119906119899119905 + 1labeling = 119905119903119906119890countingCluster = false

endif 119904 119908 neighbor of currentCell is red white respectly and119888119906119903119903119890119899119905119878119905119886119905119890 isin 119902119890 119902119899 thenlabeling = falsecountingCluster = true

end119888119906119903119903119890119899119905119862119890119897119897 = 119888119906119903119903119890119899119905119862119890119897119897 + 120595(119888119906119903119903119890119899119905119878119905119886119905119890 119886)119888119906119903119903119890119899119905119878119905119886119905119890 = 120593(119888119906119903119903119890119899119905119878119905119886119905119890 119886)119886 = neighbor of the 119888119906119903119903119890119899119905119862119890119897119897

end

Algorithm 1 FA traversing algorithm

The FA starts in state 119902119890 and uses states from set 119876until it finds a boundary cell on the top of the grid (blueone) In this moment the algorithm increments the counter119888119900119906119899119905 and sets the indicator labeling on true and the variablecountingCluster is set on false The algorithm labels a pathuntil the FA finds the lowest left cell on the bottom edge ofthe cluster After finding the lowest left end of an infinitecluster the FA goes in state 119902119890 and sets labeling on false andthe countingCluster is set on true After that the algorithmrepeats the process of traversing

The algorithm stops when the FA outputs 0

Lemma 3 The algorithm has linear time complexity

The FA uses von Neumann neighborhood with fourneighbors for each grid cell The automaton A119902119890 is never onthe same cell in the same state Therefore the FA cannot bemore than four times in a particular cell during the executionof the algorithmThe complexity of the algorithm is thereforeO(119871) where 119871 is the number of grid cells

The algorithm was simulated in NetLogo programmingenvironment The algorithm was extensively evaluated onvarious test cases for different sizes of grid and initial densityof black cells in initial configuration In Figure 4 the last stateson the initial grids from Figure 1 are shown In Figure 5 a

grid of dimension 201 times 201 with probability 062 for a blackcell is shown with two infinity clusters after terminationof the FA algorithm By increasing the probability of blackcells infinite clusters more often appear as predicted also bythe percolation theory Also the results of the algorithm arein accordance with site percolation thresholds in the squarelattice ([16 24])

4 Conclusions

A FA-based algorithm for identification of connected pathsbetween top and bottomboundary cells in an arbitrary squaregrid is proposedThe constructed FA is minimal according tothe number of statesThe algorithm is based on four essentialstates 119902119890 119902119899 119902119908 and 119902119904 Using these states as FA input andassuming von Neumann neighborhood of the grid cells wecan traverse the boundaries of clusters Because the FA isindependent there is a possibility of putting more than oneautomaton in different initial cells Such a parallel approachcould further speed up the proposed algorithm Combiningthe property of FA which is never on the same cell in thesame state with labeling there is a possibility of using theFA in the detection of articulation cells ([25]) Finally furtherinvestigation can be focused on the necessary extensions ofthe algorithm for 3D grids

6 Mathematical Problems in Engineering

Figure 4 The FA traversing algorithm for the two examples from Figure 1

Figure 5 The FA traversing algorithm finds two infinite clusters ina grid of dimensions 201 times 201

Conflicts of Interest

The authors declare that there are no conflicts of interestregarding the publication of this paper

Acknowledgments

This work is supported by the Program of Science-Techno-logical Cooperation between governments of Montenegroand Serbia 2016ndash2018

References

[1] C E Shannon ldquoPresentation of a maze-solving machineCybernetics Transrdquo in proceedings of the 8th Conf of the JosiahMacu Jr Found pp 173ndash180 1951

[2] V B Kudryavtsev S M Uscumlic and G Kilibarda ldquoThebehavior of automata in labyrinthsrdquo Discrete mathematics andapplications vol 4 pp 3ndash28 1992

[3] G Kilibarda V B Kudryavtsev and S M Uscumlic ldquoCol-lectives of automata in labyrinthsrdquo Discrete Mathematics andApplications vol 15 pp 3ndash39 2003

[4] G Kilibarda ldquoUniversal labyrinth traps for finite sets ofautomatardquoDiscreteMathematics andApplications vol 2 pp 72ndash79 1990

[5] G Kilibarda ldquoOn the complexity of traversing labyrinths by anautomatonrdquo Discrete mathematics and applications vol 5 pp116ndash124 1993

[6] M Blum and D Kozen ldquoOn the power of the compassrdquo inProceedings of the 19th Annual Symposium on Foundations ofComputer Science pp 132ndash142 1978

[7] B Stamatovic ldquoOn recognizing labyrinth with automatardquo Dis-crete Mathematics and Applications vol 12 pp 51ndash65 2000

[8] B Stamatovic ldquoAutomata recognition two-connected labyrinthwith finite cycle diameterrdquo Programming and Computer Soft-ware vol 36 pp 149ndash157 2010

[9] S Kirkpatrick ldquoPercolation and conductionrdquo Reviews of Mod-ern Physics vol 45 no 4 pp 574ndash588 1973

[10] B I Shklovskii and A L Efros Electronic Properties of DopedSemiconductors Springer-Verlag 1984

[11] D Stauffer Introduction to PercolationTheory Taylor amp FrancisAbingdon UK 1992

[12] Fractals and Disordered Systems A Bunde and S Havlin EdsSpringer-Verlag Berlin Germany 1996

[13] J Hoshen P Klymko and R Kopelman ldquoPercolation andcluster distribution III Algorithms for the site-bond problemrdquoJournal of Statistical Physics vol 21 no 5 pp 583ndash600 1979

[14] E Stoll ldquoA fast cluster counting algorithm for percolation onand off latticesrdquoComputer Physics Communications vol 109 no1 pp 1ndash5 1998

[15] R C Brower P Tamayo and B York ldquoA parallel multigridalgorithm for percolation clustersrdquo Journal of Statistical Physicsvol 63 no 1-2 pp 73ndash88 1991

[16] M E J Newman and R M Ziff ldquoEfficient Monte Carloalgorithm and high-precision results for percolationrdquo PhysicalReview Letters vol 85 no 19 pp 4104ndash4107 2000

[17] R Trobec and B Stamatovic ldquoAnalysis and classification offlow-carrying backbones in two-dimensional latticesrdquoAdvancesin Engineering Software vol 103 pp 38ndash45 2017

Mathematical Problems in Engineering 7

[18] B Stamatovic and R Trobec ldquoCellular automata labeling ofconnected components in n-dimensional binary latticesrdquo TheJournal of Supercomputing vol 72 no 11 pp 4221ndash4232 2016

[19] R M Ziff P T Cummings and G Stells ldquoGeneration ofpercolation cluster perimeters by a random walkrdquo Journal ofPhysics A General Physics vol 17 no 15 article no 018 pp3009ndash3017 1984

[20] R M Ziff ldquoHull-generating walksrdquo Physica D Nonlinear Phe-nomena vol 38 no 1-3 pp 377ndash383 1989

[21] R M Ziff ldquoSpanning probability in 2D percolationrdquo PhysicalReview Letters vol 69 no 18 pp 2670ndash2673 1992

[22] H Fleischner ldquoEulerian graphs and related topicsrdquo Annals ofDiscrete Mathematics No 50 Part 1 vol 2 1991

[23] T Y Kong and A Rosenfeld ldquoDigital topology Introductionand surveyrdquo Computer Vision Graphics and Image Processingvol 48 no 3 pp 357ndash393 1989

[24] M J Lee ldquoPseudo-random-number generators and the squaresite percolation thresholdrdquo Physical Review E Statistical Non-linear and Soft Matter Physics vol 78 no 3 Article ID 0311312008

[25] W-G Yin and R Tao ldquoAlgorithm for finding two-dimensionalsite percolation backbonesrdquo Physica B Condensed Matter vol279 no 1-3 pp 84ndash86 2000

Submit your manuscripts athttpswwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 201

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 3: Algorithm for Identification of Infinite Clusters Based on ...downloads.hindawi.com/journals/mpe/2017/8251305.pdf · ResearchArticle Algorithm for Identification of Infinite Clusters

Mathematical Problems in Engineering 3

(a)

ci+1jminus1cijminus1ciminus1jminus1

ci+1jciminus1j

ci+1j+1cij+1ciminus1j+1

cij

(b)

Figure 2 Von Neumann neighborhood and enumeration

By a finite automaton (FA) A we mean a quintuple(119860 119876 119861 120593 120595) where the finite nonempty sets119860119876 and 119861 arethe input alphabet the set of states and the output alphabetof the automaton respectively 120595 119876 times 119860 rarr 119861 is its outputfunction and 120593 119876times119860 rarr 119876 is its state-transition function Ifwemark a state 1199020 isin 119876 as an initial state ofA we get an initialautomatonA1199020 = (119860119876 119861 120593 120595 1199020) (in other wordsA1199020 is aMealy machine)

Further we consider the initial FA A119902119890 = (119860119876 119861 120593

120595 119902119890) supposing that 119860 = 0 1 2 3 45 119876 = 119902119890 119902119899 119902119908 119902119904and 119861 = 0 119890 119899 119908 119904 The starting cell of this automaton ina grid is always the lowest right corner cell of the grid Ifthe output symbol of A119902119890 is 120572 isin 119890 119899 119908 119904 we say that FAproceeds in the direction 120572 If the output symbol is 0 theFA stops This way FA simulates movements (goes aroundtraverses) through a grid

An input symbol 119886 = (1198860 1198861 1198862 1198863 1198864) = (119904(119894119895) 119904(119894+1119895)

119904(119894119895+1) 119904(119894minus1119895) 119904(119894119895minus1)) isin 119860 = 0 1 2 3 45 represents thestate of a cell and the states of its von Neumann neighborsconsistent with the enumeration in Figure 2(b) For the inputsymbol 119886 by 119888(119886) we denote the central cell

The FA starts in state 119902119890 and uses states from set 119876 untilit finds a boundary cell on the top of the grid (blue one) Inthismoment the algorithm increments the counter of infiniteclusters and starts labeling cells with an orange color Thealgorithm labels a path until the FA finds a boundary cell onthe bottom edge of the grid (red one) After finding the lowestleft end of an infinite cluster the FA proceeds in the 119908 (west)direction and it is on a white cell and in state 119902119890 After thatthe algorithm breaks labeling and starts with new counting ofinfinite clusters and the FA repeats the process of traversingThe algorithm stops when the output of the FA is 0

The functions 120593 and 120595 are defined in the followingway Let 119888 = (119894 119895) be a cell and let 119886 = (119904(119894119895) 119904(119894+1119895)119904(119894119895+1) 119904(119894minus1119895) 119904(119894119895minus1)) 119909 isin 0 1 2 3 and 119910 isin 1 4 Thenfor 120572 isin 119890 119899 119908 119904 and input 119886 = (119910 119909 119909 119909 119909) the functions120593 and 120595 are defined by 120593(119902120572 119886) = 119902120573 and 120595(119902120572 119886) =

120573 where 120573 = 120587N(119888(119886))(120572) (see Figure 3) except for someldquostartingrdquo ldquoendingrdquo or ldquochangingrdquo parts which are given bythe following

(i) If 119894 lt 119883 then

(a) for 119886 = (0 119909 119909 119909 2) or 119886 = (1 119909 0 119909 2)120593(119902119890 119886) = 119902119890 and 120595(119902119890 119886) = 119908

(b) for 119886 = (1 119909 1 119909 2)120593(119902119890 119886) = 119902119904 and120595(119902119890 119886) =119899

(c) for 119886 = (119910 119909 119909 0 2) and 119902 isin 119902119899 119902119890 120593(119902 119886) =119902119890 and 120595(119902 119886) = 119908

(ii) If 119894 = 119883 then for 119886 = (119910 119909 119909 119909 2) 120593(119902119890 119886) = 119902119890 and120595(119902119890 119886) = 0

Notice two properties of the FAA119902119890

(1) In the initial state the FA is on the cell that has redcell on the south (119904(119894119895minus1) = 2) The FA goes in the westdirection until it finds the black cell with black cell onthe north If it cannot find it the FA stops

(2) Themeaning of the fact that the FA is on the cell 119888 andis in the state 119902120572 is that the FA has arrived on the cell119888 from the direction 120572 120572 isin 119881 (see Figure 3)

The initial automaton A119902119890 and the initial planarsite percolation model (1198620 119888(0)) where 119888(0) is thecell on the lowest right corner of a grid 1198620 create thesequence 119878(119860119902119890 (1198620 119888(0))) = ((119888(0) 119902119890 1198860 1198870) (119888(1) 11990211198861 1198871) (119888(119894) 119902119894 119886119894 119887119894) (119888(119894 + 1) 119902119894+1 119886119894+1 119887119894+1) ) where119886119894 represents the neighborhood of the cell 119888(119894) (119888(119894) = 119888(119886119894))119887119894 = 120595(119902119894 119886119894) 119888(119894 + 1) = 119888(119894) + 119887119894 119902119894+1 = 120593(119902119894 119886119894) 119894 ge 0

Let 119877119904 = (119894 119895) isin 1198620 | 119904(119894119895) = 1 119904(119894+1119895) = 0 119904(119894119895minus1) = 2Properties of the FA A119902119890 which will be crucial for the

algorithm are defined by the following theorem

Theorem 1 A blue-red path exists in the planar site percola-tion model 1198620 if and only if there exists a cell 1198881015840(0) isin 119877119904 suchthat the sequence (1198881015840(0) 1198881015840(1) 1198881015840(119899)) 119899 ge 0 of the cells inthe sequence 119878(A119902119890 (1198620 119888(0))) creates a blue-red path

Choosing the cyclic permutation120587 in the definition of theFAA119902119890 we define an orientation Namely if the FA comes onthe cell 119888 from direction 120572 isin 119881 then the right ahead left andbehind cell (from the cell 119888) are 119888 + 120587(120572) 119888 + 1205872(120572) 119888 + 1205873(120572)and 119888 + 1205874(120572) = 120572 respectively

Let 119875 be a blue-red path in the grid 1198620 and 119870119875 be theinfinite cluster that encloses path 119875 Let 119888119903119904 isin 119877119904 be the lowestright cell in the cluster119870119875 and119867119875 be the subset of the infinitehole which is on the right side of the cluster Right boundaryof the cluster 119870119875 119870119867119875 = 119888 isin 119870119875 | 119888 is weakly adjacentto some cell from 119867119875 is connected and encloses a blue-redpath Notice that 119888119903119904 isin 119870119867119875

It is not hard to see that the FA A119902119890 implementsldquoleft-hand-on-wallrdquo algorithm ([23]) Starting from the cell

4 Mathematical Problems in Engineering

n

e

e

X 0 X

1 1 1

XxX

X 0 x

0 1 1

X 1 x

X 1 X

x 1 0

X 1 X

X 1 X

1 1 0

X 0 x

X 0 X

1 1 0

X 0 XX 1X

x 1 1

x xX

X 0 X

1 1 0

x 1 X

X 0 x

1 1 0

X 1 X

X 1 X

0 1 0

X 0 XX 1 x

x 1 1

XxX

X 0 x

0 1 1

X 0 x

X 1 X

0 1 x

X 1 X

X 0 X

0 1 0

X 1 X

X 1 x

1 1 x

x xX

x x x

x 1 1

X 1 X

X 0 X

1 1 1

XxX

n

n

w

w

e

w

s

s

s

s

n

w

e

qe

qs

qn

qw

Figure 3 Traversing part of the FAA119902119890 where 119909 isin 0 1 2 3 before starting labeling

119888119903119904 the FA traverses 119870119867119875 and the subsequence (1198881015840(0) =

119888119903119904 1198881015840(1) 1198881015840(119899)) for some 119899 isin N of the sequence

119878(A119902119890 (1198620 119888(0))) creates a blue-red pathIf there is not a connected path between red and blue cells

in the grid 1198620 then for all cells 119888 isin 119877119904 the sequence (119888 =1198880 1198881 119888119899 ) 119899 ge 0 will not contain a cell with blue northneighbor The grid is finite and the FA will stop on the lowestleft cell of the grid

Theorem 2 According to the number of states the FA A119902119890 isthe minimal initial finite automaton

In the example from Figure 1(b) notice cell 119886 It is in theinfinite cluster and it is weakly adjacent by the right infinitehole Traversing the cluster by the left-hand rule the FAA119902119890is four times in the cell 119886 (from south east north and westsides) All the visits must be done in different automaton

states (input is the same) Otherwise the FA makes a cycleHence for traversing a border of a cluster it is necessary tohave 4 states

3 The FA Traversing Algorithm andIts Time Complexity

The algorithm for identification of infinite clusters is basedon the FA A119902119890 To ensure appropriate counting of infiniteclusters the algorithm uses three global variables countlabeling and countingClusterThe count counts the number ofinfinite clusters labeling is an indicator for labeling cells andcountingCluster is an indicator for the counting of the infinitecluster

Let (1198620 119888(0)) be an initial grid where1198620 is a grid and 119888(0)is its lowest right corner Let 119902119890 be the initial state of the FAA119902119890 The algorithm is presented as Algorithm 1

Mathematical Problems in Engineering 5

Data Initial grid (1198620 119888(0))Result 119888119900119906119899119905 is number of infinite clusters and labeled blue-red paths119888119900119906119899119905 = 0119888119906119903119903119890119899119905119878119905119886119905119890 = 119902119890119888119906119903119903119890119899119905119862119890119897119897 = 119888(0)Labeling = falsecountingCluster = true119886 = neighbor of the 119888119906119903119903119890119899119905119862119890119897119897while 120595(119888119906119903119903119890119899119905119878119905119886119905119890 119886) ltgt 0 do

if labeling == 119905119903119906119890 thenlabel 119888119906119903119903119890119899119905119862119890119897119897

endif north neighbor of 119888119906119903119903119890119899119905119862119890119897119897 is blue cell and countingClusterthen119888119900119906119899119905 = 119888119900119906119899119905 + 1labeling = 119905119903119906119890countingCluster = false

endif 119904 119908 neighbor of currentCell is red white respectly and119888119906119903119903119890119899119905119878119905119886119905119890 isin 119902119890 119902119899 thenlabeling = falsecountingCluster = true

end119888119906119903119903119890119899119905119862119890119897119897 = 119888119906119903119903119890119899119905119862119890119897119897 + 120595(119888119906119903119903119890119899119905119878119905119886119905119890 119886)119888119906119903119903119890119899119905119878119905119886119905119890 = 120593(119888119906119903119903119890119899119905119878119905119886119905119890 119886)119886 = neighbor of the 119888119906119903119903119890119899119905119862119890119897119897

end

Algorithm 1 FA traversing algorithm

The FA starts in state 119902119890 and uses states from set 119876until it finds a boundary cell on the top of the grid (blueone) In this moment the algorithm increments the counter119888119900119906119899119905 and sets the indicator labeling on true and the variablecountingCluster is set on false The algorithm labels a pathuntil the FA finds the lowest left cell on the bottom edge ofthe cluster After finding the lowest left end of an infinitecluster the FA goes in state 119902119890 and sets labeling on false andthe countingCluster is set on true After that the algorithmrepeats the process of traversing

The algorithm stops when the FA outputs 0

Lemma 3 The algorithm has linear time complexity

The FA uses von Neumann neighborhood with fourneighbors for each grid cell The automaton A119902119890 is never onthe same cell in the same state Therefore the FA cannot bemore than four times in a particular cell during the executionof the algorithmThe complexity of the algorithm is thereforeO(119871) where 119871 is the number of grid cells

The algorithm was simulated in NetLogo programmingenvironment The algorithm was extensively evaluated onvarious test cases for different sizes of grid and initial densityof black cells in initial configuration In Figure 4 the last stateson the initial grids from Figure 1 are shown In Figure 5 a

grid of dimension 201 times 201 with probability 062 for a blackcell is shown with two infinity clusters after terminationof the FA algorithm By increasing the probability of blackcells infinite clusters more often appear as predicted also bythe percolation theory Also the results of the algorithm arein accordance with site percolation thresholds in the squarelattice ([16 24])

4 Conclusions

A FA-based algorithm for identification of connected pathsbetween top and bottomboundary cells in an arbitrary squaregrid is proposedThe constructed FA is minimal according tothe number of statesThe algorithm is based on four essentialstates 119902119890 119902119899 119902119908 and 119902119904 Using these states as FA input andassuming von Neumann neighborhood of the grid cells wecan traverse the boundaries of clusters Because the FA isindependent there is a possibility of putting more than oneautomaton in different initial cells Such a parallel approachcould further speed up the proposed algorithm Combiningthe property of FA which is never on the same cell in thesame state with labeling there is a possibility of using theFA in the detection of articulation cells ([25]) Finally furtherinvestigation can be focused on the necessary extensions ofthe algorithm for 3D grids

6 Mathematical Problems in Engineering

Figure 4 The FA traversing algorithm for the two examples from Figure 1

Figure 5 The FA traversing algorithm finds two infinite clusters ina grid of dimensions 201 times 201

Conflicts of Interest

The authors declare that there are no conflicts of interestregarding the publication of this paper

Acknowledgments

This work is supported by the Program of Science-Techno-logical Cooperation between governments of Montenegroand Serbia 2016ndash2018

References

[1] C E Shannon ldquoPresentation of a maze-solving machineCybernetics Transrdquo in proceedings of the 8th Conf of the JosiahMacu Jr Found pp 173ndash180 1951

[2] V B Kudryavtsev S M Uscumlic and G Kilibarda ldquoThebehavior of automata in labyrinthsrdquo Discrete mathematics andapplications vol 4 pp 3ndash28 1992

[3] G Kilibarda V B Kudryavtsev and S M Uscumlic ldquoCol-lectives of automata in labyrinthsrdquo Discrete Mathematics andApplications vol 15 pp 3ndash39 2003

[4] G Kilibarda ldquoUniversal labyrinth traps for finite sets ofautomatardquoDiscreteMathematics andApplications vol 2 pp 72ndash79 1990

[5] G Kilibarda ldquoOn the complexity of traversing labyrinths by anautomatonrdquo Discrete mathematics and applications vol 5 pp116ndash124 1993

[6] M Blum and D Kozen ldquoOn the power of the compassrdquo inProceedings of the 19th Annual Symposium on Foundations ofComputer Science pp 132ndash142 1978

[7] B Stamatovic ldquoOn recognizing labyrinth with automatardquo Dis-crete Mathematics and Applications vol 12 pp 51ndash65 2000

[8] B Stamatovic ldquoAutomata recognition two-connected labyrinthwith finite cycle diameterrdquo Programming and Computer Soft-ware vol 36 pp 149ndash157 2010

[9] S Kirkpatrick ldquoPercolation and conductionrdquo Reviews of Mod-ern Physics vol 45 no 4 pp 574ndash588 1973

[10] B I Shklovskii and A L Efros Electronic Properties of DopedSemiconductors Springer-Verlag 1984

[11] D Stauffer Introduction to PercolationTheory Taylor amp FrancisAbingdon UK 1992

[12] Fractals and Disordered Systems A Bunde and S Havlin EdsSpringer-Verlag Berlin Germany 1996

[13] J Hoshen P Klymko and R Kopelman ldquoPercolation andcluster distribution III Algorithms for the site-bond problemrdquoJournal of Statistical Physics vol 21 no 5 pp 583ndash600 1979

[14] E Stoll ldquoA fast cluster counting algorithm for percolation onand off latticesrdquoComputer Physics Communications vol 109 no1 pp 1ndash5 1998

[15] R C Brower P Tamayo and B York ldquoA parallel multigridalgorithm for percolation clustersrdquo Journal of Statistical Physicsvol 63 no 1-2 pp 73ndash88 1991

[16] M E J Newman and R M Ziff ldquoEfficient Monte Carloalgorithm and high-precision results for percolationrdquo PhysicalReview Letters vol 85 no 19 pp 4104ndash4107 2000

[17] R Trobec and B Stamatovic ldquoAnalysis and classification offlow-carrying backbones in two-dimensional latticesrdquoAdvancesin Engineering Software vol 103 pp 38ndash45 2017

Mathematical Problems in Engineering 7

[18] B Stamatovic and R Trobec ldquoCellular automata labeling ofconnected components in n-dimensional binary latticesrdquo TheJournal of Supercomputing vol 72 no 11 pp 4221ndash4232 2016

[19] R M Ziff P T Cummings and G Stells ldquoGeneration ofpercolation cluster perimeters by a random walkrdquo Journal ofPhysics A General Physics vol 17 no 15 article no 018 pp3009ndash3017 1984

[20] R M Ziff ldquoHull-generating walksrdquo Physica D Nonlinear Phe-nomena vol 38 no 1-3 pp 377ndash383 1989

[21] R M Ziff ldquoSpanning probability in 2D percolationrdquo PhysicalReview Letters vol 69 no 18 pp 2670ndash2673 1992

[22] H Fleischner ldquoEulerian graphs and related topicsrdquo Annals ofDiscrete Mathematics No 50 Part 1 vol 2 1991

[23] T Y Kong and A Rosenfeld ldquoDigital topology Introductionand surveyrdquo Computer Vision Graphics and Image Processingvol 48 no 3 pp 357ndash393 1989

[24] M J Lee ldquoPseudo-random-number generators and the squaresite percolation thresholdrdquo Physical Review E Statistical Non-linear and Soft Matter Physics vol 78 no 3 Article ID 0311312008

[25] W-G Yin and R Tao ldquoAlgorithm for finding two-dimensionalsite percolation backbonesrdquo Physica B Condensed Matter vol279 no 1-3 pp 84ndash86 2000

Submit your manuscripts athttpswwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 201

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 4: Algorithm for Identification of Infinite Clusters Based on ...downloads.hindawi.com/journals/mpe/2017/8251305.pdf · ResearchArticle Algorithm for Identification of Infinite Clusters

4 Mathematical Problems in Engineering

n

e

e

X 0 X

1 1 1

XxX

X 0 x

0 1 1

X 1 x

X 1 X

x 1 0

X 1 X

X 1 X

1 1 0

X 0 x

X 0 X

1 1 0

X 0 XX 1X

x 1 1

x xX

X 0 X

1 1 0

x 1 X

X 0 x

1 1 0

X 1 X

X 1 X

0 1 0

X 0 XX 1 x

x 1 1

XxX

X 0 x

0 1 1

X 0 x

X 1 X

0 1 x

X 1 X

X 0 X

0 1 0

X 1 X

X 1 x

1 1 x

x xX

x x x

x 1 1

X 1 X

X 0 X

1 1 1

XxX

n

n

w

w

e

w

s

s

s

s

n

w

e

qe

qs

qn

qw

Figure 3 Traversing part of the FAA119902119890 where 119909 isin 0 1 2 3 before starting labeling

119888119903119904 the FA traverses 119870119867119875 and the subsequence (1198881015840(0) =

119888119903119904 1198881015840(1) 1198881015840(119899)) for some 119899 isin N of the sequence

119878(A119902119890 (1198620 119888(0))) creates a blue-red pathIf there is not a connected path between red and blue cells

in the grid 1198620 then for all cells 119888 isin 119877119904 the sequence (119888 =1198880 1198881 119888119899 ) 119899 ge 0 will not contain a cell with blue northneighbor The grid is finite and the FA will stop on the lowestleft cell of the grid

Theorem 2 According to the number of states the FA A119902119890 isthe minimal initial finite automaton

In the example from Figure 1(b) notice cell 119886 It is in theinfinite cluster and it is weakly adjacent by the right infinitehole Traversing the cluster by the left-hand rule the FAA119902119890is four times in the cell 119886 (from south east north and westsides) All the visits must be done in different automaton

states (input is the same) Otherwise the FA makes a cycleHence for traversing a border of a cluster it is necessary tohave 4 states

3 The FA Traversing Algorithm andIts Time Complexity

The algorithm for identification of infinite clusters is basedon the FA A119902119890 To ensure appropriate counting of infiniteclusters the algorithm uses three global variables countlabeling and countingClusterThe count counts the number ofinfinite clusters labeling is an indicator for labeling cells andcountingCluster is an indicator for the counting of the infinitecluster

Let (1198620 119888(0)) be an initial grid where1198620 is a grid and 119888(0)is its lowest right corner Let 119902119890 be the initial state of the FAA119902119890 The algorithm is presented as Algorithm 1

Mathematical Problems in Engineering 5

Data Initial grid (1198620 119888(0))Result 119888119900119906119899119905 is number of infinite clusters and labeled blue-red paths119888119900119906119899119905 = 0119888119906119903119903119890119899119905119878119905119886119905119890 = 119902119890119888119906119903119903119890119899119905119862119890119897119897 = 119888(0)Labeling = falsecountingCluster = true119886 = neighbor of the 119888119906119903119903119890119899119905119862119890119897119897while 120595(119888119906119903119903119890119899119905119878119905119886119905119890 119886) ltgt 0 do

if labeling == 119905119903119906119890 thenlabel 119888119906119903119903119890119899119905119862119890119897119897

endif north neighbor of 119888119906119903119903119890119899119905119862119890119897119897 is blue cell and countingClusterthen119888119900119906119899119905 = 119888119900119906119899119905 + 1labeling = 119905119903119906119890countingCluster = false

endif 119904 119908 neighbor of currentCell is red white respectly and119888119906119903119903119890119899119905119878119905119886119905119890 isin 119902119890 119902119899 thenlabeling = falsecountingCluster = true

end119888119906119903119903119890119899119905119862119890119897119897 = 119888119906119903119903119890119899119905119862119890119897119897 + 120595(119888119906119903119903119890119899119905119878119905119886119905119890 119886)119888119906119903119903119890119899119905119878119905119886119905119890 = 120593(119888119906119903119903119890119899119905119878119905119886119905119890 119886)119886 = neighbor of the 119888119906119903119903119890119899119905119862119890119897119897

end

Algorithm 1 FA traversing algorithm

The FA starts in state 119902119890 and uses states from set 119876until it finds a boundary cell on the top of the grid (blueone) In this moment the algorithm increments the counter119888119900119906119899119905 and sets the indicator labeling on true and the variablecountingCluster is set on false The algorithm labels a pathuntil the FA finds the lowest left cell on the bottom edge ofthe cluster After finding the lowest left end of an infinitecluster the FA goes in state 119902119890 and sets labeling on false andthe countingCluster is set on true After that the algorithmrepeats the process of traversing

The algorithm stops when the FA outputs 0

Lemma 3 The algorithm has linear time complexity

The FA uses von Neumann neighborhood with fourneighbors for each grid cell The automaton A119902119890 is never onthe same cell in the same state Therefore the FA cannot bemore than four times in a particular cell during the executionof the algorithmThe complexity of the algorithm is thereforeO(119871) where 119871 is the number of grid cells

The algorithm was simulated in NetLogo programmingenvironment The algorithm was extensively evaluated onvarious test cases for different sizes of grid and initial densityof black cells in initial configuration In Figure 4 the last stateson the initial grids from Figure 1 are shown In Figure 5 a

grid of dimension 201 times 201 with probability 062 for a blackcell is shown with two infinity clusters after terminationof the FA algorithm By increasing the probability of blackcells infinite clusters more often appear as predicted also bythe percolation theory Also the results of the algorithm arein accordance with site percolation thresholds in the squarelattice ([16 24])

4 Conclusions

A FA-based algorithm for identification of connected pathsbetween top and bottomboundary cells in an arbitrary squaregrid is proposedThe constructed FA is minimal according tothe number of statesThe algorithm is based on four essentialstates 119902119890 119902119899 119902119908 and 119902119904 Using these states as FA input andassuming von Neumann neighborhood of the grid cells wecan traverse the boundaries of clusters Because the FA isindependent there is a possibility of putting more than oneautomaton in different initial cells Such a parallel approachcould further speed up the proposed algorithm Combiningthe property of FA which is never on the same cell in thesame state with labeling there is a possibility of using theFA in the detection of articulation cells ([25]) Finally furtherinvestigation can be focused on the necessary extensions ofthe algorithm for 3D grids

6 Mathematical Problems in Engineering

Figure 4 The FA traversing algorithm for the two examples from Figure 1

Figure 5 The FA traversing algorithm finds two infinite clusters ina grid of dimensions 201 times 201

Conflicts of Interest

The authors declare that there are no conflicts of interestregarding the publication of this paper

Acknowledgments

This work is supported by the Program of Science-Techno-logical Cooperation between governments of Montenegroand Serbia 2016ndash2018

References

[1] C E Shannon ldquoPresentation of a maze-solving machineCybernetics Transrdquo in proceedings of the 8th Conf of the JosiahMacu Jr Found pp 173ndash180 1951

[2] V B Kudryavtsev S M Uscumlic and G Kilibarda ldquoThebehavior of automata in labyrinthsrdquo Discrete mathematics andapplications vol 4 pp 3ndash28 1992

[3] G Kilibarda V B Kudryavtsev and S M Uscumlic ldquoCol-lectives of automata in labyrinthsrdquo Discrete Mathematics andApplications vol 15 pp 3ndash39 2003

[4] G Kilibarda ldquoUniversal labyrinth traps for finite sets ofautomatardquoDiscreteMathematics andApplications vol 2 pp 72ndash79 1990

[5] G Kilibarda ldquoOn the complexity of traversing labyrinths by anautomatonrdquo Discrete mathematics and applications vol 5 pp116ndash124 1993

[6] M Blum and D Kozen ldquoOn the power of the compassrdquo inProceedings of the 19th Annual Symposium on Foundations ofComputer Science pp 132ndash142 1978

[7] B Stamatovic ldquoOn recognizing labyrinth with automatardquo Dis-crete Mathematics and Applications vol 12 pp 51ndash65 2000

[8] B Stamatovic ldquoAutomata recognition two-connected labyrinthwith finite cycle diameterrdquo Programming and Computer Soft-ware vol 36 pp 149ndash157 2010

[9] S Kirkpatrick ldquoPercolation and conductionrdquo Reviews of Mod-ern Physics vol 45 no 4 pp 574ndash588 1973

[10] B I Shklovskii and A L Efros Electronic Properties of DopedSemiconductors Springer-Verlag 1984

[11] D Stauffer Introduction to PercolationTheory Taylor amp FrancisAbingdon UK 1992

[12] Fractals and Disordered Systems A Bunde and S Havlin EdsSpringer-Verlag Berlin Germany 1996

[13] J Hoshen P Klymko and R Kopelman ldquoPercolation andcluster distribution III Algorithms for the site-bond problemrdquoJournal of Statistical Physics vol 21 no 5 pp 583ndash600 1979

[14] E Stoll ldquoA fast cluster counting algorithm for percolation onand off latticesrdquoComputer Physics Communications vol 109 no1 pp 1ndash5 1998

[15] R C Brower P Tamayo and B York ldquoA parallel multigridalgorithm for percolation clustersrdquo Journal of Statistical Physicsvol 63 no 1-2 pp 73ndash88 1991

[16] M E J Newman and R M Ziff ldquoEfficient Monte Carloalgorithm and high-precision results for percolationrdquo PhysicalReview Letters vol 85 no 19 pp 4104ndash4107 2000

[17] R Trobec and B Stamatovic ldquoAnalysis and classification offlow-carrying backbones in two-dimensional latticesrdquoAdvancesin Engineering Software vol 103 pp 38ndash45 2017

Mathematical Problems in Engineering 7

[18] B Stamatovic and R Trobec ldquoCellular automata labeling ofconnected components in n-dimensional binary latticesrdquo TheJournal of Supercomputing vol 72 no 11 pp 4221ndash4232 2016

[19] R M Ziff P T Cummings and G Stells ldquoGeneration ofpercolation cluster perimeters by a random walkrdquo Journal ofPhysics A General Physics vol 17 no 15 article no 018 pp3009ndash3017 1984

[20] R M Ziff ldquoHull-generating walksrdquo Physica D Nonlinear Phe-nomena vol 38 no 1-3 pp 377ndash383 1989

[21] R M Ziff ldquoSpanning probability in 2D percolationrdquo PhysicalReview Letters vol 69 no 18 pp 2670ndash2673 1992

[22] H Fleischner ldquoEulerian graphs and related topicsrdquo Annals ofDiscrete Mathematics No 50 Part 1 vol 2 1991

[23] T Y Kong and A Rosenfeld ldquoDigital topology Introductionand surveyrdquo Computer Vision Graphics and Image Processingvol 48 no 3 pp 357ndash393 1989

[24] M J Lee ldquoPseudo-random-number generators and the squaresite percolation thresholdrdquo Physical Review E Statistical Non-linear and Soft Matter Physics vol 78 no 3 Article ID 0311312008

[25] W-G Yin and R Tao ldquoAlgorithm for finding two-dimensionalsite percolation backbonesrdquo Physica B Condensed Matter vol279 no 1-3 pp 84ndash86 2000

Submit your manuscripts athttpswwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 201

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 5: Algorithm for Identification of Infinite Clusters Based on ...downloads.hindawi.com/journals/mpe/2017/8251305.pdf · ResearchArticle Algorithm for Identification of Infinite Clusters

Mathematical Problems in Engineering 5

Data Initial grid (1198620 119888(0))Result 119888119900119906119899119905 is number of infinite clusters and labeled blue-red paths119888119900119906119899119905 = 0119888119906119903119903119890119899119905119878119905119886119905119890 = 119902119890119888119906119903119903119890119899119905119862119890119897119897 = 119888(0)Labeling = falsecountingCluster = true119886 = neighbor of the 119888119906119903119903119890119899119905119862119890119897119897while 120595(119888119906119903119903119890119899119905119878119905119886119905119890 119886) ltgt 0 do

if labeling == 119905119903119906119890 thenlabel 119888119906119903119903119890119899119905119862119890119897119897

endif north neighbor of 119888119906119903119903119890119899119905119862119890119897119897 is blue cell and countingClusterthen119888119900119906119899119905 = 119888119900119906119899119905 + 1labeling = 119905119903119906119890countingCluster = false

endif 119904 119908 neighbor of currentCell is red white respectly and119888119906119903119903119890119899119905119878119905119886119905119890 isin 119902119890 119902119899 thenlabeling = falsecountingCluster = true

end119888119906119903119903119890119899119905119862119890119897119897 = 119888119906119903119903119890119899119905119862119890119897119897 + 120595(119888119906119903119903119890119899119905119878119905119886119905119890 119886)119888119906119903119903119890119899119905119878119905119886119905119890 = 120593(119888119906119903119903119890119899119905119878119905119886119905119890 119886)119886 = neighbor of the 119888119906119903119903119890119899119905119862119890119897119897

end

Algorithm 1 FA traversing algorithm

The FA starts in state 119902119890 and uses states from set 119876until it finds a boundary cell on the top of the grid (blueone) In this moment the algorithm increments the counter119888119900119906119899119905 and sets the indicator labeling on true and the variablecountingCluster is set on false The algorithm labels a pathuntil the FA finds the lowest left cell on the bottom edge ofthe cluster After finding the lowest left end of an infinitecluster the FA goes in state 119902119890 and sets labeling on false andthe countingCluster is set on true After that the algorithmrepeats the process of traversing

The algorithm stops when the FA outputs 0

Lemma 3 The algorithm has linear time complexity

The FA uses von Neumann neighborhood with fourneighbors for each grid cell The automaton A119902119890 is never onthe same cell in the same state Therefore the FA cannot bemore than four times in a particular cell during the executionof the algorithmThe complexity of the algorithm is thereforeO(119871) where 119871 is the number of grid cells

The algorithm was simulated in NetLogo programmingenvironment The algorithm was extensively evaluated onvarious test cases for different sizes of grid and initial densityof black cells in initial configuration In Figure 4 the last stateson the initial grids from Figure 1 are shown In Figure 5 a

grid of dimension 201 times 201 with probability 062 for a blackcell is shown with two infinity clusters after terminationof the FA algorithm By increasing the probability of blackcells infinite clusters more often appear as predicted also bythe percolation theory Also the results of the algorithm arein accordance with site percolation thresholds in the squarelattice ([16 24])

4 Conclusions

A FA-based algorithm for identification of connected pathsbetween top and bottomboundary cells in an arbitrary squaregrid is proposedThe constructed FA is minimal according tothe number of statesThe algorithm is based on four essentialstates 119902119890 119902119899 119902119908 and 119902119904 Using these states as FA input andassuming von Neumann neighborhood of the grid cells wecan traverse the boundaries of clusters Because the FA isindependent there is a possibility of putting more than oneautomaton in different initial cells Such a parallel approachcould further speed up the proposed algorithm Combiningthe property of FA which is never on the same cell in thesame state with labeling there is a possibility of using theFA in the detection of articulation cells ([25]) Finally furtherinvestigation can be focused on the necessary extensions ofthe algorithm for 3D grids

6 Mathematical Problems in Engineering

Figure 4 The FA traversing algorithm for the two examples from Figure 1

Figure 5 The FA traversing algorithm finds two infinite clusters ina grid of dimensions 201 times 201

Conflicts of Interest

The authors declare that there are no conflicts of interestregarding the publication of this paper

Acknowledgments

This work is supported by the Program of Science-Techno-logical Cooperation between governments of Montenegroand Serbia 2016ndash2018

References

[1] C E Shannon ldquoPresentation of a maze-solving machineCybernetics Transrdquo in proceedings of the 8th Conf of the JosiahMacu Jr Found pp 173ndash180 1951

[2] V B Kudryavtsev S M Uscumlic and G Kilibarda ldquoThebehavior of automata in labyrinthsrdquo Discrete mathematics andapplications vol 4 pp 3ndash28 1992

[3] G Kilibarda V B Kudryavtsev and S M Uscumlic ldquoCol-lectives of automata in labyrinthsrdquo Discrete Mathematics andApplications vol 15 pp 3ndash39 2003

[4] G Kilibarda ldquoUniversal labyrinth traps for finite sets ofautomatardquoDiscreteMathematics andApplications vol 2 pp 72ndash79 1990

[5] G Kilibarda ldquoOn the complexity of traversing labyrinths by anautomatonrdquo Discrete mathematics and applications vol 5 pp116ndash124 1993

[6] M Blum and D Kozen ldquoOn the power of the compassrdquo inProceedings of the 19th Annual Symposium on Foundations ofComputer Science pp 132ndash142 1978

[7] B Stamatovic ldquoOn recognizing labyrinth with automatardquo Dis-crete Mathematics and Applications vol 12 pp 51ndash65 2000

[8] B Stamatovic ldquoAutomata recognition two-connected labyrinthwith finite cycle diameterrdquo Programming and Computer Soft-ware vol 36 pp 149ndash157 2010

[9] S Kirkpatrick ldquoPercolation and conductionrdquo Reviews of Mod-ern Physics vol 45 no 4 pp 574ndash588 1973

[10] B I Shklovskii and A L Efros Electronic Properties of DopedSemiconductors Springer-Verlag 1984

[11] D Stauffer Introduction to PercolationTheory Taylor amp FrancisAbingdon UK 1992

[12] Fractals and Disordered Systems A Bunde and S Havlin EdsSpringer-Verlag Berlin Germany 1996

[13] J Hoshen P Klymko and R Kopelman ldquoPercolation andcluster distribution III Algorithms for the site-bond problemrdquoJournal of Statistical Physics vol 21 no 5 pp 583ndash600 1979

[14] E Stoll ldquoA fast cluster counting algorithm for percolation onand off latticesrdquoComputer Physics Communications vol 109 no1 pp 1ndash5 1998

[15] R C Brower P Tamayo and B York ldquoA parallel multigridalgorithm for percolation clustersrdquo Journal of Statistical Physicsvol 63 no 1-2 pp 73ndash88 1991

[16] M E J Newman and R M Ziff ldquoEfficient Monte Carloalgorithm and high-precision results for percolationrdquo PhysicalReview Letters vol 85 no 19 pp 4104ndash4107 2000

[17] R Trobec and B Stamatovic ldquoAnalysis and classification offlow-carrying backbones in two-dimensional latticesrdquoAdvancesin Engineering Software vol 103 pp 38ndash45 2017

Mathematical Problems in Engineering 7

[18] B Stamatovic and R Trobec ldquoCellular automata labeling ofconnected components in n-dimensional binary latticesrdquo TheJournal of Supercomputing vol 72 no 11 pp 4221ndash4232 2016

[19] R M Ziff P T Cummings and G Stells ldquoGeneration ofpercolation cluster perimeters by a random walkrdquo Journal ofPhysics A General Physics vol 17 no 15 article no 018 pp3009ndash3017 1984

[20] R M Ziff ldquoHull-generating walksrdquo Physica D Nonlinear Phe-nomena vol 38 no 1-3 pp 377ndash383 1989

[21] R M Ziff ldquoSpanning probability in 2D percolationrdquo PhysicalReview Letters vol 69 no 18 pp 2670ndash2673 1992

[22] H Fleischner ldquoEulerian graphs and related topicsrdquo Annals ofDiscrete Mathematics No 50 Part 1 vol 2 1991

[23] T Y Kong and A Rosenfeld ldquoDigital topology Introductionand surveyrdquo Computer Vision Graphics and Image Processingvol 48 no 3 pp 357ndash393 1989

[24] M J Lee ldquoPseudo-random-number generators and the squaresite percolation thresholdrdquo Physical Review E Statistical Non-linear and Soft Matter Physics vol 78 no 3 Article ID 0311312008

[25] W-G Yin and R Tao ldquoAlgorithm for finding two-dimensionalsite percolation backbonesrdquo Physica B Condensed Matter vol279 no 1-3 pp 84ndash86 2000

Submit your manuscripts athttpswwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 201

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 6: Algorithm for Identification of Infinite Clusters Based on ...downloads.hindawi.com/journals/mpe/2017/8251305.pdf · ResearchArticle Algorithm for Identification of Infinite Clusters

6 Mathematical Problems in Engineering

Figure 4 The FA traversing algorithm for the two examples from Figure 1

Figure 5 The FA traversing algorithm finds two infinite clusters ina grid of dimensions 201 times 201

Conflicts of Interest

The authors declare that there are no conflicts of interestregarding the publication of this paper

Acknowledgments

This work is supported by the Program of Science-Techno-logical Cooperation between governments of Montenegroand Serbia 2016ndash2018

References

[1] C E Shannon ldquoPresentation of a maze-solving machineCybernetics Transrdquo in proceedings of the 8th Conf of the JosiahMacu Jr Found pp 173ndash180 1951

[2] V B Kudryavtsev S M Uscumlic and G Kilibarda ldquoThebehavior of automata in labyrinthsrdquo Discrete mathematics andapplications vol 4 pp 3ndash28 1992

[3] G Kilibarda V B Kudryavtsev and S M Uscumlic ldquoCol-lectives of automata in labyrinthsrdquo Discrete Mathematics andApplications vol 15 pp 3ndash39 2003

[4] G Kilibarda ldquoUniversal labyrinth traps for finite sets ofautomatardquoDiscreteMathematics andApplications vol 2 pp 72ndash79 1990

[5] G Kilibarda ldquoOn the complexity of traversing labyrinths by anautomatonrdquo Discrete mathematics and applications vol 5 pp116ndash124 1993

[6] M Blum and D Kozen ldquoOn the power of the compassrdquo inProceedings of the 19th Annual Symposium on Foundations ofComputer Science pp 132ndash142 1978

[7] B Stamatovic ldquoOn recognizing labyrinth with automatardquo Dis-crete Mathematics and Applications vol 12 pp 51ndash65 2000

[8] B Stamatovic ldquoAutomata recognition two-connected labyrinthwith finite cycle diameterrdquo Programming and Computer Soft-ware vol 36 pp 149ndash157 2010

[9] S Kirkpatrick ldquoPercolation and conductionrdquo Reviews of Mod-ern Physics vol 45 no 4 pp 574ndash588 1973

[10] B I Shklovskii and A L Efros Electronic Properties of DopedSemiconductors Springer-Verlag 1984

[11] D Stauffer Introduction to PercolationTheory Taylor amp FrancisAbingdon UK 1992

[12] Fractals and Disordered Systems A Bunde and S Havlin EdsSpringer-Verlag Berlin Germany 1996

[13] J Hoshen P Klymko and R Kopelman ldquoPercolation andcluster distribution III Algorithms for the site-bond problemrdquoJournal of Statistical Physics vol 21 no 5 pp 583ndash600 1979

[14] E Stoll ldquoA fast cluster counting algorithm for percolation onand off latticesrdquoComputer Physics Communications vol 109 no1 pp 1ndash5 1998

[15] R C Brower P Tamayo and B York ldquoA parallel multigridalgorithm for percolation clustersrdquo Journal of Statistical Physicsvol 63 no 1-2 pp 73ndash88 1991

[16] M E J Newman and R M Ziff ldquoEfficient Monte Carloalgorithm and high-precision results for percolationrdquo PhysicalReview Letters vol 85 no 19 pp 4104ndash4107 2000

[17] R Trobec and B Stamatovic ldquoAnalysis and classification offlow-carrying backbones in two-dimensional latticesrdquoAdvancesin Engineering Software vol 103 pp 38ndash45 2017

Mathematical Problems in Engineering 7

[18] B Stamatovic and R Trobec ldquoCellular automata labeling ofconnected components in n-dimensional binary latticesrdquo TheJournal of Supercomputing vol 72 no 11 pp 4221ndash4232 2016

[19] R M Ziff P T Cummings and G Stells ldquoGeneration ofpercolation cluster perimeters by a random walkrdquo Journal ofPhysics A General Physics vol 17 no 15 article no 018 pp3009ndash3017 1984

[20] R M Ziff ldquoHull-generating walksrdquo Physica D Nonlinear Phe-nomena vol 38 no 1-3 pp 377ndash383 1989

[21] R M Ziff ldquoSpanning probability in 2D percolationrdquo PhysicalReview Letters vol 69 no 18 pp 2670ndash2673 1992

[22] H Fleischner ldquoEulerian graphs and related topicsrdquo Annals ofDiscrete Mathematics No 50 Part 1 vol 2 1991

[23] T Y Kong and A Rosenfeld ldquoDigital topology Introductionand surveyrdquo Computer Vision Graphics and Image Processingvol 48 no 3 pp 357ndash393 1989

[24] M J Lee ldquoPseudo-random-number generators and the squaresite percolation thresholdrdquo Physical Review E Statistical Non-linear and Soft Matter Physics vol 78 no 3 Article ID 0311312008

[25] W-G Yin and R Tao ldquoAlgorithm for finding two-dimensionalsite percolation backbonesrdquo Physica B Condensed Matter vol279 no 1-3 pp 84ndash86 2000

Submit your manuscripts athttpswwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 201

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 7: Algorithm for Identification of Infinite Clusters Based on ...downloads.hindawi.com/journals/mpe/2017/8251305.pdf · ResearchArticle Algorithm for Identification of Infinite Clusters

Mathematical Problems in Engineering 7

[18] B Stamatovic and R Trobec ldquoCellular automata labeling ofconnected components in n-dimensional binary latticesrdquo TheJournal of Supercomputing vol 72 no 11 pp 4221ndash4232 2016

[19] R M Ziff P T Cummings and G Stells ldquoGeneration ofpercolation cluster perimeters by a random walkrdquo Journal ofPhysics A General Physics vol 17 no 15 article no 018 pp3009ndash3017 1984

[20] R M Ziff ldquoHull-generating walksrdquo Physica D Nonlinear Phe-nomena vol 38 no 1-3 pp 377ndash383 1989

[21] R M Ziff ldquoSpanning probability in 2D percolationrdquo PhysicalReview Letters vol 69 no 18 pp 2670ndash2673 1992

[22] H Fleischner ldquoEulerian graphs and related topicsrdquo Annals ofDiscrete Mathematics No 50 Part 1 vol 2 1991

[23] T Y Kong and A Rosenfeld ldquoDigital topology Introductionand surveyrdquo Computer Vision Graphics and Image Processingvol 48 no 3 pp 357ndash393 1989

[24] M J Lee ldquoPseudo-random-number generators and the squaresite percolation thresholdrdquo Physical Review E Statistical Non-linear and Soft Matter Physics vol 78 no 3 Article ID 0311312008

[25] W-G Yin and R Tao ldquoAlgorithm for finding two-dimensionalsite percolation backbonesrdquo Physica B Condensed Matter vol279 no 1-3 pp 84ndash86 2000

Submit your manuscripts athttpswwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 201

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 8: Algorithm for Identification of Infinite Clusters Based on ...downloads.hindawi.com/journals/mpe/2017/8251305.pdf · ResearchArticle Algorithm for Identification of Infinite Clusters

Submit your manuscripts athttpswwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 201

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of