# Counting Rules for Computing the Number of Independent Sets of a Grid Graph

^{1}

^{2}

^{*}

^{†}

## Abstract

**:**

## 1. Introduction

## 2. Preliminaries

## 3. Algorithm Proposal

## 4. Counting Rules for Processing Grid Base Cases

- Fibonacci rule: used to process tree edges.
- Subtracted rule: applied to process frond edges.
- Product rule: used to converge different search lines.

#### 4.1. The Fibonacci Rule

#### 4.2. The Subtracted Rule

#### 4.3. The Product Rule

## 5. Building the Enumerative Tree

- The counting rule based on a vertex—the vertex division: let $v\in V\left(G\right)$,$$i\left(G\right)=i(G-v)+i(G-(N\left[v\right]\left)\right)$$
- The counting rule based on an edge—the edge division: let $e=\{x,y\}\in E\left(G\right)$,$$i\left(G\right)=i(G-e)-i(G-(N\left[x\right]\cup N\left[y\right]\left)\right)$$

Algorithm 1 BB algorithm | |

Input: $a\phantom{\rule{4pt}{0ex}}grid\phantom{\rule{4pt}{0ex}}graph\phantom{\rule{4pt}{0ex}}G$Output: $base\phantom{\rule{4pt}{0ex}}cases\phantom{\rule{4pt}{0ex}}from\phantom{\rule{4pt}{0ex}}the\phantom{\rule{4pt}{0ex}}grid\phantom{\rule{4pt}{0ex}}graph\phantom{\rule{4pt}{0ex}}G$1: procedure $SelectingNode$(G)2: $n\leftarrow \left|V\right(G\left)\right|$ 3: for $i\leftarrow 1,n$ do | |

4: $x\leftarrow G\left[i\right]$ | ▹x is a vertex from G |

5: if $\left(N\right[x]\phantom{\rule{4pt}{0ex}}incide>=5\phantom{\rule{4pt}{0ex}}internalfaces)$ then6: return x7: end if8: end for9: return 010: end procedure11: procedure $Branching$(G)12: $v\leftarrow SelectingNode\left(G\right)$ 13: if $(v=0)$ then14: $Processing\phantom{\rule{4pt}{0ex}}Base\_Case\left(G\right)$ 15: else | |

16: $Branching(G-v)$ | ▹ vertex v is removed from G |

17: $Branching(G-N[v\left]\right)$ | ▹ the neighborhood (N[v]) is removed from G |

18: end if19: end procedure |

- The neighborhood of v has to be incident with at least five internal faces.
- One of the internal faces incident to $N\left[v\right]$ either possesses the maximum size within the current subgraph, or it shares edges with the outer face.

**1**is the ${F}_{m+2}$ vector whose entries are all ones.

## 6. Conclusions

## Author Contributions

## Funding

## Data Availability Statement

## Acknowledgments

## Conflicts of Interest

## References

