# Fully Parallel Homological Region Adjacency Graph via Frontier Recognition
## 6 Results
In order to clarify this notation, let us resume Figure 2. This image contains four crosses with three pixels with different attributes (\(n_{0,3}=4\)) and one mono-frontier hole situated at the image border, labeled as 5 in the figure (that is, \(n_{0,2}=1\)). It contains no cross with 4 different pixels (\(n_{0,4}=0\)). By merging the frontiers, we obtain two frontier CCs: the external one that contains only region X, and the internal one that contains several regions. Then, \(n_{1,mono}=1\) (but \(n_{1,reg,mono}=0\) because this hole is on the image border), and \(n_{1,poly}=1\) (further, \(n_{1,reg,poly}=1\)). In addition, the number of frontiers going out of crosses is \((3\times 4+4\times 0)/2=6\). The Euler formula yields the number of regions as:  
\[ \begin{array}{ll}n_{2}=&1-n_{0}+n_{1}=\\ &1-(n_{0,3}+n_{0,4}+n_{0,2})+\\ &n_{1,mono}+n_{1,reg,mono}+n_{1,reg,poly}+\frac{3\times n_{0,3}+4\times n_{0,4 }}{2}=\\ &1-(n_{0,3}+n_{0,4})+\\ &n_{1,reg,mono}+n_{1,reg,poly}+\frac{3\times n_{0,3}}{2}+2\times n_{0,4}\end{array}  \tag{1}\]  
For the case of Figure 2, \(n_{2}=1-(4+0+1)+(1+0+1+6)=1-5+8=4\) regions (that is, regions X, K, H and L). Once the number of regions has been computed with the previous formula, it is compared with that given by the sum of the number of regions returned by the MATLAB/OCTAVE method \(bvlabel()\) for each color. This comparison is checked in the script checking_results_nof_regions.m, ensuring the correctness of this implementation. Note that the last two scripts that serve to check results have been commented on in the uploaded implementation to prevent delays when computing _HomDuRAG_. After testing several toy images similar to those in the previous figures (using Case 1 of script_dual_RAG_images.m), the theoretical timing order was tested with images containing the largest perimeter (Case 2 of script_dual_RAG_images.m); a zigzag object embedded in a background of a different color (see a \(13\times 13\) zigzag image in Figure 11). The number of iterations of the algorithm to compute jump distances for the 0-cells that represent crosses and cycles (\(n_{iter}\)) matches the logarithm in base 2 of the semiperimeter of the zigzag (plus one iteration needed to escape from the main _while_ loop) as Figure 11 summarizes. This occurs because both jumps \(J_{a}\) and \(J_{b}\) (corresponding labels) grow exponentially from the southeast-most corner of the zigzag until they meet in the northwest-most corner. When both jumps meet, one additional iteration is required to demonstrate that any frontier has been completely labeled. A third test that clearly reveals the timing order of the proposed algorithm is Case 3 of script_dual_RAG_images.m--a set of random images with a different number of colors and densities (percentage of white pixels) for B/W images. The table in Table 1 shows the results obtained after five executions of images of sizes \(50\times 50\) and \(100\times 100\). The absolute numbers of representative homology cells \(n_{0,*}\), \(n_{1,*}\) are shown in this table. Moreover, in the last three columns, execution times and the sum of representative homology cells of dimension 0 have been normalized to that of a B/W \(25\times 25\) image with a density of 0.5. As expected, the number of crosses \(n_{0,3}+n_{0,4}\) strongly depends on the number of colors. Note that even for an eight-color image, \(n_{0,3}+n_{0,4}\) is very close to the number of 0-cells \((M+1)\times(N+1)\). In contrast, the number of frontier holes \(n_{0,2}\) is greater for extreme densities (reaching a maximum for 0.1 and 0.9) and almost nonexistent for color images. In accordance with this, the required number of iterations to compute jumps and labels is inversely proportional to the number of colors because objects with a longer perimeter can appear for binary images, while colored image regions are usually composed of very few pixels.