Optimized Silent Self-Stabilizing Scheme for Tree-Based Constructions

We propose a general scheme to compute tree-based data structures on arbitrary networks. This scheme is self-stabilizing, silent, and despite its generality, also efficient. It is written in the locally shared memory model with composite atomicity assuming the distributed unfair daemon, the weakest scheduling assumption of the model. Its stabilization time is in at most 4nmaxCC\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$4{n_{\mathtt {maxCC}}}$$\end{document} rounds, where nmaxCC\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${n_{\mathtt {maxCC}}}$$\end{document} is the maximum number of processes in any connected component of the network. We illustrate the versatility and efficiency of our approach by proposing several instantiations solving classical spanning tree problems such as DFS, BFS, shortest-path, or unconstrained spanning tree/forest constructions, as well as other fundamental problems like leader election or finding maximum-bottleneck-bandwidth paths. We also exhibit polynomial upper bounds on its stabilization time in steps and process moves, holding for a large class of instantiations. In several cases, the polynomial step and move complexities we obtain for those instantiations match the best known complexities of existing algorithms, despite the latter being dedicated to particular problems. Furthermore, a significant set of instantiations of our scheme requires only bounded memory space per process. This set includes, but is not limited to, DFS, BFS, and shortest-path spanning tree constructions.


Introduction
A self-stabilizing algorithm [30] is able to recover a correct behavior in finite time, regardless of the arbitrary initial configuration of the system, and therefore also after a finite number of transient faults, provided that those faults do not alter the code of the processes.Self-stabilization makes no hypotheses on the nature (e.g., memory corruption or topological changes) or extent of transient faults that could hit the system.A self-stabilizing system recovers from the effects of those faults in an unified manner.Now, such versatility comes at a price, e.g., after transient faults cease, there is a finite time period, called the stabilization phase, during which the safety properties of the system are not guaranteed.Hence, self-stabilizing algorithms are mainly compared according to their stabilization time, the maximum duration of the stabilization phase.
Among the vast self-stabilizing literature, many works (see [38] for a survey) focus on tree-based constructions, i.e., constructions of specific distributed spanning treeor forest-shaped data structures.Most of these constructions actually achieve an additional property called silence [32]: a silent self-stabilizing algorithm converges within finite time to a configuration from which the values of the communication registers used by the algorithm remain fixed.Silence is a desirable property.Indeed, as noted in [32], the silent property usually implies more simplicity in the algorithm design.Moreover, a silent algorithm may utilize less communication operations and communication bandwidth.
Self-stabilizing tree-based constructions are widely used as a basic building block of more complex self-stabilizing solutions.Indeed, composition is a natural way to design self-stabilizing algorithms [47] since it allows to simplify both the design and proofs of self-stabilizing algorithms.Various composition techniques have been introduced so far, e.g., collateral composition [37], fair composition [31], cross-over composition [4], and conditional composition [22]; and many self-stabilizing algorithms are actually made as a composition of a silent tree-based construction and another algorithm designed for tree/forest topologies, e.g.[3,7,21].Notably, the silence property is not mandatory in such designs, however it allows to write simpler proofs [23].Finally, notice that silent tree-based constructions have also been used to build very general results, e.g., the self-stabilizing proof-labeling scheme constructions proposed in [6].
We consider here the locally shared memory model with composite atomicity introduced by Dijkstra [2,30], which is the most commonly used model in self-stabilization.In this model, executions proceed in atomic steps (in which a subset of enabled processes move, i.e., update their local states), and the asynchrony of the system is captured by the notion of daemon.The weakest (i.e., the most general) daemon is the distributed unfair daemon.Hence, solutions stabilizing under such an assumption are highly desirable, because they work under any daemon assumption.
The stabilization time of self-stabilizing algorithms is usually evaluated in terms of rounds, which capture the execution time according to the speed of the slowest processes.However, another crucial issue is the number of local state updates, i.e., the number of moves.Indeed, the stabilization time in moves captures the amount of computations an algorithm needs in order to recover a correct behavior.Notice that the number of moves and the number of (atomic) steps are closely related: if an execution e contains x steps, then the number y of moves in e satisfies x ≤ y ≤ n • x, where n is the number of processes. 1he daemon assumption and the time complexity are closely related.Indeed, to obtain practical solutions, the designer usually tries to avoid strong assumptions on the daemon, like for example, assuming that all executions are synchronous.Now, when the considered daemon does not enforce any bound on the execution time of processes, the stabilization time in moves (resp. in steps) can be bounded only if the algorithm works under an unfair daemon.For example, if the daemon is assumed to be distributed and weakly fair (a daemon stronger than the distributed unfair one) and the studied algorithm actually requires the weakly fairness assumption to stabilize, then it is possible to construct executions whose convergence is arbitrarily long in terms of atomic steps (and so in moves), meaning that, in such executions, there are processes whose moves do not make the system progress in the convergence.In other words, these latter processes waste computation power and so energy.Such a situation should be therefore prevented, making the unfair daemon more desirable than the weakly fair one.
There are many self-stabilizing algorithms proven under the distributed unfair daemon, e.g.[1,9,24,25,34].However, analyses of the stabilization time in steps, or moves, remain rather unusual and this may be an important issue.Indeed, recently, several selfstabilizing algorithms working under a distributed unfair daemon have been shown to have an exponential stabilization time in steps in the worst case.In [1], silent leader election algorithms from [24,25] are shown to be exponential in steps in the worst case.In [29], the Breadth-First Search (BFS) algorithm of Huang and Chen [39] is also shown to be exponential in steps.Finally, in [35] authors show that the silent self-stabilizing algorithm they proposed in [34] is also exponential in steps.
Contribution.In this paper, we propose a general scheme to compute tree-based data structures on bidirectional weighted networks of arbitrary topology (n.b., the topologies are not necessarily connected).This algorithm is self-stabilizing and silent.It is written in the locally shared memory model with composite atomicity, assuming the distributed unfair daemon.
Despite its versatility, our scheme is efficient.Indeed, its stabilization time is at most 4n maxCC rounds, where n maxCC is the maximum number of processes in a connected component.Moreover, its stabilization time in moves (and so in steps) is polynomial in usual cases; see the example instantiations we propose.Precisely, we exhibit polynomial upper bounds on its stabilization time in moves that depend on the particular problems we consider.
Table 1 Comparison between the stabilization time of some instances of our scheme and solutions from the literature (to be fair, we have replaced n maxCC by n when the paper from the literature assumes a connected network) Spanning tree with explicit parent pointers Shortest-path spanning tree Leader election Refs.[13] [ 27] [ 1] Steps To illustrate the versatility and efficiency of our approach, we propose several instantiations for solving classical tree-based problems.
Assuming an input set of roots, we propose an instantiation to compute a spanning forest of arbitrary shaped trees, with non-rooted components detection. 2This instantiation stabilizes in O(n maxCC • n) moves, which matches the best known step complexity for spanning tree construction [13] with explicit parent pointers. 3ssuming then a rooted network with positive integer weights, we propose shortestpath spanning tree and DFS constructions, with non-rooted components detection.The shortest-path spanning tree construction stabilizes in O(n maxCC 3 • n • W max ) moves, where W max is the maximum weight of an edge.This move complexity matches the best known move complexity for this problem [27].
Assuming now that the network is identified (i.e., processes have distinct IDs), we propose two instantiations for electing a leader in each connected component and building a spanning tree rooted at each leader.In one version, stabilizing in O(n maxCC 2 • n) moves, the trees are of arbitrary topology.This move complexity matches the best known step complexity for leader election [1].In the other version, stabilizing in O(n maxCC 3 • n) moves, the leader is guaranteed to be the process of minimal identifier in the connected component, and trees are BFS.
Finally, assuming a rooted network with a bandwidth assigned to each edge, we propose an instantiation computing for each process the maximum bottleneck bandwidth to the root, and a corresponding path (with the fewest edges).
Besides, most of these instantiations can be set to require only bounded memory (at the price of providing to the processes some knowledge about the graph topology; typically an upper bound on the number of processes).Furthermore, one can easily derive from these various examples other silent self-stabilizing tree-based constructions.A comparison table between some instances of our scheme and solutions from the literature is given in Table 1.
Related Work.This work is inspired by [27].This paper also considers the composite atomicity model under the distributed unfair daemon.The proposed algorithm is efficient both in terms of rounds and moves, tolerates disconnections, but is restricted to the case of the shortest-path tree in a rooted network.Generalizing this work to obtain a generic yet efficient self-stabilizing algorithm requires a fine tuning of the algorithm (presented in Sect.3) and a careful rewriting of the proofs of correctness (presented in the remaining sections).In particular, almost all the concepts used to prove termination or complexities need to be redefined to suit the new, more general setting.Consequently, their new properties and the corresponding proofs are mostly novel.
Another closely related work is the one of Cobb and Huang [11].In that paper, a generic self-stabilizing algorithm is presented for constructing in a rooted connected network a spanning tree where a given metric is maximized.Now, since the network is assumed to be rooted (i.e., a leader process is already known), leader election is not an instance of their generic algorithm.Similarly, since they assume connected networks, the non-rooted components detection cannot be expressed too.Finally, their algorithm is proven in the composite atomicity model yet assuming a strong scheduling assumption: the sequential weakly fair daemon.
General schemes for arbitrary connected and identified networks have been proposed to transform almost any algorithm (specifically, those algorithms that can be self-stabilized) into its corresponding stabilizing version [8,14,36,41].Such universal transformers are, by essence, inefficient both in terms of space and time complexities: their purpose is only to demonstrate the feasibility of the transformation.In [41] and [8], authors respectively consider self-stabilization in asynchronous message-passing systems and in the synchronous locally shared memory model, while expressiveness of snap-stabilization is studied in [14,36] assuming the locally shared memory model with composite atomicity and a distributed unfair daemon.
In [26,33], the authors propose a method to design silent self-stabilizing algorithms for a class of fix-point problems, namely fix-point problems which can be expressed using r -operators.Their solution works in directed networks using bounded memory per process.In [33], they consider the locally shared memory model with read/write atomicity, while in [26], they generalize their approach to asynchronous messagepassing systems.In both papers, they establish a stabilization time in O(D + |S|) rounds, where D is the network diameter and S is the set on which the r -operator applies.However, this bound is actually proven for the synchronous case only.
The remainder of the related work only concerns the locally shared memory model with composite atomicity assuming a distributed unfair daemon.In [6], authors use the concept of labeling scheme introduced by Korman et al. [42] to design silent self-stabilizing algorithms with bounded memory per process.Using this approach, they show that every static task has a silent self-stabilizing algorithm which converges within a linear number of rounds in an arbitrary identified network.No step (nor move) complexity is given.
Efficient and general schemes for snap-stabilizing (non silent) waves in arbitrary connected and rooted networks are investigated in [17].The obtained snap-stabilizing algorithms execute each wave in a polynomial number of rounds and steps.
Few other works consider the design of particular tree-based constructions and their step complexity.Self-stabilizing algorithms that construct BFS trees in arbitrary connected and rooted networks are proposed in [18,19].The algorithm in [18] is not silent and has a stabilization time in O(Δ • n 3 ) steps, where Δ is the maximum degree of the network.The silent algorithm given in [19] has a stabilization time in O(D 2 ) rounds and O(n 6 ) steps.Silent self-stabilizing algorithms that construct spanning trees of arbitrary topologies in arbitrary connected and rooted networks are given in [13,43].The solution proposed in [13] stabilizes in at most 4 • n rounds and at most 5 • n 2 steps, while the algorithm given in [43] stabilizes in at most n • D moves.However, the round complexity of this latter algorithm is not analyzed, and the parent of a process is not computed explicitly.Furthermore, Cournier [20] showed that the straightforward variant of this algorithm where a parent pointer variable is added has a stabilization time in Ω(n 2 • D) steps in an infinite class of networks.
Several other papers propose self-stabilizing algorithms stabilizing in both a polynomial number of rounds and a polynomial number of steps, e.g.[1] (for the leader election in arbitrary identified and connected networks), and [15,16] (for the DFS token circulation in arbitrary connected and rooted networks).The silent leader election algorithm proposed in [1] stabilizes in at most 3 • n + D rounds and O(n 3 ) steps.The DFS token circulations given in [15,16] execute each wave in O(n) rounds and O(n 2 ) steps using O(n • log n) space per process for the former, and O(n 3 ) rounds and O(n 3 ) steps using O(log n) space per process for the latter.Note that in [15], processes are additionally assumed to be identified.
Roadmap.In the next section, we present the computational model and basic definitions.In Sect.3, we describe our general scheme.Its proof of correctness is given in Sect. 4. A complexity analysis in moves is presented in Sect.5, whereas an analysis of the stabilization time in rounds is proposed in Sect.6. Various instantiations with their specific complexity analyses are presented in Sect.7. Finally, we make concluding remarks in Sect.8.

