# Polynomial Algorithm for Minimal (1,2)-Dominating Set in Networks

## Abstract

**:**

`Minimal_12_Set`. We test the proposed algorithm in network models such as trees, geometric random graphs, random graphs and cubic graphs, and we show that the sets of nodes returned by the

`Minimal_12_Set`are in general smaller than sets consisting of nodes chosen randomly.

## 1. Introduction

`PowerOfNodes`and

`Minimal_12_Set`. In Section 4, we analyze the performance of the algorithms in geometric random graphs in which nodes are placed randomly on a unit square and two nodes are adjacent if and only if the distance between them in Euclidean space is at most given threshold. This is done to predict the results given by the algorithm in a real network situation. Moreover, we compare the results returned by the algorithm with exact values of $(1,2)$-domination number in tree graphs. This helps us check how much the algorithm is better than simply choosing nodes randomly. At last, we investigate performance of the algorithm in random graphs and cubic graphs. In Section 6, we give conclusion of this paper and discuss future further works.

## 2. Related Works

## 3. Materials and Methods

#### 3.1. Model of Network

#### 3.2. Algorithm `PowerOfNodes`

- $dom$
- If a node v is chosen to be in D, then $v.dom$ is equal to 1. Otherwise, $v.dom=0$.
- $code$
- If $v.dom=1$, then $v.code=30$.If $v.dom=0$ and if additionally
- For each node x of ${N}_{1}\left(v\right)\cup {N}_{2}\left(v\right)$ is $x.dom=0$, then $v.code=0$.
- There is exactly one node x in ${N}_{1}\left(v\right)$ such that $x.dom=1$ and for each node x of ${N}_{2}\left(v\right)$ is $x.dom=0$, then $v.code=10$.
- There is at least one node x in ${N}_{2}\left(v\right)$, such that $x.dom=1$ and for each node x of ${N}_{1}\left(v\right)$ is $x.dom=0$, then $v.code=5$.
- v is $(1,2)$-dominated by nodes in D, then $15\le v.code\le 20$.

- $pow$
- This parameter shows the gain of adding v to D and its value depends on two algorithm parameters: ${a}_{1}$ and ${a}_{2}$. If v is already chosen to the $(1,2)$-dominating set, then $v.pow=0$. Otherwise, $v.pow={n}_{0}+{a}_{1}\xb7{n}_{1}+{a}_{2}\xb7{n}_{2}$, where
- ${n}_{0}=1$ if v is not $(1,2)$-dominated and otherwise ${n}_{0}=0$.
- ${n}_{1}$ is the number of nodes in ${N}_{1}\left(v\right)$ that do not have a neighbour in D.
- ${n}_{2}$ is the number of nodes in ${N}_{2}\left(v\right)$ that have exactly one neighbour in D but are not $(1,2)$-dominated by D or do not have any neighbours belonging to D within distance 2.

`PowerOfNodes`which has four parameters: a graph G, a node $u\in V\left(G\right)$ and two positive numbers: ${a}_{1},{a}_{2}$. The function determines the powers of u, each neighbour of u and each node at distance 2 from u.

#### Algorithm `PowerOfNodes` Analysis

Algorithm 1:PowerOfNodes |

#### 3.3. Algorithm `Minimal_12_Set`

`Minimal_12_Set`uses the

`PowerOfNodes`algorithm and finds a minimal $(1,2)$-dominating set.

#### Algorithm `Minimal_12_Set` Analysis

`Minimal_12_Set`(while...do lines 6–20), a node with the maximum value of $pow$ is chosen and added to the minimal $(1,2)$-dominating set (lines 7–11). This node changes its value of $dom$ from 0 to 1 (line 12). Then, necessary local variables of nodes are updated, first $code$ (lines 14–19), then $pow$ (line 20). Checking whether $x.pow>0$ (line 11) prevents the addition of a redundant node to the minimal $(1,2)$-dominating set. At the end of the performance of the Algorithm 2 (line 21), nodes with $dom$ equal to 1 form a minimal $(1,2)$-dominating set.

