Mathematical Problems in Engineering

Volume 2017, Article ID 8251305, 7 pages

https://doi.org/10.1155/2017/8251305

## Algorithm for Identification of Infinite Clusters Based on Minimal Finite Automaton

^{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; em.ude.gdu@civotamats.anajlib

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. This 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.

#### Abstract

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

#### 1. Introduction

After the publication of Shannon’s paper in 1951 [1], many scientists 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.

The 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 algorithm 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. This 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.

The 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 . These 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 left and right boundaries are white.

We construct an initial FA which can traverse the border of any cluster in every planar 2D grid in accordance with the left-hand rule (which is also a kind of a HGW algorithm). The automaton can be launched from any cell of a grid. In any moment, the input of is information about von Neumann neighborhood of the present cell given in the form of a 5-tuple representing the state of the central cell and the states of its four neighbors. In the next moment, depending on its present state and its input, the FA proceeds from the present cell in one of the directions, defined by the output symbols , , , or (denoting the corresponding directions, east, north, west, or south, resp.), and moves into a corresponding neighbor cell or stays at the same place if output symbol is 0 (which means “no move”) and passes into a new state. On the bases of this automaton, we give an algorithm which can be used for finding/identifying and counting infinite clusters in the given grid. Such algorithm is simple to implement and does not need extra memory or stacks. The time complexity of the algorithm is linear and not larger than the time complexity of already existing algorithms. The FA has only four states, including the initial state. We have proved that this is the minimal FA according to the number of states.

The paper is organized as follows. In Section 2, general grid-related definitions and definitions of the FA and its properties are given. In Section 3, the FA-based algorithm for counting connected paths is described and its complexity is proved. The main conclusions and results are summarized in Section 4.

#### 2. Definition

##### 2.1. General Definitions

The planar site percolation model (see Figure 1) is represented by a two-dimensional lattice network (grid) of unit squares (cells) whose centers are in the integer lattice with cells, . The cell position is determined by its center. Each cell can exist in two different states, 0 or 1, where state 0 is usually called “white” and state 1 is usually called “black.” The boundary cells of the simulated grid are in a fixed state, which remains constant throughout the simulation. The boundary cells on the bottom edge of the grid are in state 2, which is called “red,” and the boundary cells on the top edge of the grid are in state 3, which is called “blue.” The boundary cells on the left and right edge of the grid are white. State 4, which is called “orange,” is used for the notation of labeled cells in the grid.