Preliminaries
We consider distributed systems made of n ≥ 1 interconnected processes.Each process can directly communicate with a subset of other processes, called its neighbors.Communication is assumed to be bidirectional.Hence, the topology of the system is conveniently represented as a simple undirected graph G = (V , E), where V is the set of processes and E the set of edges, representing communication links.Every (undirected) edge {u, v} actually consists of two arcs: (u, v) (i.e., the directed link from u to v) and (v, u) (i.e., the directed link from v to u).For every process u, we denote by V u the set of processes (including u) in the same connected component of G as u.In the following, V u is simply referred to as the connected component of u.We denote by n maxCC the maximum number of processes in a connected component of G.By definition, n maxCC ≤ n.
Every process u can distinguish its neighbors using a local labeling of a given datatype Lbl.All labels of u's neighbors are stored into the set Γ (u).Moreover, we assume that each process u can identify its local label α u (v) in the set Γ (v) of each neighbor v.Such labeling is called indirect naming in the literature [46].When it is clear from the context, we use, by an abuse of notation, u to designate both the process u itself, and its local labels (i.e., we simply use u instead of α u (v) for v ∈ Γ (u)).Let δ u = |Γ (u)| be the degree of process u.The maximal degree of G is Δ = max u∈V δ u .
We use the composite atomicity model of computation [2,30] in which processes communicate using a finite number of locally shared registers, called variables.In one indivisible move, each process can read its own variables and that of its neighbors, performs local computation, and may change only its own variables.The state of a process is defined by the values of its local variables.A configuration of the system is a vector consisting of the states of each process.
A distributed algorithm consists of one local program per process.The program of each process consists of a finite set of rules of the form label : guard → action Labels are only used to identify rules in the reasoning.A guard is a Boolean predicate involving the state of the process and that of its neighbors.The action part of a rule updates the state of the process.A rule can be executed only if its guard evaluates to true; in this case, the rule is said to be enabled.By extension, a process is said to be enabled if at least one of its rules is enabled.We denote by Enabled(γ ) the subset of processes that are enabled in configuration γ .
When the configuration is γ and Enabled(γ ) = ∅, a non-empty set X ⊆ Enabled(γ ) is selected by a so-called daemon; then every process of X atomically executes one of its enabled rules, leading to a new configuration γ .The atomic transition from γ to γ is called a step.We also say that each process of X executes an action or simply moves during the step from γ to γ .The possible steps induce a binary relation over C, denoted by →.An execution is a maximal sequence of configurations for all i > 0. The term "maximal" means that the execution is either infinite, or ends at a terminal configuration in which no rule is enabled at any process.
As explained before, each step from a configuration to another is driven by a daemon.We define a daemon as a predicate over executions.We say that an execution e is an execution under the daemon S if S(e) holds.In this paper we assume that the daemon is distributed and unfair."Distributed" means that while the configuration is not terminal, the daemon should select at least one enabled process, maybe more."Unfair" means that there is no fairness constraint, i.e., the daemon might never select an enabled process unless it is the only enabled process.In other words, the distributed unfair daemon corresponds to the predicate true, i.e., this is the most general daemon.
In the composite atomicity model, an algorithm is silent if all its possible executions are finite.Hence, we can define silent self-stabilization as follows.
Definition 1 (Silent Self-Stabilization) Let L be a non-empty subset of configurations, called the set of legitimate configurations.A distributed system is silent and self-stabilizing under the daemon S for L if and only if the following two conditions hold: -all executions under S are finite, and 123 -all terminal configurations belong to L.
Three main units of measurement are used to evaluate time complexity in our model: the number of moves, steps, and rounds.The definition of a round uses the concept of neutralization: a process v is neutralized during a step γ i → γ i+1 , if v is enabled in γ i but not in configuration γ i+1 , and does not execute any action in the step γ i → γ i+1 .Then, the rounds are inductively defined as follows.The first round of an execution e = γ 0 γ 1 • • • is the minimal prefix e = γ 0 • • • γ j such that every process that is enabled in γ 0 either executes an action or is neutralized during a step of e .Let e be the suffix γ j γ j+1 • • • of e.The second round of e is the first round of e , and so on.
The stabilization time of a silent self-stabilizing algorithm is the maximum time (in moves, steps, or rounds) over every execution possible under the considered daemon (starting from any initial configuration) to reach a terminal (legitimate) configuration.
Finally, a self-stabilizing algorithm requires bounded memory space if there exists a finite set S such that, along any execution from any configuration in which the states belong to S, all the reached states of any process u still belong to S.

The Problem
We propose a general silent self-stabilizing algorithm, called TbC (stands for Treebased Constructions), which aims at converging to a terminal configuration where a specified spanning forest (maybe a single spanning tree) is (distributedly) defined.The various definitions used in TbC and its code are respectively summarized and formally given in Fig. 1 and Algorithm 1. Furthermore, a (slightly simplified) version of TbC has been implemented in Java and some instantiations can be simulated and visualized [40].We invite the reader to use this tool to facilitate its understanding of the paper.
In this algorithm, each process u has three4 constant inputs.
can BeRoot u : a Boolean value, which is true if u is allowed to be the root of a tree.In this case, u is called a candidate.In a terminal configuration, every tree root satisfies can BeRoot, but the converse is not necessarily true.Moreover, for every connected component C, if there is at least one candidate u ∈ C, then every process of C should belong to a tree (so there is at least one tree root in C) in any terminal configuration.
If there is no candidate in a connected component, we require that all processes of the component converge to a particular terminal state expressing the local detection of the absence of candidates.pname u : the name of u. pname u ∈ I Ds, where I Ds = N∪{⊥} is totally ordered by < and min < (I Ds) = ⊥.The value of pname u is problem dependent.Actually, we consider two particular cases of naming.In one case, ∀v ∈ V , pname v = ⊥.
In the other case, ∀u, v ∈ V , pname u = ⊥ ∧ (u = v ⇒ pname u = pname v ), i.e., pname u is a unique global identifier.dist Root u : a distance belonging to Dist Set whose description is given below.The value dist Root u is the distance value that the candidate u should take when it is a tree root; see the variable d u below.
Every tree is based on some kind of distance.We denote by Dist Set the distance domain.We use distances to detect cycles.However, according to the specific problem we consider, we may also want to minimize the weight of the trees using the distances.Distances are computed using weights on arcs.Each edge {u, v} has then two weights belonging to Dist Set: ω u (v) denotes the weight of the arc (u, v), and ω v (u) denotes the weight of the arc (v, u).More precisely, we need an ordered magma (Dist Set, ⊕, ≺), i.e., ⊕ is a closed binary operation on Dist Set and ≺ is a total order on this set.The definition of (Dist Set, ⊕, ≺) is problem dependent.Predicates P_neigh Active(u), P_r oot Active(u), and P_toBeC used in the algorithm are also problem dependent; see Fig. 1.If a process u satisfies P_neigh Active(u) or P_r oot Active(u), then u is required to minimize the weight of its tree.This minimization uses the ordered magma and the problem dependent constant dist Root u .
We assume that, for every arc (u, v) of G and for every values d 1 and d 2 in Dist Set, we have Finally, for every integer i ≥ 0, we define d 1 ⊕ (i • d 2 ) as follows: -