`Minimal_12_Set`algorithm). This accelerates the performance of the algorithm. However lines 7–11 make sure that the set of nodes with $dom=1$ is always minimal in sense of $(1,2)$-domination.

Algorithm 2:Minimal_12_Set |

#### 3.4. Example

`Minimal_12_Set`for ${a}_{1}=2$ and ${a}_{2}=1$. Let G be a graph as in Figure 2. The first number inside a node is its power, while the second–code. The numbers in Figure 2 show their values after performing the first five lines of the Algorithm 2.

`Minimal_12_Set`algorithm finds a minimal $(1,2)$-dominating set with the minimum possible cardinality.

## 4. Results

`Minimal_12_Set`algorithm and

`PowerOfNodes`function were implemented and tested using the igraph library in R. First, we used random geometric graphs as models of a network. A geometric random graph is the model of a spatial network, namely an undirected graph, constructed by placing randomly a given number of nodes in a unit square and connecting two nodes by a link if and only if their distance is in a given range, see [21,22]. In our tests, we generated random geometric graphs of order from 55 to 190 nodes and the radius within which the nodes are connected by a link between 0.08 and 0.4. We used three sets of parameters:

- ${a}_{1}=2,{a}_{2}=1$ denoted
`2 1`, - ${a}_{1}=1,{a}_{2}=1$ denoted
`1 1`, - ${a}_{1}=1,{a}_{2}=2$ denoted
`1 2`.

`Minimal_12_Set`with an algorithm that builds a minimal $(1,2)$-dominating set by choosing a permitted node randomly. (We permit a node to be added to a minimal $(1,2)$-dominating set if adding this node decreases the number of nodes which are not partially or fully $(1,2)$-dominated). We call this algorithm a random algorithm and denote it on presented diagrams by

`rand`. Its time complexity is $O\left({\mathsf{\Delta}}^{2}n\right)$.

#### 4.1. Geometric Random Graphs

`Minimal_12_Set`algorithm gave much better results than the random algorithm in the case of geometric random graphs. Not surprisingly, the difference between the results of the algorithms was greater for graphs with more nodes.

`2 1`gave the best results on average, however the differences between versions

`2 1`,

`1 1`and

`1 2`were not significant.

#### 4.2. Trees

`Minimal_12_Set`algorithm analyzes local neighbourhoods of each node. For this reason, for example in stars it always finds a minimal $(1,2)$-dominating set with the smallest possible cardinality, namely a minimum $(1,2)$-dominating set. However, this may not be true for trees in general.

`Minimal_12_Set`algorithm and the random algorithm were compared to the optimal algorithm that finds the $(1,2)$-domination number in trees (for details of the optimal algorithm see [18]). The cardinalities of the minimal $(1,2)$-dominating sets together with the optimal solutions are given in Figure 7.

`Minimal_12_Set`algorithm and the exact algorithm were much smaller than for the case of random algorithm. To investigate this difference more deeply, we counted the percent error. Namely, Figure 8 shows the percent error of the minimum value returned by algorithms

`2 1`and

`1 2`in relation to the optimal solution (denoted

`% alg`), as well as the percent error of the random algorithm (denoted

`% rand`). We noted that the

`Minimal_12_Set`algorithm gives much better results than the random one.

`2 1`and

`1 2`is relatively small, because it lies between $0\%$ and $12.12\%$ with a mean value of $6.64\%$, while the percent error of the random algorithm is between $15.56\%$ and $50.00\%$ with a mean value of $33.23\%$.

#### 4.3. Random Graphs and Regular Graphs

`Minimal_12_Set`algorithm. Moreover, the results given by the random algorithm were more diverse. In some cases the results were just $8.33\%$ worse than the

`Minimal_12_Set`algorithm, while in some cases were as high as $129.41\%$ worse.

`Minimal_12_Set`algorithm prefers the nodes with the highest degree, we tested the

`Minimal_12_Set`algorithm and random algorithm on random cubic graphs, that is graphs in which each node is of degree 3. We supposed that these graphs should eliminate the advantage of adding nodes with high degrees to the minimal $(1,2)$-dominating set. Since the degree of each node is only 3, adding a node to a minimal $(1,2)$-dominating set changes the power of at most 10 nodes. We tested the algorithms for cubic graphs of order from 30 to 500 nodes. Furthermore, in this situation the