- Liu, J.-B.; Pan, X.-F.; Hu, F.-T.; Hu, F.-F. Asymptotic Laplacian-energy-like invariant of lattices. Appl. Math. Comput.
**2015**, 253, 205–214. [Google Scholar] [CrossRef] - Baxter, R.J. Planar lattice gases with nearest-neighbor exclusion. Ann. Comb.
**1999**, 3, 191–203. [Google Scholar] [CrossRef] - Vadhan, S.P. The Complexity of Counting in Sparse, Regular, and Planar Graphs. SIAM J. Comput.
**2001**, 31, 398–427. [Google Scholar] [CrossRef] - Dyer, M.E.; Greenhill, C.S. Corrigendum: The complexity of counting graph homomorphisms. Random Struct. Algorithms
**2004**, 25, 346–352. [Google Scholar] [CrossRef] - Calkin, N.J.; Wilf, H.S. The Number of Independent Sets in a Grid Graph. SIAM J. Discret. Math.
**1998**, 11, 54–60. [Google Scholar] [CrossRef] - Euler, R. The Fibonacci number of a grid graph and a new class of integer sequences. J. Integer Seq.
**2005**, 8, 1–16. [Google Scholar] - Zhang, Z. Merrifield-Simmons index of generalized Aztec diamond and related graphs. MATCH Commun. Math. Comput. Chem.
**2006**, 56, 625–636. [Google Scholar] - Montoya, J.A. On the Counting Complexity of Mathematical Nanosciences. MATCH Commun. Math. Comput. Chem.
**2021**, 86, 453–488. [Google Scholar] - Merrifield, R.E.; Simmons, H.E. Topological Methods in Chemistry; Wiley: New York, NY, USA, 1989. [Google Scholar]
- De Ita, G.; Tovar, M.; Bernabé, B. A Novel Method for Counting Independent Sets in a Grid Graph. Int. J. Comb. Optim. Probl. Inform.
**2023**, 14, 11–18. [Google Scholar] - Valiant, L.G. The complexity of computing the permanent. Theor. Comput. Sci.
**1979**, 8, 189–201. [Google Scholar] [CrossRef] - Greenhill, C.S. The complexity of counting colourings and independent sets in sparse graphs and hypergraphs. Comput. Complex.
**2000**, 9, 52–72. [Google Scholar] [CrossRef] - Luby, M.; Vigoda, E. Approximately Counting up to Four (Extended Abstract). In Proceedings of the Twenty-Ninth Annual ACM Symposium on Theory of Computing: STOC ’97, El Paso, TX, USA, 4–6 May 1997; pp. 682–687. [Google Scholar] [CrossRef]
- Bubley, R. Randomized Algorithms: Approximation, Generation, and Counting; Springer: Berlin/Heidelberg, Germany, 2001. [Google Scholar]
- Dahllöf, V.; Jonsson, P. An Algorithm for Counting Maximum Weighted Independent Sets and Its Applications. In Proceedings of the Thirteenth Annual ACM-SIAM Symposium on Discrete Algorithms: SODA ’02, San Francisco, CA, USA, 6–8 January 2002; pp. 292–298. [Google Scholar]
- Roth, D. On the hardness of approximate reasoning. Artif. Intell.
**1996**, 82, 273–302. [Google Scholar] [CrossRef] - Golin, M.J.; Leung, Y.; Wang, Y.; Yong, X. Counting Structures in Grid Graphs, Cylinders and Tori Using Transfer Matrices: Survey and New Results. In Proceedings of the Seventh Workshop on Algorithm Engineering and Experiments and the Second Workshop on Analytic Algorithmics and Combinatorics, ALENEX/ANALCO 2005, Vancouver, BC, Canada, 22 January 2005; pp. 250–258. [Google Scholar]
- Guillen, C.; Lopez, A.L.; DeIta, G. Computing #2-SAT of Grids, Grid-Cylinders and Grid-Tori Boolean Formulas. In Proceedings of the 15th RCRA Workshop on Experimental Evaluation of Algorithms for Solving Problems with Combinatorial Explosion, Udine, Italy, 12–13 December 2008; CEUR-WS.org. Volume 451, pp. 152–167. [Google Scholar]
- Roth, R.; Siegel, P.; Wolf, J. Efficient coding schemes for the hard-square model. IEEE Trans. Inf. Theory
**2001**, 47, 1166–1176. [Google Scholar] [CrossRef] - Zhang, Z. Merrifield-Simmons index and its entropy of the 4-8-8 lattice. J. Stat. Phys.
**2014**, 154, 1113–1123. [Google Scholar] [CrossRef] - Karp, R.M. Reducibility Among Combinatorial Problems. In Complexity of Computer Computations; Miller, R.E., Thatcher, J.W., Bohlinger, J.D., Eds.; Plenum: New York, NY, USA, 1972; pp. 85–103. ISBN 978-1-4684-2003-6. [Google Scholar] [CrossRef]
- De Ita, G.; Rodríguez, M.; Bello, P.; Contreras, M. Basic Pattern Graphs for the Efficient Computation of Its Number of Independent Sets. In Proceedings of the Pattern Recognition—12th Mexican Conference, MCPR 2020, Morelia, Mexico, 24–27 June 2020; Volume 12088, pp. 57–66. [Google Scholar] [CrossRef]
- Medina, M.A.L.; Marcial-Romero, J.R.; Luna, G.D.I.; Moyao, Y. A Linear Time Algorithm for Computing #2SAT for Outerplanar 2-CNF Formulas. In Proceedings of the Pattern Recognition—10th Mexican Conference, MCPR 2018, Puebla, Mexico, 27–30 June 2018; Volume 10880, pp. 72–81. [Google Scholar] [CrossRef]