The Variables
In TbC, each process u maintains the following three variables.st u ∈ {I , C, E B, E F}: this variable gives the status of the process.I , C, E B, and E F respectively stand for Isolated, Correct, Error Broadcast, and Error Feedback.The first two status, I and C, are involved in the normal behavior of the algorithm, while the two other ones, E B and E F, are used during the error correction.The meaning of E B and E F will be further detailed in Sect.3.4.In a terminal configuration, if V u contains a candidate, then st u = C, otherwise st u = I .par u ∈ {⊥} ∪ Lbl: In a terminal configuration, if V u contains a candidate, then either par u = ⊥, i.e., u is a tree root, or par u belongs to Γ (u), i.e., par u designates a neighbor of u, referred to as its parent.Otherwise (V u does not contain a candidate), the value of par u is meaningless.
larger than or equal to the weight of the tree path from u to its tree root, otherwise the value of d u is meaningless.

Typical Execution
Assume that the system starts from a configuration where, for every process u, st u = I .All processes that belong to a connected component containing no candidates are disabled forever.Focus now on a connected component C where at least one process is a candidate.Then, any process u of status I that is a candidate or that satisfies the predicate P_toBeC (this latter case cannot occur during the first step) is enabled to execute rule R R .If selected by the daemon, it executes R R (u) to initiate a tree or to join a tree rooted at some candidate, choosing among the different possibilities the one that minimizes its distance value.Using this rule, it also switches its status to C and sets In order to more precisely describe what happens, we focus on the two possible definitions of P_toBeC; see Fig. 1.
In that case, the variable d u is restricted to belong to dist Set Finite, and thus the algorithm has bounded memory space.Note that we further require in this case that P_neigh Active(u) ≡ P_neighV alid(u) ∧ P_toBeC(u); see Fig. 1.Therefore, rules R U are always enabled to reduce the weight of the trees if choosing some neighbor as parent makes the value of d u decrease (while keeping it in dist Set Finite).Once the distance values are minimized, for any process u having status C in C, we have d u = d par u ⊕ ω u ( par u ).So, the distance of any process u having status C in C and at depth i in its tree belongs to ∪ 0≤ j≤i distC Ok( j).
Hence, all processes of C have the status C, or R R is enabled at some processes with a status different from C. Eventually the system reaches a terminal configuration, where every process of C has the status C and verifies ¬P_neighV alid(•).

Error Correction
Assume now that the system is in an arbitrary configuration.Inconsistencies between the states of neighboring processes are detected using Predicate P_abRoot.We call abnormal root any process u satisfying P_abRoot(u).Informally (see the formal definition in Algorithm 1), a process u is an abnormal root if u is neither a normal root (i.e., ¬P_r oot(u) holds), nor isolated (i.e.st u = I ), and satisfies one of the following three conditions: 1. its parent pointer does not designate a neighbor, 2. its distance d u is inconsistent with the distance of its parent, or 3. its status is inconsistent with the status of its parent.
Every process u that is neither an abnormal root nor isolated satisfies one of the two following cases.Either u is a normal root (i.e., P_r oot(u) holds) or u points to some neighbor (i.e., par u ∈ Γ (u)), and the state of u is coherent w.r.t. the state of its parent.In this latter case, u ∈ Children( par u ), i.e., u is a "real" child of its parent; see Sect.3.5 for the formal definition.Consider a path P = u 0 , . . ., u k such that, for every 0 ≤ i < k, u i+1 ∈ Children(u i ).P is acyclic.If u 0 is either a normal or an abnormal root, then P is called a branch rooted at u 0 .Let u be a root (either normal or abnormal).We define the tree T (u) as the set of all processes that belong to a branch rooted at u.If u is a normal root, then T (u) is said to be a normal tree, otherwise u is an abnormal root and T (u) is said to be an abnormal tree.We call any configuration without abnormal trees a normal configuration.So, to recover a normal configuration, it is necessary to remove all abnormal trees.
For each abnormal tree T , we have two cases.If the abnormal root u of T can join another tree T using rule R U (u) (thus decreasing its distance value, since, in this case, P_neigh Active(u) or P_r oot Active(u) must hold), then it does so and T disappears by becoming a subtree of T .Otherwise, T is entirely removed in a top-down manner, starting from its abnormal root u.Now, in that case, we have to prevent the following situation: u leaves T ; this removal creates some abnormal trees, each of those being rooted at a previous child of u; and later u joins one of those (created) trees, or a tree issued from them.(This issue is sometimes referred to as the count-to-infinity problem [44]).Hence, the idea is to freeze T , before removing it.By freezing we mean assigning to each member of the tree an error state, here E B or E F, so that (1) no member v of the tree is allowed to execute R U (v), and (2) no process w can join the tree by executing R R (w) or R U (w).Once frozen, the tree can be safely deleted from its root to its leaves.
The freezing mechanism (inspired from [5]) is achieved using the status E B and E F, and the rules R EB and R EF .If a process is not involved into any freezing operation, then its status is I or C. Otherwise, it has status E B or E F and no neighbor can select it as its parent.These two latter status are actually used to perform a "Propagation of Information with Feedback" [10,45] in the abnormal trees.This is why status E B means "Error Broadcast" and E F means "Error Feedback".From an abnormal root, the status E B is broadcast down in the tree using the rule R EB .Then, once the E B wave reaches a leaf, the leaf initiates a convergecast E F-wave using the rule R EF .
Once the E F-wave reaches the abnormal root, the tree is said to be dead, meaning that all processes in the tree have status E F and, consequently, no other process can join it.So, the tree can be safely deleted from its abnormal root toward its leaves.There are several possibilities for the deletion depending on whether the process u to be deleted is a candidate or verifies P_toBeC.If u is a candidate and does not verify P_toBeC: u becomes a normal root by executing R R (u).If u verifies P_toBeC, again the rule R R (u) is executed: u tries to directly join another "alive" tree.However if u is a candidate, and becoming a normal root allows it to further minimize d u , then it does so.If u is not a candidate and does not verify P_toBeC, the rule R I (u) is executed: u becomes isolated, but might still join another tree later.
Let u be a process belonging to an abnormal tree of which it is not the root.Let v be its parent.From the previous explanation, it follows that during the correction, (v).Now, due to the arbitrary initialization, the status of u and v may not be coherent, in this case u is also an abnormal root.Precisely, as formally defined in Algorithm 1, the status of u is incoherent w.r.t. the status of its parent v if st u = st v and st v = E B. For example, if a process u belongs to a tree (i.e., st u = I ) and designates an isolated process v with par u (i.e., par u = v and st v = I ), then the status of u is incoherent w.r.t.its parent v, i.e., u is an abnormal root.
Actually, the freezing mechanism ensures that if a process is the root of an alive abnormal tree, it is in that situation since the initial configuration; see Lemma 9, page 20.The bounded move complexity of our scheme mainly relies on this strong property.

Definitions
Before proceeding with the proof of correctness and the move complexity analysis, we define some useful concepts and give some of their properties.

Root, Child, and Branch
Definition 2 (Normal and Abnormal Roots) Every process u that satisfies P_r oot(u) is said to be a normal root.Every process u that satisfies P_abRoot(u) is said to be an abnormal root.Definition 3 (Alive Abnormal Root) A process u is said to be an alive abnormal root (resp.a dead abnormal root) if u is an abnormal root and has a status different from E F (resp. has status E F). Definition 4 (Children) For every process v and for every process u ∈ Children(v), u is said to be a child of v. Conversely, v is said to be the parent of u.
Observation 1 A process u is either a normal root, an isolated process (i.e., st u = I ), an abnormal root, or a child of its parent (i.e., member of the set Childr en (v), where v = par u ).Definition 5 (Branch) A branch is a sequence of processes v 0 , . . ., v k , for some integer k ≥ 0, such that v 0 is a normal or an abnormal root and, for every 0 ≤ i < k, we have v i+1 ∈ Children(v i ).The process v i is said to be at depth i and v i , . . ., v k is called a sub-branch.The depth of the branch is k.The process v 0 , resp.v k , is said to be the initial extremity, resp.terminal extremity, of the branch.If v 0 is an abnormal root, the branch is said to be illegal, otherwise, the branch is said to be legal.Algorithm 1: Algorithm TbC, predicates, macros and rules for any process u.
Observation 2 A branch depth is at most n maxCC − 1.A process v having status I does not belong to any branch.If a process v has status C (resp.E F), then all processes of a sub-branch starting at v have status C (resp.E F).
Lemma 1 Let γ → γ be a step.Let v 0 , . . ., v k be an illegal branch in γ such that st Proof By definition of an illegal branch,

Partial Correctness
We now prove that the terminal configurations are exactly the legitimate configurations.We first prove one of the two inclusions.