`Minimal_12_Set`algorithm gave better results than the random one. The random algorithm gave worse results by $38.34\%$ on average, varying from $18.42\%$ to $75.00\%$.

## 5. Discussion

`PowerOfNodes`and

`Minimal_12_Set`. The second algorithm uses the first one and finds, in a polynomial time, a minimal $(1,2)$-dominating set of any graph. The conducted tests in trees show that the results returned by the

`Minimal_12_Set`are not far from the optimal solution and are much better than a simple random algorithm. Since a tree is a subgraph of any graph, this allows us to assume that similar good results should be true in general graphs. The tests performed for geometric random graphs, random graphs and cubic graphs seem to confirm our suppositions. Even though the nodes in cubic graphs have the same degree, the new algorithm still returned better results than the random one.

## 6. Conclusions and Future Work

`Minimal_12_Set`algorithm in ad hoc networks in which nodes are changing their positions. Furthermore, it is worth checking whether updating the powers of all nodes at distance at most 4 from the node newly added to the minimal $(1,2)$-dominating set will give much better results than updating the powers of nodes at distance at most 2. Of course, the computational time complexity of the new version of the algorithm will be greater, so the question is if such greater time complexity is of practical importance.

## Funding

## Data Availability Statement

## Conflicts of Interest

## References