**Table 1.**Counting independent sets from Figure 1 (first part).

Vertex 2 | 1 | 3 | 5 | 6 | 4$\u293a{\mathit{C}}_{2}{\mathit{C}}_{1}$ | 8 | 7$\u293a{\mathit{C}}_{3}$ | 9 |
---|---|---|---|---|---|---|---|---|

${L}_{P}$: (1,1) | (2,1) | (3,2) | (5,3) | (8,5) | (13,8) − (0,2) − (0,2) = (13,4) | (17,13) | (30,17) − (0,5) = (30,12) | (42,30) |

${C}_{1}$: (0,1) | (1,0) | (1,1) | (2,1) | (3,2) | (5,3) − (0,1) = (5,2)_{x} | |||

${C}_{2}{L}_{p}$: | (0,2) | (2,0) | (2,2) | (4,2)_{x} | ||||

${C}_{2}{C}_{1}$: | (0,1) | (1,0) | (1,1) | (2,1)_{x} | ||||

${C}_{3}{L}_{p}$: | (0,5) | (5,0) | (5,5) | (10,5)_{x} | ||||

${C}_{3}{C}_{1}$: | (0,2) | (2,0)_{x} | ||||||

${C}_{3}{C}_{2}{L}_{p}$: | (0,2) | (2,0)_{x} | ||||||

${C}_{3}{C}_{2}{C}_{1}$: | (0,1) | (1,0)_{x} | ||||||

${C}_{4}{L}_{p}$: | (0,13) | (13,0) | (13,13) | |||||

${C}_{4}{C}_{3}{L}_{p}$: | (0,5) | (5,0)_{x} | ||||||

${C}_{5}{L}_{p}$: | (0,30) | |||||||

${C}_{4}{C}_{5}{L}_{p}$: | (0,13) |

**Table 2.**Counting independent sets from Figure 1 (second part).

10$\u293a{\mathit{C}}_{4}$ | 13 | 15 | 16 | 14$\u293a{\mathit{C}}_{7}$ | 12$\u293a{\mathit{C}}_{6}$ | 11$\u293a{\mathit{C}}_{5}$ |
---|---|---|---|---|---|---|

${L}_{P}$: (72,42) − (0,13) = (72,29) | (101,72) | (173,101) | (274,173) | (447,274) − (0,72) = (447,202) | (549,447) − (0,87) = (649,360) | (1009,649) − (0,210) = (1009,439) |

${C}_{4}{L}_{p}$: (26,13)_{x} | ||||||

${C}_{5}{L}_{p}$: (30,0) | (30,30) | (60,30) | (90,60) | (150,90) − (0,30) = (150,60) | (210,150) | (360,210)_{x} |

${C}_{5}{C}_{4}{L}_{p}$: (13,0)_{x} | ||||||

${C}_{6}{L}_{P}$: (0,29) | (29,0) | (29,29) | (58,29) | (87,58) | (145,87)_{x} | |

${C}_{7}{L}_{P}$: | (0,72) | (72,0) | (72,72) | (144,72)_{x} | ||