Lemma 2 Any legitimate configuration of TbC is terminal.
Proof Let γ be a legitimate configuration of TbC and u be a process.
Assume first that there is no process of V u that satisfies can BeRoot in γ .Then, by definition of γ , every process v in V u satisfies st v = I .Hence, since ¬can BeRoot v ∧ st v = I for every process v in V u , no rule of TbC is enabled at any process of V u in γ .
Assume then that there is a process that satisfies can BeRoot in γ .Then, every process v ∈ V u satisfies one of the first two conditions in Definition 6.
This in particular means that st v = C, for every v ∈ V u .Hence, R EF (v), R I (v), and R R (v) are all disabled at every v ∈ V u in γ .Moreover, we have ¬P_neigh Active(u)∧ ¬P_r oot Active(u) for every v ∈ V u (if P_r oot(v) is satisfied, then P_r oot V alid(v) and thus P_r oot Active(v) are not), which implies that R U (v) The following technical lemmas will help us to prove that any terminal configuration of TbC is legitimate.

Lemma 3 In any terminal configuration of TbC, every process has status I or C.
Proof Assume that there exists some process that has status E B. Consider a process u with status E B having the maximum distance value.Note that no process v that has status C can be a child of u, otherwise R U (v) or R EB (v) would be enabled.Therefore, by definition of Children(u) and the maximality of d u , u has only children of status E F. Thus R EF (u) is enabled, a contradiction.
Assume now that there exists some process that has status E F. Consider a process u with status E F having the smallest distance value.As no process has status E B (see the previous case), u is an abnormal root.Now, since u is an abnormal root of status E F, P_reset(u) holds.So, either R I (u) or R R (u) is enabled, a contradiction.

Lemma 4
Let γ be any terminal configuration of TbC and u be any process such that st u = C in γ .Then, u satisfies P_r oot(u) or par u ∈ Γ (u) Proof In γ , u satisfies ¬P_abRoot(u) because, otherwise, either R U (u) or R EB (u) would be enabled, as st u = C in γ .We can thus conclude by Observation 1 that u satisfies P_r oot (u) Corollary 1 Let γ be a terminal configuration of TbC and u be any process such that st u = C and ¬P_neighV alid(u) hold in γ .Then, u satisfies P_r oot(u) or Definition 8 Let MinimizeFinite be any instance of Algorithm TbC where Lemma 5 Let γ be a terminal configuration of MinimizeFinite and u be any process such that st u = C in γ .Then, ¬P_neighV alid(u) holds in γ .
Proof Assume that one or several processes having status C verify the predicate P_neighV alid(•) in γ .Let us consider such a process u that has the smallest distance d u .
We have P_neigh Active(u) ≡ P_neighV alid(u) ∧ P_toBeC(u).As γ is terminal, P_neigh Active(u) is not verified : hence P_toBeC(u) is not verified.By definition of u, a neighbor of u, named v, verifies By the Lemma 5 and Corollary 1, we obtain the following result.

Corollary 2 Let γ be any terminal configuration of MinimizeFinite and u be any process such that st
Lemma 6 Let γ be a terminal configuration of TbC and u be a process such that V u contains at least one process satisfying can Be Root.In γ , u satisfies: -st u = C, -¬P_neigh Active(u) and ¬P_r oot Active(u), and -P_r oot(u), or par u ∈ Γ (u) ∧ d u d par u ⊕ ω u ( par u ).
Proof Let v be a process of V u such that can BeRoot v in γ .We have st v ∈ {C, I }, by Lemma 3. Now, st v = I , because otherwise R R (v) would be enabled in γ .Therefore Assume then, by contradiction, that there exists some process of V u that has status I in γ .Consider now a process w of V u such that w has status I and at least one of its neighbors has status C in γ (such a process exists because every process has status I or C in γ , by Lemma 3, whereas at least one process, e.g.v, of V u has status C, and V u is connected).According to the definition of P_toBeC(w), we have two cases: Any neighbor w of w that has the status C is at depth smaller than n − 1 in their legal branch.Therefore, d w belongs to 0≤ j≤n−2 distC Ok( j) by Corollary 2, and thus dist N eigh(w) ∈ dist Set Finite.Hence, R R (w) is enabled in γ , a contradiction.
Hence, we conclude that every process of V u (including u) has status C in γ .Moreover, since st u = C in γ , ¬P_neigh Active(u) and ¬P_r oot Active(u) hold in γ (otherwise, R U (u) would be enabled).
Finally, Lemma 4 allows us to conclude the proof.

Lemma 7
Let γ be a terminal configuration of TbC and u be a process such that V u contains no process satisfying can Be Root in γ .In γ , st u = I .
Proof Assume, for the purpose of contradiction, that u is not isolated in γ .By Lemma 3, u has status C in γ .Without loss of generality, assume u is a process subject to that condition with the smallest distance d u in γ .Then, u is an abnormal root and enabled to execute R EB (u) or R U (u) in γ , a contradiction.
Therefore, by Lemmas 6 and 7, we obtain the following result.Moreover, such instantiations have terminal configurations which are essentially the same as those using unbounded memory space.More precisely, by Definition 6, Lemmas 2 and 5, and Theorem 1, we have the following property.
In other words, any instantiation requiring unbounded memory space such that P_neigh Active(u) ≡ P_neighV alid(u) can be turned into a bounded memory space version with the same terminal configurations and, as we will see, the same upper bounds on the number of steps and rounds.

Step Complexity of TbC
In this section, we establish some properties on every execution of TbC under a distributed unfair daemon.These properties allow us to show the termination under a distributed unfair daemon and to exhibit an upper bound on the move complexity of any instance of TbC.

C-Segments
Definition 9 (A AR) Let C be a connected component of G and let γ be a configuration.A AR(γ , C) is the set of processes u ∈ C such that, in γ , u is an alive abnormal root, or P_r oot Active(u) ∧ st u = C holds.
We now prove that A AR(γ , C) can never gain any new element.

Lemma 8
Let γ → γ be a step where a process u executes the rule R U or R R .Then, u is not an alive abnormal root in γ .

Proof
We have par u ∈ Γ (u) ∪ {⊥} in γ .We separately deal with these two cases.
First assume that par u = ⊥ in γ .We claim that, in this case, the constant can BeRoot u is true.Recall that P_r oot Active(u) implies P_r oot V alid(u), which in turn implies can BeRoot u .Thus, for the purpose of contradiction, assume that neither can BeRoot u nor P_r oot Active(u) hold.Note that par u = ⊥ in γ implies that u must have executed the else part of update(u) in γ → γ .Therefore, the second part of the main disjunction of the if condition must not hold.This means that st u = C, and thus that u has executed the rule R R in γ → γ .For this rule to be enabled, the second part of the conjunction in its guard must hold, which implies that P_toBeC(u) holds.However, this last property, combined with the preceding ones, validates the if condition in update(u), which contradicts par u = ⊥ in γ .Therefore, can BeRoot u is indeed true and thus P_r oot(u) is true in γ , which, in turn, implies ¬P_abRoot(u).
Assume now that par u = v ∈ Γ (u) in γ .Then st v = C in γ , because par u is chosen in the set {v ∈ Γ (u) | st v = C}; see update(u).Consequently, the only rules that v may execute in γ → γ are R U or R EB .In γ → γ , v either takes the status E B, decreases its distance value, or does not change the value of its variables.In all cases, u belongs to Children(v) in γ , which prevents u from being an alive abnormal root in γ , by Observation 1.More precisely, if v decreases its distance value, the fact that u still belongs to Children(v) in γ comes from the hypothesis on ⊕ stating that for any distances d 1 and d 2 and any weight ω of an edge, we have One of the key properties allowing us to prove that TbC has a polynomial move complexity is the following result.

Lemma 9 No alive abnormal root is created along any execution of TbC.
Proof Let γ → γ be a step and u be a process that is not an alive abnormal root in γ .Assume, by contradiction, that u is an alive abnormal root in γ .
If the status of u is E F or I in γ , then u is not an alive abnormal root in γ .If u executes R U or R R during this step, then u is not an alive abnormal root in γ either, by Lemma 8.So the only rule that u may execute is R EB in γ → γ .Furthermore, both in γ and γ , u has status C or E B, and par u ∈ Γ (u) ∪ {⊥} (because u is not an abnormal root in γ ).
Assume first that par u = ⊥ in γ .Then, par u = ⊥ already holds in γ .We thus have P_r oot(u) in γ because ¬P_abRoot(u) in γ .Consequently, u executes no move in γ → γ , and u is still a normal root in γ , a contradiction.
Assume now that par u = v ∈ Γ (u) in γ .Whether u executes R EB or not, par u already designates v in γ .Also, ¬P_abRoot(u) in γ implies that u ∈ Children(v) and st v ∈ {C, E B} in γ , further implying that the only rules that v may execute in γ → γ are R U or R EB .Moreover, if st u = E B in γ or u executes R EB in γ → γ , then st v = E B too in γ and v does not move in γ → γ .Consequently, ¬P_abRoot(u) still holds in γ , a contradiction.Otherwise, st u = C in γ and u does not move in γ → γ .In γ → γ , v either takes the status E B, decreases its distance value, or does not change the value of its variables.In all cases, u still belongs to Children(v) in γ , which prevents u from being an alive abnormal root in γ (by Observation 1), a contradiction.

