depends on its unique neighbor in the MDS (the neighbor is v). The predicate noDpN br indicates that v has no dependent neighbor.
For convenience, we introduce
• InNbr(v) = |{u ∈ N(v) | u.state = IN}|.
In the algorithm Well4n, each node executes the six rules shown in Algorithm 5. The state diagram of Well4n is given in Figure 3.1.
Algorithm 5 Well4n
then v.state := OUT1; // rectify the counter
R5: if (v.state = OUT1 ∨ v.state = WAIT) ∧ InNbr(v) > 1
then v.state := OUT2; // rectify the counter
R6: if (v.state = OUT1 ∨ v.state = OUT2) ∧ InNbr(v) = 0
then v.state := WAIT; // rectify the counter
3.3 Correctness and convergence
We now prove the correctness of Well4n.
CHAPTER 3. SELF-STABILIZING MDS ALGORITHMS 3.3. CORRECTNESS AND CONVERGENCE
Figure 3.1: The state diagram of Well4n.
Lemma 3.3.1. In any configuration in which no node is privileged, (a) the number of IN neighbors of every OUT node consistent with its state, and (b) the set S is a minimal dominating set for G.
Proof. For (a), it is easy to check that if the state of an OUT node is inconsistent with the description on the number of its IN neighbors, then a rule can be enabled for this node.
For (b), suppose to the contrary that S is not a minimal dominating set for G. Then either (i) S is not a dominating set or (ii) S is a dominating set but not minimal. First consider (i). Since S is not a dominating set, there exists at least one node u /∈ S which has no IN neighbor; let S′ be the set of all such nodes. Since rule R6 is not enabled, every node in S′ has state = WAIT. Let u0 be the node in S′ with minimum id. Then u0 satisfies all the constraints of rule R1. Hence rule R1 is enabled and this contradicts to the assumption that no node is privileged.
Next consider (ii). Since S is a dominating set but not minimal, there must exist at least one node u∈ S such that S\{u} is also a dominating set for G. Then |N(u) ∩ S| ≥ 1 and for all u′ in N (u)\S, we have |N(u′)∩ S| ≥ 2. Thus, every node u′ in N (u)\S has InN br(u′) > 1. Hence, every node u′ in N (u)\S must have u′.state = OUT2; otherwise rule R5 is enabled on u′. Consequently, node u has noDpN br(u) = true and either InN br(u) = 1 (if|N(u) ∩ S| = 1) or InNbr(u) > 1 (if |N(u) ∩ S| > 1). Hence, either rule R2 or rule R3 is
CHAPTER 3. SELF-STABILIZING MDS ALGORITHMS 3.3. CORRECTNESS AND CONVERGENCE
enabled on node u, which is a contradiction.
Note that when the algorithm terminates, there is no node with state = WAIT. Since R6 is not enabled, any OUT node without an IN neighbor must have state = WAIT. Hence to prove that there is no node with state = WAIT, it suffices to prove that S is a minimal dominating set of G.
We now show that Well4n converges in a finite time. In particular, we show that the num-ber of moves of Well4n is at most 4n− 2. Let k be a nonnegative integer and ⟨r1, r2, . . . , rk⟩ be a sequence of rules (ri’s are not necessarily distinct). The sequence ⟨r1, r2, . . . , rk⟩ is called a move sequence if a node can execute rule r1, then rule r2, . . ., then rule rk. The following two lemmas show that in any possible move sequence of a specific node, rule R1 and rule R6 appear at most once when a distributed system run Well4n for a time period without any external intervention.
Lemma 3.3.2. If a node executes rule R1, then it will not execute any other rule. Conse-quently, if a node enters the set S, then it will never leave S.
Proof. Let v be a node which executes rule R1. Then v.state has been set to IN and thereafter v enters S. By the precondition of rule R1, v has no IN neighbor and no better neighbor;
therefore no neighbor of v enters S at the same time when v enters S. Thus, no node in N (v) that enters S and therefore InN br = 0. After executing rule R1, v.state is IN and the possible rule that v can execute is either rule R2 or rule R3. Rule R2 is impossible since it requires InN br(v) = 1; similarly rule R3 is also impossible since it requires InN br(v) > 1.
Therefore, v will not execute any other rule. The second statement of this lemma now follows.
Lemma 3.3.3. A node can execute rule R6 at most once, or equivalently, a node can set its state to WAIT at most once.
CHAPTER 3. SELF-STABILIZING MDS ALGORITHMS 3.3. CORRECTNESS AND CONVERGENCE
Proof. Let v be a node which executes rule R6 once. By the precondition of rule R6, v has no IN neighbor when executing rule R6. After executing rule R6, v.state is set to WAIT and the possible rules that v can execute is rule R1 or rule R4 or rule R5. If v executes rule R1, then by Lemma 3.3.2, v will not execute any other rule and we have this lemma. If v executes rule R4 or R5, then InN br(v) = 1 or InN br(v) > 1 must be true before rule R4 or R5 is enabled, meaning that v has a neighbor (say, u) which has executed rule R1; by Lemma 3.3.2 again, u will never leave S. Therefore it is impossible to have InN br(v) = 0, which means that v cannot execute rule R6 again.
In the next, we firstly claim that the length of a move sequence of any node in G is at most 4. If this is true, then the total number of moves among all nodes in G is at most 4n.
Furthermore, we improve the upper bound to 4n− 2 and show that this bound is tight.
Theorem 3.3.4. The proposed algorithm Well4n is self-stabilizing under an unfair dis-tributed daemon and it stabilizes after at most 4n− 2 moves with a minimal dominating set, where n is the number of nodes. Moreover, the bound 4n− 2 is tight.
Proof. By Lemma 3.3.1, the algorithm Well4n is correct. To prove that Well4n stabilizes after at most 4n− 2 moves, we first prove that it stabilizes after at most 4n moves, from which we conclude that Well4n has the convergence property. To do this, it suffices to show that any move sequence of a node is of length at most 4 under an unfair distributed daemon.
Let v be an arbitrary node in G. By Lemma 3.3.3, v can execute rule R6 at most once.
Thus, there are two cases: v never executes R6 and v executes R6 once.
First consider the case that v never executes rule R6. Then v.state never changes to WAIT. Thus, the move sequence of v is either ⟨R1⟩ or ⟨R2,R5⟩ or ⟨R4,R5⟩. It follows that any move sequence of v is of length at most 2.
Now consider the case that v executes rule R6 once. In this case, regard a move sequence of v as the concatenation of a prefix and a suffix. By Lemma 3.3.2, the prefix of any move
CHAPTER 3. SELF-STABILIZING MDS ALGORITHMS 3.3. CORRECTNESS AND CONVERGENCE
sequence of v cannot contain rule R1 since if v executes rule R1 then v will not execute any other rule, including rule R6. Hence, the possible prefix of any move sequence of v is either
⟨R2,R6⟩ or ⟨R3,R6⟩ or ⟨R4,R6⟩ or ⟨R5,R6⟩. After v executes rule R6, v.state changes to WAIT. Thus, the possible suffix of any move sequence of v is either ⟨R6,R1⟩ or ⟨R6,R4,R5⟩
or ⟨R6,R5⟩. Concatenating the prefix and suffix, we conclude that any move sequence of v is of length at most 4.
From the above, Well4n stabilizes after at most 4n moves with a minimal dominating set. We now prove that the bound can be strengthen to 4n−2. The cases of n = 1 and n = 2 are trivial. Suppose n≥ 3 and one of the nodes makes 4 moves; by the above argument, this node has two neighbors executing rule R1. Thus, at least two nodes in G make less than 4 moves and the upper bound can be strengthen to 4n− 2.
We now give an example to show that the upper bound 4n− 2 is tight. Consider the complete bipartite graph K2,n−2, where n ≥ 3. Let the two nodes in the partite set of cardinality two have the maximum and the minimum identifiers among the n nodes. If initially all nodes are in state IN, then there is a way that all the rest of the nodes executes
⟨R3,R6,R4,R5⟩ but nodes with the maximum and minimum identifiers execute ⟨R3,R6,R1⟩.
All together 4n− 2 moves are made.
Note that our algorithm Well4n will be equivalent to Goddard5n if rule R4 is modified as follows:
R4’: if (v.state = OUT2 ∨ v.state = WAIT) ∧ InNbr(v) = 1 then v.state := OUT1;
The idea of state OUT1 is to lock the unique IN neighbor. If node v change its state from OUT1 to OUT2, there exists a neighbor u of v entering the set S. By Lemma 3.3.2, u will never leave S. Hence, u will dominate v thereafter. Suppose then another IN neighbor w of v wants to leave S, and somehow it really does. If u becomes the only one IN neighbor of