${C}_{7}{C}_{5}{L}_{P}$: | (0,30) | (30,0) | (30,30) | (60,30)_{x} |

**Table 3.**Counting independent sets from Figure 2.

Vertex | 5 | 3 | 1 | 2 | 4$\u293a{\mathit{C}}_{2}$ | 6$\u293a{\mathit{C}}_{1}$ | 9 | 8$\u293a{\mathit{C}}_{4}$ | 7 |
---|---|---|---|---|---|---|---|---|---|

${L}_{p}$ | (1,1) | (2,1) | (3,2) | (5,3) | (8,5) − (0,1) | (12,8) − (5,3) | (17,12) | (29,17) − (0,4) | (42,29) − (0,8) |

=(8,4) | =(12,5) | =(29,13) | =(42,21) | ||||||

${C}_{1}{L}_{P}$ | (0,1) | (1,0) | (1,1) | (2,1) | (3,2) | (5,3)_{x} | |||

${C}_{2}{L}_{p}$ | (0,1) | (1,0) | (1,1) | (2,1)_{x} | |||||

${C}_{3}{L}_{P}$ | (0,3) | (3,0) | (3,3) − (0,1) | (5,3) | (8,5) | (13,8)_{x} | |||

=(3,2) | |||||||||

${C}_{3}{C}_{1}{L}_{P}$ | (0,1) | (1,0) | (1,1)_{x} | ||||||

${C}_{3}{C}_{2}{L}_{p}$ | (0,1) | (1,0)_{x} | |||||||

${C}_{4}{L}_{p}$ | (0,4) | (4,0) | (4,4) | (8,4)_{x} | |||||

${C}_{4}{C}_{1}{L}_{p}$ | (0,2) | (2,0)_{x} |

**Table 4.**Counting independent sets from Figure 3.

Start | 10 | 8 | 7 | 5 | 6 | 4 |
---|---|---|---|---|---|---|

10 | (1,1) | (2,1) * (2,1) = (4,1) | (5,4) | (9,5) | (14,9) | (23,14) |

9 | (1,1) | (2,1) | ||||

${C}_{1}$ | (0,5) | (5,0) | (5,5) | |||

${C}_{2}{L}_{P}$ | (0,14) | |||||

${C}_{2}{C}_{1}$ | (0,5) | |||||

Start | 3$\u293a{\mathit{C}}_{\mathbf{1}}$ | 1 | 2$\u293a{\mathit{C}}_{\mathbf{2}}$ | 11 | 12 | 13 |

${L}_{p}$ | (37,23) − (0,5) = (37,18) | (55,37) | (92,55) − (0.14) = (92,41) | (133,92) | (225,133) * (3,2) = (675,266) | (941,675) |

${\mathit{C}}_{1}$ | (10,5)_{x} | |||||

${\mathit{C}}_{2}{L}_{P}$ | (14,0) | (14,14) | (28,14)_{x} | |||

${C}_{2}{C}_{1}$ | (5,0)_{x} | |||||

15 | (1,1) | (2,1) | (3,2) |

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |

© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

De Ita Luna, G.; Bello López, P.; Marcial-Romero, R.
Counting Rules for Computing the Number of Independent Sets of a Grid Graph. *Mathematics* **2024**, *12*, 922.
https://doi.org/10.3390/math12060922

**AMA Style**

De Ita Luna G, Bello López P, Marcial-Romero R.
Counting Rules for Computing the Number of Independent Sets of a Grid Graph. *Mathematics*. 2024; 12(6):922.
https://doi.org/10.3390/math12060922

**Chicago/Turabian Style**

De Ita Luna, Guillermo, Pedro Bello López, and Raymundo Marcial-Romero.
2024. "Counting Rules for Computing the Number of Independent Sets of a Grid Graph" *Mathematics* 12, no. 6: 922.
https://doi.org/10.3390/math12060922