- Information System on Graph Classes and Their Inclusions (ISGCI). Available online: https://www.graphclasses.org (accessed on 18 December 2021).
- Garey, M.R.; Johnson, D.S. Computers and Intractability: A Guide to the Theory of NP-Completeness; Freeman: San Francisco, CA, USA, 1979. [Google Scholar]
- Haynes, T.W.; Hedetniemi, S.T.; Slater, P. Fundamentals of Domination in Graphs, 1st ed.; CRC Press: Boca Raton, FL, USA, 1998. [Google Scholar] [CrossRef]
- Haynes, T.W.; Hedetniemi, S.T.; Slater, P.J. Domination in Graphs Advanced Topics, 1st ed.; Routledge: London, UK, 1998. [Google Scholar] [CrossRef]
- Karbasi, A.H.; Atani, R.E. Application of Dominating Sets in Wireless Sensor Networks. Int. J. Secur. Its Appl.
**2013**, 7, 185–202. [Google Scholar] - Dubois, S.; Kaaouachi, M.H.; Petit, F. Enabling Minimal Dominating Set in Highly Dynamic Distributed Systems. In Stabilization, Safety, and Security of Distributed Systems; Pelc, A., Schwarzmann, A., Eds.; SSS 2015, Lecture Notes in Computer Science; Springer: Cham, Switzerland, 2015; Volume 9212. [Google Scholar] [CrossRef] [Green Version]
- Yu, J.; Wang, N.; Wang, G.; Yu, D. Connected dominating sets in wireless ad hoc and sensor networks—A comprehensive survey. Comput. Commun.
**2013**, 36, 121–134. [Google Scholar] [CrossRef] - Yamuna, M.; Karthika, K. Medicine names as a DNA sequence using graph domination. Pharm. Lett.
**2014**, 6, 175–183. [Google Scholar] - Guze, S. An application of the selected graph theory domination concepts to transportation networks modelling. Sci. J. Marit. Univ. Szczec.
**2017**, 52, 97–102. [Google Scholar] - Ramalakshmi, R.; Radhakrishnan, S. Weighted dominating set based routing for ad hoc communications in emergency and rescue scenarios. Wirel. Netw.
**2015**, 21, 499–512. [Google Scholar] [CrossRef] - Hedar, A.-R.; Abdulaziz, S.N.; Mabrouk, E.; El-Sayed, G.A. Wireless Sensor Networks Fault-Tolerance Based on Graph Domination with Parallel Scatter Search. Sensors
**2020**, 20, 3509. [Google Scholar] [CrossRef] [PubMed] - Hedar, A.-R.; El-Sayed, G.A. Parallel genetic algorithm with elite and diverse cores for solving the minimum connected dominating set problem in wireless networks topology control. In Proceedings of the 2nd International Conference on Future Networks and Distributed Systems (ICFNDS ’18), New York, NY, USA, 26–27 June 2018; Association for Computing Machinery: New York, NY, USA, 2018; pp. 1–9. [Google Scholar] [CrossRef]
- Dai, F.; Wu, J. An extended localized algorithm for connected dominating set formation in ad hoc wireless networks. IEEE Trans. Parallel Distrib. Syst.
**2004**, 15, 908–920. [Google Scholar] [CrossRef] - Hedetniemi, S.M.; Hedetniemi, S.T.; Kinsley, J.; Rall, D.F. Secondary Domination in Graphs. AKCE J. Graphs Combin.
**2008**, 5, 103–115. [Google Scholar] - Factor, K.A.S.; Langley, L.J. An introduction to (1,2)-domination graphs. Congr. Numer.
**2009**, 199, 33–38. [Google Scholar] - Kayathri, K.; Vallirani, S. (1,2)-Domination in Graphs. In Theoretical Computer Science and Discrete Mathematics; Arumugam, S., Bagga, J., Beineke, L., Panda, B., Eds.; ICTCSDM 2016, Lecture Notes in Computer Science; Springer: Cham, Switzerland, 2017; Volume 10398. [Google Scholar] [CrossRef]
- Michalski, A.; Włoch, I. On the existence and the number of independent (1,2)-dominating sets in the G-join of graphs. Appl. Math. Comput.
**2020**, 377, 125155. [Google Scholar] [CrossRef] - Raczek, J. Complexity Issues on Secondary Domination Number. Nord. J. Comput.
**1994**, 1, 157–171. [Google Scholar] - Kakugawa, H.; Masuzawa, T. A self-stabilizing minimal dominating set algorithm with safe convergence. In Proceedings of the 20th IEEE International Parallel and Distributed Processing Symposium, Rhodes, Greece, 25–29 April 2006; p. 8. [Google Scholar] [CrossRef]
- van Rooij, J.M.M.; Bodlaender, H.L. Exact algorithms for dominating set. Discr. Appl. Math.
**2011**, 159, 2147–2164. [Google Scholar] [CrossRef] [Green Version] - Penrose, M. Random Geometric Graphs; Oxford Univ. Press: Oxford, UK, 2003. [Google Scholar] [CrossRef]
- Bringmann, K.; Friedrich, T. Exact and Efficient Generation of Geometric Random Variates and Random Graphs. In Automata, Languages, and Programming; Fomin, F.V., Freivalds, R., Kwiatkowska, M., Peleg, D., Eds.; ICALP 2013, Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2013; Volume 7965. [Google Scholar] [CrossRef] [Green Version]
- Pandas. Available online: https://pandas.pydata.org/ (accessed on 2 October 2021).
- Seaborn: Statistical Data Visualization. Available online: https://seaborn.pydata.org/ (accessed on 2 October 2021).

**Figure 9.**The cardinality of $(1,2)$-dominating sets returned by the

`Minimal_12_Set`and random algorithms in random graphs.

% Alg | % Rand | |
---|---|---|

mean | 6.636940 | 33.234861 |

std | 2.700715 | 5.330012 |

min | 0.000000 | 15.555556 |

25% | 5.559414 | 30.740952 |

50% | 6.698718 | 32.365320 |

75% | 8.016610 | 35.875975 |

max | 12.121212 | 50.000000 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the author. 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**

Raczek, J.
Polynomial Algorithm for Minimal (1,2)-Dominating Set in Networks. *Electronics* **2022**, *11*, 300.
https://doi.org/10.3390/electronics11030300

**AMA Style**

Raczek J.
Polynomial Algorithm for Minimal (1,2)-Dominating Set in Networks. *Electronics*. 2022; 11(3):300.
https://doi.org/10.3390/electronics11030300

**Chicago/Turabian Style**

Raczek, Joanna.
2022. "Polynomial Algorithm for Minimal (1,2)-Dominating Set in Networks" *Electronics* 11, no. 3: 300.
https://doi.org/10.3390/electronics11030300