Lemma 10 If a process u satisfies P_r oot Active(u) ∧ st u = C, then it does so, and it never performed any move, since the beginning of the execution.
Proof Let u be a process satisfying P_r oot Active(u) ∧ st u = C.Note that the property does only depend on the local state on u.Assume thus, for the purpose of contradiction, that u did perform at least a move since the beginning of the execution, and consider the last such move, say during the step γ → γ .
Since st u = C holds in γ , u must have executed R U or R R during that step.For P_r oot Active(u) to hold in γ , u must have executed the then part of update(u); otherwise d u = dist Root u in γ and so ¬P_r oot V alid(u), which implies ¬P_r oot Active(u).
If it did so because of the first part of the disjunction in the if of update(u), then dist N eigh(u) dist Root u , which implies that d u dist Root u in γ .Thus, in that case, P_r oot Active(u) cannot hold in γ , a contradiction.
Otherwise (it did so because of the second part of the disjunction), in γ , st u = C holds but P_r oot Active(u) does not.During γ → γ , u executed R U and decreased its distance d u .
By the two preceding Lemmas, we obtain the following result.We now prove some properties on the moves made by a process in a C-segment.

Lemma 11 Let C be a connected component of G, u be any process of C, and S be a C-segment. During S, if u executes the rule R EF , then u does not execute any other rule in the remaining of S.
Proof Let γ 1 → γ 2 be a step of S in which u executes R EF .Note that u has status E B in γ 1 .Let γ 3 → γ 4 be the next step in which u executes a rule.(If one of these two steps does not exist, then the lemma trivially holds.) Let v be the root (at depth 0) of any branch in γ 1 containing u.By Definition 4, v must have status E B (and so satisfies ¬P_r oot Active(u)∨st u = C forever, by Lemma 10), and must therefore be an alive abnormal root.This implies that v ∈ A AR(γ 1 , C).Note that we may have v = u.On the other hand, in γ 3 , u is the dead abnormal root of all branches it belongs to since st u = E F in γ 3 and u necessarily executes R I or R R in this step.By Observation 1, either u = v or u no more belongs to a branch whose initial extremity is v.In either case, v is no more an alive abnormal root in γ 3 .Indeed, in the first case, u = v has status E F, while in the second case, if v were still an alive abnormal root, then u would still be in a branch with v as initial extremity, by Lemmas 1 and 9. Therefore v / ∈ A AR(γ 3 , C).Consequently, the steps γ 1 → γ 2 , and γ 3 → γ 4 belong to two distinct C-segments of the execution, by Corollary 4 and Definition 10.
By Lemma 11 and from the code of the algorithm, we obtain the following result.

Corollary 5 Let C be a connected component of G and u be any process of C. The sequence of rules executed by u during a C-segment belongs to the following language:
By Observation 4 and Corollary 5, we obtain the following result.
Theorem 2 If #U is an upper bound on the number of rules R U executed by any process of C in any C-segment for any connected component C, then the total number of moves in any execution is bounded by (#U + 4) • (n maxCC + 1) • n.

Causal Chains
We now use the notion of causal chain defined below to further analyze the number of moves and steps in a C-segment.
Definition 11 [Causal Chain] Let C be a connected component of G, v 0 be a process of C, and S be any C-segment.A causal chain of S rooted at v 0 is a non-empty sequence of actions a 1 , a 2 , . . ., a k executed in S such that the action a 1 sets par v 1 to v 0 and for all 2 ≤ i ≤ k, the action a i sets par v i to v i−1 after the action a i−1 but not later than v i−1 's next action.
Observation 5 Let C be a connected component of G, v 0 be a process of C, and S be any C-segment.Let a 1 , a 2 , . . ., a k be a causal chain of S rooted at v 0 .Denote by v i the process that executes a i , for all i ∈ {1, . . ., k}.
-For all 1 ≤ i ≤ k, a i consists in the execution of update(v i ) (i.e., v i executes the rule R U or R R ), and v i is a process of C. -Assume a 1 is executed in the step γ → γ of S. Denote by ds 0 the distance value of process v 0 in γ ; we call this value the initiating value of the causal chain.For all

Lemma 12 Let C be a connected component of G and S be a C-segment. All actions in a causal chain of S are executed by different processes of C, none of them being the root of the causal chain.
Proof Assume, by contradiction, that there exists a process v such that, in some causal chain a 1 , a 2 , . . ., a k of S, v is designated as parent in some action a i executed in step γ i → γ i+1 and executes the action a j in step γ j → γ j+1 , with j > i. Process v has status C in γ i , and the value of d v is strictly larger in γ j+1 than in γ i (by Observation 5, second item).However, any rule R U executed by v makes the value of d v decrease.Finally, since Process v has status C in γ i , R R (v) will be no more executed in S from that configuration, by Corollary 5 and from the rules' guards.Hence, we obtain a contradiction (by Observation 5, first item).

Maximal Causal Chains
Definition 12 (Maximal causal chain) Let C be a connected component of G, v 0 be a process of C, and S be any C-segment.A maximal causal chain of S rooted at v 0 is a causal chain a 1 , a 2 , . . ., a k of S such that the causal chain is maximal and, either v 0 is a normal root or the action a 1 sets par v 1 to v 0 not later than any action executed by v 0 in S.
The following lemma adds a property to Observation 5 for the specific case of maximal causal chains.

Lemma 13
Given any connected component C, any C-segment S, and any process v ∈ C, all maximal causal chains of S rooted at v have the same initiating value.
Proof For the purpose of contradiction, assume that there exist such C, S, and v such that two maximal causal chains of S rooted at v have different initiating values d 1 and d 2 .At least one of them, say d 1 , must be different from dist Root v .This value d 1 is necessarily the distance value of v at the beginning of S, otherwise v would not be the root of the corresponding maximal causal chain.As a consequence, we must have Since d 1 is the distance value of v at the beginning of S, there must exist an action a executing the else part of update(v) in S.Moreover, since the maximal causal chain of S rooted at v with initiating value d 1 exists, st v = C initially (otherwise, no neighbor can choose v as parent before any action of v in C).Thus, by Corollary 5, the action a is an execution of R U in the case when P_r oot Active(v) ∧ st v = C holds.By definition of a C-segment, Lemmas 8-10, and Corollary 4, the action a is thus executed during the last step of S and thus no maximal causal chains of S (which are never empty by definition) can be rooted at v with initiating value d 2 = dist Root v .This contradiction concludes the proof.Definition 13 (S I S,v ) Let C be a connected component of G, v be a process of C, and S be a C-segment.We define S I S,v as the set of all the distance values obtained after executing an action belonging to the maximal causal chains of S rooted at v.
The following lemma will be used to establish the termination of TbC in any case.It will also lead to a huge upper bound on the move complexity.However, we will see that in many practical cases, the upper bound in moves can be refined to be polynomial, see Theorem 3 and Corollary 8.

