Demo program LABYRINTH


1. Introduction

The LABYRINTH has been developed for demonstration purposes, and for performing an elementary statistical analysis. The current realizations which might be called "passing a maze" is for looking for a path from one wall to an opposite one in rectangular geometry (Section 1 and 2) and from a center of a hexagon to its boundaries (Section 3). This last can serve an example of a nucleation in a practically homogeneous environment. Some modifications in the program code might drive us to modeling other real world processes. Among the examples are percolation through media with randomly distributed obstacles, pattern formation which is sensitive to concentration and distribution of imperfections, electrical discharge in "atmosphere" where the role of imperfections play fluctuations of electric potential. Propagation of "diseases" and "epidemic diseases" in various media can be modeled in a way similar to the models described below.

Just below you can see a Window for a visual dialog, especially useful when you try to estimate the interesting range of the parameters. The icon in the left-top corner of the Window shows the program has been realized in Visual Basic.

The program starts a dialog with setting default sizes of a rectangular:

Width = 80, Height = 40, and the number of Defects = 1400 (in the form above the number of Defects differs from a default, because the job just has been finished with statistical simulations). The parameters are displayed in the Text boxes. The latter, Defects, determines a concentration of defect sites within a rectangular, 43.75% for a default. For dealing with other values, the default set must be updated, and new numbers be Saved. The program distributes defect sites over the rectangular area at random (black points on the yellow background in the two Figures below). The choice for a default number of Defects is due to the fact that around concentrations of 43%-45% a probability to successfully pass through a labyrinth (from the "top" to the "bottom") is near 50%. Alternatively speaking, the system is close to its percolation threshold.

The algorithm for passing the labyrinth is consistent with the following rules:

  • Non-defect sites are only available;
  • A path starts at the left upper corner;
  • A predominant direction for going through is "down". If a corresponding site is not available, direction "left" should be tried, then "right", and, finally, "up".
  • The algorithm does not allow you to arrive in the site you already visited. Exception from this rule is the situation of return: If the possibilities for visiting a new site cannot be realized (dead-lock), you just return to the previous site, where you try for a new possibility, and, recursively, so on. The essence of the algorithm is a recursion procedure.
  • The labyrinth is assumed to be passed, if the bottom is reached, does not matter, at which place.

The Figure below illustrates one of a possible paths through the labyrinth. Click a Graph button to display this sort of pictures.



Success: Width = 80, Height = 40, Defects = 1400

Note that the program stops when reaching the bottom. However, if there is no way to such a destination, the program tries all possible ways to pass from the top to the bottom. In accordance with the algorithm, the final point coincides with the initial point if the situation of "failure" is realized. Illustration for this is given in Figure below.


Failure: Width = 80, Height = 40, Defects = 1400


2. Statistical Properties.

In order to obtain the statistical information the program runs "through a labyrinth" 100 times at each concentration of Defect sites, starting from 0.36 up to 0.50, step 0.01. Text boxes Width and Defects play a role of dummies in these simulations: Height is just enough to be predefined. If a percolation threshold is interested to be determined with a fairly good accuracy, the optimal ratio Width/Height can be taken between 1.5 and 2. Certainly, larger the area, better the accuracy.

Three possibilities are available. Check in boxes: Height x Height, and/or 1.5 Height x Height, and/or 2 Height x Height (for Height an even number is recommended). Press the button "Stat". In the Figure below you can see the plots "Probability of success" vs "concentration of defects in %":


40 x 40


60 x 40


80 x 40

It is clearly seen that the shape of the transitional curve becomes better with Width increasing. It could be increased more, but, first, time for waiting statistical results becomes longer and longer, second, the percolation threshold shifts to the range of higher concentrations, than it could be expected for an infinite system.


3. Hexagonal area

In hexagonal geometry there are six nearest neighbor sites which are available for moving to, if these sites are not defects, of course. When the algorithm is applied, a direction to one of them is chosen at random. The rules, concerning deadlocks, are practically the same as in the case of rectangular geometry. Success is assumed when one of six hexagon’s boundaries is reached. In a failure attempt, the program tries all possible ways to reach the boundaries, starting from hexagon’s center. The dialog form is similar to the shown above and skipped here.

In the two Figures below the "radius" of the hexagonal area is equal to 40. The concentration of defects was taken 52%: From the statistical analysis it will be clear, that a percolation threshold is shifted to 51-52% as compared to 42-43% for rectangular geometry.



Success: Radius = 40, Defects = 52%



Failure: Radius = 40, Defects = 52%


For the statistical information the program runs "through a labyrinth" 100 times at each concentration of Defect sites, starting from 0.45 up to 0.59, step 0.01. We considered such a percolation through the areas of three sizes, with the radii of 40, 60, and 80.


Radius = 40


Radius = 60


Radius = 80

Return to Main Page. Return to Roadmap. Return to Professional Resume.
1