Lemma 14
Let C be a connected component of G, v 0 be a process of C, and S be a C-segment.The size of the set S I S,v 0 is bounded by (n maxCC − 1)! (the factorial of n maxCC − 1).
Proof Let us consider a distance value d obtained after executing an action a i belonging to a maximal causal chain a 1 , a 2 , . . ., a k of S rooted at v 0 .Denote by v i the process that executes a i , for all i ∈ {1, . . ., k}.By Observation 5, we have d = ((ds , with ds 0 being the initiating value common to all maximal causal chains of S rooted at v 0 (see Lemma 13).In other words, the value d is fully determined by the sequence of processes v 1 , . . ., v i (v 0 and S being fixed).Moreover, note that all the v j , 0 ≤ j ≤ i are different processes and v 0 does not execute any action of any causal chain it is the root of, by Lemma 12. Therefore, |S I S,v 0 | is bounded by (n maxCC − 1)!.

Move Complexity of
Combined with Lemma 14, this corollary already allows us to prove that TbC always terminates and has a bounded move complexity.

Corollary 7 Algorithm TbC is silent self-stabilizing under the distributed unfair daemon and has a bounded move (and step) complexity, a valid bound being 5n
If all weights are strictly positive integers and ⊕ is the addition operator, then the size of any S I S,u is bounded by W max (n maxCC − 1) for every connected component C, every C-segment S, and every process u ∈ C because, by Observation 5 and Lemma 12, S I S,u ⊆ [ds S,u + 1, ds S,u + W max (n cc − 1)], where n cc ≤ n maxCC is the number of processes in C, and ds S,u is the common (by Lemma 13) initiating value of the maximal causal chains of S rooted at u. Hence, we deduce the following theorem from Corollaries 6 and 7.
Theorem 3 Algorithm TbC is silent self-stabilizing under the distributed unfair daemon and, when all weights are strictly positive integers and ⊕ is the addition operator, its stabilization time in moves (and steps) is at most

Normal Configurations
We first introduce notion of normal configurations, which will help us to partition the proof on the round complexity of TbC.Definition 14 (Normal Process) A process u is said to be normal if u satisfies the following two conditions: 1. st u / ∈ {E B, E F}, and 2. ¬P_abRoot(u).
Definition 15 (Normal Configuration) Let γ be a configuration of TbC.γ is said to be normal if every process is normal in γ ; otherwise γ is said to be abnormal.

Observation 6
In a normal configuration of TbC, only the rules R U or R R may be enabled at any process.
We first prove that, once a normal configuration is reached, all subsequent configurations will be normal as well.

Lemma 17 Any step from a normal configuration of TbC reaches a normal configuration of TbC.
Proof Let γ → γ be a step such that γ is a normal configuration and let u be a process.
In γ , every process v satisfies st v / ∈ {E B, E F} and ¬P_abRoot(v).Hence, both R EB (u) and R EF (u) are disabled in γ , and consequently st u / ∈ {E B, E F} still holds in γ .
Moreover, since u is not an alive abnormal root in γ , Lemma 9 implies that u is not an alive abnormal root in γ either.Since st u = E F in γ , we obtain ¬P_abRoot(u) in γ .

From an Arbitrary Configuration to a Normal Configuration
The lemma below essentially claims that all the processes that are in illegal branches progressively switch to status E B within n maxCC rounds, in order of increasing depth; see Definition 5, page 15, for the definition of depth.
Lemma 18 Let i ∈ N. From the beginning of Round i + 1, there does not exist any process both in state C and at depth less than i in an illegal branch.
Proof We prove this lemma by induction on i.The base case (i = 0) is trivially true, so we assume that the lemma holds for some integer i ≥ 0.
From the beginning of Round i + 1, no process can ever choose a parent which is at depth smaller than i in an illegal branch because those processes (if they exist) will never have status C, by induction hypothesis.
Then, let u be a process of status C in an branch at the beginning of Round i + 1.Its depth is thus at least i.By induction hypothesis, each of its ancestor at depth smaller than i has status E B and has at least one child not having status E F. Thus, no such ancestors can execute any rule, and consequently they cannot make the depth of u decrease to i or smaller.Therefore, no process can take status C at depth smaller than or equal to i in an illegal branch from the beginning of Round i + 1.
Consider any process u with status C at depth i in an illegal branch at the beginning of Round i + 1.It remains to prove that u will not stay so until the end of Round i + 1.By induction hypothesis, u is an abnormal root, or the parent of u has not status C (i.e., it has status E B).During Round i + 1, u will execute rule either R EB or R U and thus either switch to status E B, or join another branch (at a depth greater than i if that branch is illegal), or become a normal root turning its branch to be legal.
This concludes the proof of the lemma.
Definition 16 (Almost Normal Configuration) A configuration γ of TbC is said to be almost normal if in γ , every process

Lemma 19 Any step from an almost normal configuration of TbC leads to an almost normal configuration of TbC.
Proof Let γ → γ be a step of TbC such that γ is an almost normal configuration.Assume, for the purpose of contradiction, that γ is not an almost normal configuration.Then, by Definition 16, at least one process u satisfies one of the following two cases.
st u = C ∧ P_abRoot(u) in γ .Then, Lemma 9 (page 20) implies that u is already an alive abnormal root in γ .However, since γ is an almost normal configuration, u cannot be an alive abnormal root of status C in γ .So, we necessarily have Hence, we have st u = C, par u = v, and st v = E B in γ , meaning that γ is not an almost normal configuration, a contradiction.
From Lemmas 18 and 19, we obtain the following corollary.
Corollary 9 After at most n maxCC rounds, the system is in an almost normal configuration and remains so forever.
The next lemma essentially claims that once no process in an illegal branch has status C, processes in illegal branches progressively switch to status E F within at most n maxCC rounds, in order of decreasing depth.
Lemma 20 Let i N * .From the beginning of Round n maxCC + i, any process at depth larger than n maxCC − i in an illegal branch has status E F. Proof We prove this lemma by induction on i.The base case (i = 1) is trivial (by Observation 2, page 15), so we assume that the lemma holds for some integer i ≥ 1.At the beginning of Round n maxCC + i, any process at depth larger than n maxCC − i has status E F (by induction hypothesis).Therefore, processes with status E B at depth n maxCC −i in an illegal branch are enabled to execute the rule R EF at the beginning of Round n maxCC + i.These processes will thus all execute within Round n maxCC + i (they cannot be neutralized as no children can connect to them) and obtain status E F. We conclude the proof by noticing that, from Corollary 9, once Round n maxCC has terminated, any process in an illegal branch that executes some rule either gets status E F, or will be outside any illegal branch forever.

Definition 17 (Quasi Normal Configuration) An almost normal configuration γ of
TbC is said to be quasi normal if no process has status E B in γ .

Observation 7
There is no alive abnormal root in a quasi normal configuration.

Lemma 21 Any step from a quasi normal configuration of TbC leads to a quasi normal configuration of TbC.
Proof Let γ → γ be a step of TbC such that γ is a quasi normal configuration.First, by definition, a quasi normal configuration is also an almost normal configuration.So, γ is almost normal (Lemma 19) and no process has status E B in γ since no rule R EB is enabled in γ .Hence, γ is a quasi normal configuration.
From Lemmas 20 and 21, we obtain the following corollary.
Corollary 10 After at most 2n maxCC rounds, the system is in a quasi normal configuration and remains so forever.
The next lemma essentially claims that after the propagation of status E F in illegal branches, the maximum length of illegal branches progressively decreases until all illegal branches vanish.

Lemma 22
Let i ∈ N * .From the beginning of Round 2n maxCC + i, there does not exist any process at depth larger than n maxCC − i in an illegal branch.
Proof We prove this lemma by induction on i.The base case (i = 1) is trivial (by Observation 2, page 15), so we assume that the lemma holds for some integer i ≥ 1.By induction hypothesis, at the beginning of Round 2n maxCC + i, no process is at depth larger than n maxCC − i in an illegal branch.All processes in an illegal branch have the status E F (by Lemma 20).So, at the beginning of Round 2n maxCC + i, any abnormal root satisfies the predicate P_reset, and is enabled to execute either R I , or R R .So, all abnormal roots at the beginning of Round 2n maxCC + i are no more in an illegal branch at the end of this round: the maximal depth of the illegal branches has decreased, since by Corollary 9, no process can join an illegal tree after n maxCC rounds have occurred.
By Lemmas 17-22, we obtain the following result.Theorem 4 at most 3n maxCC rounds, a normal configuration of TbC is reached, and the configuration remains normal forever.

From a Normal Configuration to a Terminal Configuration
From a normal configuration, Algorithm TbC needs additional rounds to propagate the status C and the correct distances in the components of the graph containing at least one process satisfying can BeRoot.First, we observe the following fact.

Observation 8
In a normal configuration of TbC, all processes in connected components containing no process satisfying can Be Root are in state I and thus are disabled.
Let u be a process having the status C in a normal configuration γ .Along any execution from γ , the distance of u cannot increase and u keeps the status C.
From the previous observation, we only need to focus on any connected component C containing at least one process satisfying can BeRoot.
Let us fix an arbitrary execution ex of TbC in C starting from a normal configuration γ .By Corollary 7 (page 25), a terminal configuration is eventually reached after a finite number of steps along ex.

Lemma 23
Let ST C (i, ex) be the set of processes defined as {u ∈ C | u performs a move along ex after the beginning of Round i}.
Proof By definition, ST C (i + 1, ex) ⊆ ST C (i, ex).It is thus sufficient to prove that at least one process of ST C (i, ex) is enabled at the beginning of the i th round and will do its last action during the i th round of ex.
Let γ i be the configuration at the beginning of Round i of ex, and let γ f be the terminal configuration of ex.Let us consider the process u ∈ ST C (i, ex) having the minimum distance d u in γ f , denoted by dmin(i).According to the definition of u and Observation 8, (*) every process w of ST C (i, ex) satisfies dmin(i) d w or st w = I along ex from γ i .Case 1.In γ f , par u = ⊥.
This means that P_r oot(u) holds in γ f .This further implies that, along ex from γ i , the last action of u consists in executing the else part of update(u).
At that time, u satisfies P_r oot Active(u) ∨ st u = I .Actually, by Lemma 10 page 21 and Observation 8, not only this must already hold from γ i , but this action is the unique action of u along ex.This action is thus done during the i th round of ex, and u / ∈ ST C (i + 1, ex), concluding the case.Case 2. In γ f , par u = w ∈ Γ (u).
Along ex from γ i , u executes its last move in some step γ j → γ j+1 .In this step, u executes the then part of update(u) since par u =⊥ in γ f .In γ j , dist N eigh(u) = dmin(i

Instantiations
In this section, we illustrate the versatility of Algorithm TbC by proposing several instantiations that solve various classical problems.By Definition 7 and Theorem 1 (pages 16 and 18, respectively), any process u in a terminal configuration of an instance of TbC satisfies one of the three following properties.

Property 1: P_r oot(u) and ¬P_neigh Active(u).
Property 2: There is a process satisfying can BeRoot in V u , st u = C, par u ∈ Γ (u), d u d par u ⊕ ω u ( par u ), and ¬P_neigh Active(u) ∧ ¬P_r oot Active(u).Property 3: There is no process satisfying can BeRoot in V u and st u = I .By Corollaries 7 and 11 (pages 25 and 30, respectively), all instances of TbC reach under the unfair daemon a terminal configuration in at most 4n maxCC rounds, starting from an arbitrary one.

Observation 9
Let C be a connected component of G containing a process satisfying can Be Root in an instance of TbC.In any terminal configuration of this instance, at least one process of C verifies P_r oot(u).In particular, every process u that has the smallest d u value in C verifies P_r oot(u).
Algorithm 2: Parameters for any process u in Algorithm Forest Versions 1 and 2

Inputs:
• can Be Root u is true if and only if u ∈ root Set In Version 2, P_root Active(u) ≡ f alse

Spanning Forest and Non-rooted Components Detection
Given an input set of processes r oot Set, Algorithm Forest is the instantiation of TbC with the parameters given in Algorithm 2. Algorithm Forest computes (in a selfstabilizing manner) a spanning forest in each connected component of G containing at least one process of r oot Set.The forest consists of trees (of arbitrary topology), whose tree roots are processes of r oot Set.Each process of r oot Set is required to be a tree root in Version 1 of Algorithm Forest, but not in Version 2.Moreover, in any component containing no process of r oot Set, the processes eventually detect the absence of root by finally taking the status I (Isolated).Correctness of Forest.In a terminal configuration of Forest, each process u satisfies one of the following conditions:

Leader Election
Assuming the network is identified, Algorithm LE is the instantiation of TbC with the parameters given in Algorithm 3. In each connected component, Algorithm LE elects a process (i.e., P_leader( ) holds) and builds a tree (of arbitrary topology) rooted at that spans the whole connected component.
The variable d u of a process u has two fields.The first one, id, eventually contains the identifier of the leader in V u .The second one, h, contains an upper bound on the distance to the leader in the built tree rooted at .

Correctness of LE.
As can BeRoot is true for all processes, in a terminal configuration of LE no process verifies Property 3 (i.e.no process has the status I ).and d

Observation 10 In a terminal configuration of LE, each process u satisfies one of the following conditions: (1) P_r oot(u), or (2) st
In a terminal configuration of Algorithm LE, each process u satisfies d u = ( pname , −) where is the single process in V u verifying P_r oot( ).
Move Complexity of LE.During a C-segment, a process can only execute R U to improve its ID.Let u by any process.At the beginning of a segment, at most n maxCC −1 distinct IDs are stored in the distance variables of processes in V u \ {u}.In the worst case, u can successively adopt each of them along the segment.Hence, the total number of moves (and steps) during any execution is bounded by (n maxCC + 3) • (n maxCC + 1) • n (Theorem 2, page 22), i.e., O(n maxCC 2 • n).

Shortest-Path Tree and Non-rooted Components Detection
Assuming the existence a unique root r and (strictly) positive integer weights for each edge, Algorithm RSP is the instantiation of TbC with the parameters given in Algorithm 4. Algorithm RSP computes (in a self-stabilizing manner) a shortest-path tree spanning the connected component of G containing r .Moreover, in any other component, the processes eventually detect the absence of r by taking the status I (Isolated).
Recall that the weight of a path is the sum of its edge weights.The weighted distance between the processes u and v, denoted by d(u, v), is the minimum weight of a path from u to v. A shortest path from u to v is a path whose weight is d(u, v).A shortestpath (spanning) tree rooted at r is a tree rooted at r that spans V r and such that, for every process u, the unique path from u to r in the built tree is a shortest path from u to r in V r .

Inputs:
• can Be Root u is false for any process except for u = r

Ordered Magma:
The same as for Algorithm Forest (Algorithm 2)

Predicate:
• P_neigh Active(u) ≡ P_neighV alid(u) In a terminal configuration of Algorithm RSP, each process u satisfies u / ∈ V r , or Move Complexity of RSP.All edge weights are strictly positive and ⊕ is the addition operator, so the total number of moves (and steps) during any execution is bounded by Construction of BFS tree rooted at r .If all edge have the same value (for instance, 1) then Algorithm RSP builds a BFS tree rooted at r in V r .In any other component, the processes take the status I (Isolated).As edges have the same weight, the total number of moves (and steps) during any execution is bounded by ((n maxCC − 1) 2 + 5)

Leader Election of the Process with the Smallest Identifier and Shortest-Path-Tree Construction Requiring Bounded Memory Space
Assuming the network is identified, Algorithm LEM_SP_BD is the instantiation of TbC with the parameters given in Algorithm 5.The variable d has two fields.The first one, id, eventually contains the identifier of the elected process.The second one, h, contains the weighted distance to the elected process.
In each connected component, Algorithm LEM_SP_BD elects (in a self-stabilizing manner) the process (i.e., P_leader( ) holds) of smallest identifier and builds a shortest-path tree rooted at .
The memory space required by Algorithm LEM_SP_BD on each process is bounded by O(log(B • BW)) bits, where B is an upper bound on the maximum value of a process identifier and BW is an upper bound on the edge weights (an upper bound on the maximum weighted distance could also be used; see the discussion on that matter in Sect.7.3).However, each process needs to know both B and BW.

Correctness of LEM_SP_BD.
As can BeRoot is true for all processes, in a terminal configuration of LEM_SP_BD, no process has the status I .According to Corollary 3 (page 19), we have the following observation.

Observation 12
In a terminal configuration of Algorithm LEM_SP_BD, each process u satisfies one of the following conditions: (1) P_r oot(u), or (2)  Here, the weight of the arc (u, v) is α u (v), the local label of u in Γ (v).Let P = u k , u k−1 , . . .u 0 = r be a (directed) path from process u k to the root r .We define the weight of P as the sequence 0, α 1 (u 0 ), α 2 (u 1 ), . . ., α k (u k−1 ).The lexicographical distance from process u to the root r , denoted by d r lex (u), is the minimum weight of a path from u to r (according to the lexicographical order).Algorithm 6: Parameters for any process u in Algorithm RDFS

Inputs:
• can Be Root u is false for any process except for u = r Let T be a tree rooted at r that spans V r .Following the result of [12], if for every process u ∈ V r , the weight of the path from u to r in T is equal to d r lex (u), then T is a (first) DFS spanning tree of V r .
Move Complexity of RDFS.For this instance, we cannot apply Corollary 6 (page 24) to obtain a polynomial move complexity.However, by Lemma 14 we have a rough estimation of the move complexity, i.e., at most (n maxCC − 1)! moves.We outline that this estimation is coarse-grained, and so can be further refined.
Bounded Memory Space version of RDFS.Corollary 3 (page 19) describes the instantiation of TbC requiring only bounded memory space that is similar to RDFS (i.e., a terminal configuration of this instantiation is a terminal configuration of RDFS).The set dist Set Finite can be any finite set containing every distance d that may be assumed in a terminal configuration of RDFS.Therefore, each process only needs to know an upper bound B on network size and an upper bound BD on Δ (the maximum degree of G).This corresponds to setting dist Set Finite = {0, . . ., BD} ≤B , the set of words of length at most B over the alphabet {0, . . ., BD}.

Optimum-Bandwidth-Path (Spanning) Tree
Assume the existence of a unique root r .Algorithm RBW is the instantiation of TbC with the parameters given in Algorithm 7. The variable d on v contains the multiset of the edge bandwidths in the path from v to r .Note that storing only the bottleneck bandwidth or the set of edge bandwidths (even combined with the distance to r ) would not satisfy the constraints on ⊕ and ≺ stated in Fig. 1.
Algorithm RBW computes (in a self-stabilizing manner) a spanning tree rooted at r in V r .The path from u to r in the spanning tree is one that maximizes the bandwidth.Moreover, in any other component, processes eventually detect the absence of r by taking the status I (Isolated).
The bandwidth of a path is the minimum of its edge bandwidths.The bandwidth capability between the processes u and v, denoted by bwc(u, v), is the maximum bandwidth of a path from u to v.An optimum bandwidth path from u to v is a path whose bandwidth is bwc(u, v).An optimum-bandwidth-path (spanning) tree rooted at r is a tree rooted at r that spans V r and such that, for every process u, the unique path from u to r in the built tree is an optimum-bandwidth-path from u to r in V r .(n maxCC − 1) + 5)(n maxCC + 1)n.In practice, the number k of different bandwidth values may be small (one per technology for example), or the bandwidth values may be grouped in a small number of ranges.When k is constant, the total number of moves during any execution becomes polynomial, in O(n maxCC k+2 • n).
Bounded Memory Space version of RBW.Corollary 3 (page 19) describes the instantiation of TbC requiring only bounded memory space similar to RBW (i.e., a terminal configuration of this instantiation is a terminal configuration of RBW).The set dist Set Finite can be any finite set containing every distance d that may be assumed in a terminal configuration of RBW, for example the set of all multisets of at most n maxCC − 1 elements from the set of the k possible edge bandwidths.Therefore, each process only needs to know an upper bound B on the network size and an upper bound BW on the edge bandwidths.Even better than the knowledge of BW would be the complete knowledge of the k possible edge bandwidths.In this case, and when k is constant, the memory requirement for the distance d value would be logarithmic in n maxCC .

Conclusion
We proposed a general scheme, called Algorithm TbC, to compute tree-based data structures on arbitrary (not necessarily connected) bidirectional networks.Algorithm TbC is self-stabilizing and silent.It is written in the locally shared memory model with composite atomicity.We have proven its correctness under the distributed unfair daemon hypothesis, the weakest scheduling assumption of the model.
We have also that its stabilization time is at most 4n maxCC rounds, where n maxCC is the maximum of processes in a connected component.
We illustrated the versatility of our approach by proposing several instantiations of TbC that solve classical problems in various settings.For example, we can instantiate TbC to solve leader election and/or spanning tree or forest constructions in identified or semi-anonymous (e.g., rooted) networks.These spanning structures may be of different types, e.g., arbitrary, BFS, DFS, shortest-path, ... Note also that, whenever the network is not connected, TbC also achieves the non-rooted components detection.
In most of the cases, we exhibited polynomial upper bounds on the stabilization time in steps and process moves of the considered instantiations.Finally, in many cases, instantiations can be easily modified to handle bounded local memories, without any overhead.

Fig. 1
Fig. 1 Various inputs and definitions used in Algorithm TbC, for any process u

Corollary 4 Observation 4
For every step γ → γ , AAR(γ , C) ⊆ A AR(γ , C).Based on Corollary 4, we can use the notion of C-segment defined below to bound the total number of moves in an execution.Definition 10 (C-Segment) Let e = γ 0 γ 1 • • • be an execution of TbC and C be a connected component of G.-If there is no stepγ i → γ i+1 in e such that |A AR(γ i , C)| > |A AR(γ i+1 , C)|, then the first C-segment of e is e itselfand there is no other C-segment.-Otherwise, let γ i → γ i+1 be the first step of e such that |A AR(γ i , C)| > |A AR(γ i+1 , C)|.The first C-segment of e is the prefix γ 0 • • • γ i+1 .The second C-segment of e is the first C-segment of the suffix γ i+1 γ i+2 . .., and so forth.By Corollary 4, and since by definition |A AR(γ i , C)| ≤ n maxCC for every connected component C and every configuration γ i , we have: Let C be a connected component of G.For every execution e of TbC, e contains at most n maxCC + 1 C-segments.
and S be a C-segment.If all edges have the same weight, then |S I S,v | < n maxCC .Proof Assume that all edges have the same weight ω.According to Observation 5 and Lemma 12, we have S I S,v ⊆ {ds S,v ⊕ (i.ω) | 1 ≤ i ≤ n maxCC − 1}, where ds S,v is the common (by Lemma 13) initiating value of the maximal causal chains of S rooted at v. By Corollary 6 and Lemma 16, we obtain the following result.
by Observation 1 (page 15) and thus st par u = E B in γ from par u / ∈ Γ (u) ∨ st par u = C.Let v be the process par u in γ .By definition of an almost normal configuration (Definition 16), v does not execute R EB in γ → γ .So, in γ , we have

Algorithm 3 :
Parameters for process u in Algorithm LEInputs:• can Be Root u is true for any process• pname u is the identifier of u (n.b., pname u ∈ N) • ω u (v) = (⊥,1) for every v ∈ Γ (u) Ordered Magma: • Dist Set = I Ds × N; for every d = (a, b) ∈ Dist Set, we let d.id = a and d.h = b C) Correctness of RSP.By definition, r is the unique process satisfying can BeRoot.So, only r can satisfy P_r oot.By Observation 9, P_r oot(r ) holds in any terminal configuration of RSP.Observation 11 In a terminal configuration of Algorithm RSP, each process u satisfies one of the following three conditions: (1) u = r and P_r oot(r ) holds; (2) u ∈ V r \ {r }, st u = C, par u ∈ Γ (u), and d u = d par u + ω u ( par u ); or (3) u / ∈ V r and st u = I .
In a terminal configuration of Algorithm LEM_SP_BD, for every process u of C, d u = ( pname , d(u, )) with being the process having the smallest identifier in C. Move Complexity of LEM_SP_BD.S I S,v is the set of d values obtained after executing an action belonging to the maximal causal chains rooted at v in the segment S; see definition 13. S I S,v ⊆ {ds S,v ⊕(i •(⊥, 1)) | 1 ≤ i ≤ W max •(n maxCC −1)}, ds S,v being the initiating value common to all maximal causal chains of S rooted at v. So, |S I S,v | ≤ of G containing r .Moreover, in any other component, processes eventually the absence of r by taking the status I (Isolated).

Algorithm 7 : 1 n maxCC − 1 = k+n maxCC − 1 k.
Parameters for any process u in Algorithm RBWInputs:• can Be Root u is false for any process except for u = r• pname u is ⊥ • ω u (v) = {bw u (v)}, for every v ∈ Γ (u) with bw u (v) ∈ N * is the bandwidth of the directed link from u to v Ordered Magma: • Dist Set = the set of the finite multisets of elements in N * • d 1 ⊕ d 2 = d 1 d 2 ,where is the sum (disjoint union) on multisets• Inductive definition of the total order ≺ on Dist Set:d 1 ≺ d 2 ≡ (d 1 = ∅ ∧ d 2 = ∅) ∨ d 1 = ∅ ∧ d 2 = ∅ ∧ [min d 1 > min d 2 ∨ (min d 1 = min d 2 ∧ d 1 \ {min d 1 } ≺ d 2 \ {min d 2 })] (s \ {x} is the multiset s in which one occurrence of x has been removed) • dist Root(u) = ∅, theempty multisetPredicate:The same as for Algorithm RSP (Algorithm 4) 123 Correctness of RBW.note that the ordered magma and the weight assignment satisfy the constraints on ⊕ and ≺ stated in Fig.1.By definition, is the unique process satisfying can BeRoot.So, only r can satisfy P_r oot.By Observation 9, P_r oot(r ) holds in any terminal configuration of RBW.Observation 14In a terminal configuration of Algorithm RBW, each process u satisfies one of the following three conditions:1.u = r and P_r oot(r ) holds; 2. u ∈ V r \ {r }, par u ∈ Γ (u), d u = d par u {bw u (v)}, and st u = C; or 3. u / ∈ V r and st u = I .In a terminal configuration of Algorithm RBW, each process u satisfies u / ∈ V r , or d u is the multiset of the edge bandwidths of a path such that min d u = bwc(u, r ).Move Complexity of RBW. S I S,v is the set of distance values obtained after executing an action belonging to the maximal causal chains rooted at v in the segment S; see Definition 13.Let k be the number of different edge bandwidths in the network.The size of S I S,v is at most the number of multisets of at most n maxCC − 1 elements from the set of the k possible edge bandwidths, such a multiset being added (by successive disjoint unions of singletons) to the initiating multiset ds S,v .So the size of S I S,v is bounded by k+n maxCC −According to Corollary 6 (page 24), the total number of moves during any execution, is bounded by ( k+n maxCC −1 k

4 Correctness of TbC Legitimate Configurations Definition 6
(Legitimate State) A process u is said to be in a legitimate state of TbC if u satisfies one of the following conditions:1.P_r oot(u), and ¬P_neigh Active(u); 2. there is a process satisfying can BeRoot in V u , st u = C, par u ∈ Γ (u), d u d par u ⊕ ω u ( par u ), and ¬P_neigh Active(u) ∧ ¬P_r oot Active(u); 3. there is no process satisfying can BeRoot in V u and st u = I .Definition 7 (Legitimate Configuration) A legitimate configuration of TbC is a configuration where every process is in a legitimate state.

4.2 Bounded Memory Space Consider
MinimizeFinite.By definition, dist Set Finite is a finite set.Then, there are two rules that allow to update the variable d These rules use the macro update(u) to compute the new value of d u .If d u takes value dist Root u , then d u trivially remains in dist Set Finite.Otherwise, we should remark that P_neigh Active(u) ⇒ P_toBeC(u) and if the executed rule is R R (u), then st u = C. Consequently, P_toBeC(u) holds, which implies that d u also remains in dist Set Finite in this case.Hence, we obtain the following result.
Theorem 1 Any terminal configuration of TbC is legitimate.u : R U (u) and R R (u).Observation 3 MinimizeFinite only requires bounded memory space.

TbC
15mma15Let C be connected component of G, u ∈ C, and S be a C-segment.If the size of S I S,v is bounded by X for any process v ∈ C, then the number of R U moves done by u in S is bounded by X • (n maxCC − 1) + 1.ProofBy Corollary 5, R U (u) executions in S are not interrupted by the executions of other rules at u, and they make the value of d u decrease.Therefore, all the values of d u obtained by the R U executions done by u in S are different.By Definitions 12 and 13, all these values belong to the set v∈C\{u} S I S,v ∪ {dist Root u }, which has size at most X • (n maxCC − 1) + 1.By Theorem 2 and Lemma 15, we obtain the following result.If the size of S I S,v is bounded by X for any connected component C, any process v ∈ C, and any C-segment S, then the total number of moves during any execution is bounded by ).By Observation 8 and (*), we can conclude that dist N eigh(u) is constantly equal to dmin(i) and P_toBeC(u) is constantly true since γ i .From the properties of P_r oot Active(u) and P_neigh Active(u), this also that the values of those two predicates only depends on d u from γ i (other influencing parameters being constant from γ i ).Furthermore, since P_r oot Active(u) and P_neigh Active(u) are monotone w.r.t.d u , their respective values are constant from γ i until u moves.Assume now, by contradiction, that u moves in some step γ k → γ k+1 with i ≤ k < j.Without loss of generality, assume that k is maximum.Then, u necessarily executes the else part of update(u) in γ k → γ k+1 (otherwise, u is not enabled in γ j ).Thus, dist N eigh(u) dist Root u so that u is enabled in γ j .In this case, u necessarily has status C in γ k (u otherwise executes the then part of update(u)).Again to execute the else part of update(u) during γ k → γ k+1 , we should have P_r oot Active(u) and ¬P_neigh Active(u) in γ k .Overall, from γ k to γ j , we have st u = C; and from γ k+1 to γ j we have d u = dist Root u , which implies ¬P_r oot Active(u).Moreover, ¬P_neigh Active(u) holds in γ j since it is monotone w.r.t.d u and by Observation 8. So, u is disabled in γ j , a contradiction.Hence, the only move of u from γ i is during the step γ j → γ j+1 and u was enabled since γ i , i.e., u executes its last move during Round i, which means that u / ∈ ST C (i + 1, ex), concluding the case.From the previous lemma, and Theorems 1 and 4, we obtain the following result.Corollary 11 A terminal legitimate configuration of any instantiation of TbC is reached in at most 4n maxCC rounds from any configuration.
• (n maxCC + 1) • n (Corollary 8, page 25), i.e., O(n maxCC 3• n).Bounded Memory Space version of RSP.Corollary 3 (page 19) describes the instantiation of TbC requiring only bounded memory space that is similar to RSP (i.e., a terminal configuration of this instantiation is a terminal configuration of RSP).The set dist Set Finite can be any finite set containing every distance d that may be assumed in a terminal configuration of RSP.Therefore, each process only needs to know an upper bound BL on the maximum weighted distance to r .This corresponds to setting dist Set Finite = {d ∈ N | d ≤ BL}.This could also be done by providing an upper bound B on the network size and an upper bound BW on the edge weights, and setting BL = B • BW.Finally, the move complexity of the Bounded Memory Space version of RSP remains the same as the one of the initial version of RSP, i.e., O(n maxCC3•n •W max ).