Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Distributed Maintenance of
Spanning Tree using Labeled
Tree Encoding
Vijay K. Garg
Anurag Agarwal
PDSL Lab
University of Texas at Austin
1
Outline
Previous work and System model
“Core” and “Non-core” strategy
Neville’s code
Self-stabilizing spanning tree algorithm
Conclusion
2
Motivation
Maintaining spanning trees in distributed
fashion
Broadcast
Convergecast
Self Stabilization [Dijkstra 74] is a powerful
fault-tolerance paradigm
Design algorithms to tolerate transient data faults
Despite faults, algorithm converges to a good
state
3
Previous Work
Many self-stabilizing algorithms for spanning
trees
Breadth-first spanning tree: [DIM90, AK93]
Depth-first spanning tree: [CD94]
Minimum spanning tree: [AS97]
Our work makes stronger assumptions but
achieves better bounds
4
Comparison with Previous Work
Popular model assumes all communication
registers can be read/written in one time step
In a completely connected topology, it
amounts to doing O(n) work in one time step
Our model assumes processes take one
communication step
In our model, the previous algorithms would
have at least O(n) time complexity
5
System Model
System with n nodes labeled 1 … n
Nodes form a completely connected graph
Topology is static
Computation step
Internal computation
One communication event
A message is ready to be delivered in one
time step
6
“Core and Non-Core” Strategy for Self
Stabilization
Maintain “Core” and “Non-Core” data
structures
Core structures are always correct
Non-core structures can be derived from Core
structures
Core Structure
Index of permutation
Non-Core Structure
Permutation
1 … n!
7
“Core and Non-Core” strategy for Self
Stabilization
Strategy: Always assume Non-Core structures got
corrupted and align it with Core structures
n=4
Core Structure
Non-Core Structure
Permutation
Index of permutation
2
1
2
4
3
8
“Core and Non-Core” strategy for Self
Stabilization
Strategy: Always assume Non-Core structures got
corrupted and align it with Core structures
n=4
Core Structure
Non-Core Structure
Permutation
Index of permutation
2
1
2
4
3
3
4
9
“Core and Non-Core” strategy for Self
Stabilization
Strategy: Always assume Non-Core structures got
corrupted and align it with Core structures
n=4
Core Structure
Non-Core Structure
Permutation
Index of permutation
12
1
2
4
3
3
4
Challenge lies in efficient detection and correction
10
Neville’s Code [Neville 53]
Similar to Prufer code
Each labeled tree with n nodes has one to
one correspondence with a Neville’s code
Code is a sequence of n - 2 numbers from
the set {1,…,n}
code[i] denotes the ith number in the code
sequence
11
Neville’s Code: Example
8
6
3
Code = 7768338
7
2
5
4
1
12
Spanning Tree → Neville’s Code
x = least node with degree 1
for i = 1 to n-1
code[i] = parent[x]
Delete edge between x and parent[x]
if (degree[parent[x]] = 1 && parent[x] ≠ n)
x = parent[x]
else
x = least node with degree 1
13
Neville’s Code: Example
8
x = least node with degree 1
for i = 1 to n-1
6
3
7
5
4
code[i] = parent[x]
Delete edge between x and
parent[x]
if (degree[parent[x]] = 1 &&
parent[x] ≠ n)
x = parent[x]
else
2
1
x = least node with degree 1
code = 7768338
7
77
776
7768
x=6
1
2
7
14
Self Stabilization using Neville’s code
Need to maintain “parent” (Non-core) for
each node
Auxiliary data structures for efficiency
code[i] : Neville’s code
f[i] : Iteration in which node i is chosen as “x”
z[i] : last occurrence of node i in code
Node i maintains ith components of data
structures
Put constraints on these data structures so
that the parent pointers give a valid tree
15
Constraints
Three constraint sets provide different
guarantees on the structure of the resulting
spanning tree with respect to the tree
generated by Neville’s code
Spanning Tree (R) Isomorphic (C)
Identical
Efficiency
16
Constraints for R
(R1) For all i: code[f[i]] = parent[i]
Follows from the code building procedure
8
6
Node 7 was chosen as “x” in
iteration 3. So f[7] = 3
3
code[f[7]] = code[3] = 6 = parent[7]
7
2
5
1
4
code = 7768338
17
Constraints for R
Simple restrictions on the range of the
structures
(R2) For 1 ≤ i ≤ n – 2: 1 ≤ code[i] ≤ n
and code[n – 1] = n
(R3) (i) For 1 ≤ i ≤ n – 1: 1 ≤ f[i] ≤ n – 1
(R4) For all i: z[i] = max j such that code[j] = i
Definition of z
18
Constraints for R
(R5) For all i: z[i] ≠ 0 f[i] = z[i] + 1
Captures preference given to parent when its
degree becomes one
Node 7 occurs last in code at
position 2. Hence, z[7] = 2.
Also, f[7] = 3.
8
6
3
f[7] = z[7] + 1
7
2
5
1
4
code = 7768338
19
Maintaining R - Constraint R4
For all i: z[i] = maximum j such that code[j] = i
Split the constraint into two different constraints
(E1) z[i] ≠ 0 code[z[i]] = i
(E2) code[j] = i z[i] ≥ j
2
3
1
5
4
z
code
1
2
3
2
3
4
3
0
1
4
0
1
5
2
5
20
Maintaining R - Constraint R4
For all i: z[i] = maximum j such that code[j] = i
Split the constraint into two different constraints
(E1) z[i] ≠ 0 code[z[i]] = i
(E2) code[j] = i z[i] ≥ j
2
(E1)
code ?
5
4
3
1
4
z
code
1
2
3
2
3
4
3
0
1
4
0
1
5
2
5
21
Maintaining R - Constraint R4
For all i: z[i] = maximum j such that code[j] = i
Split the constraint into two different constraints
(E1) z[i] ≠ 0 code[z[i]] = i
(E2) code[j] = i z[i] ≥ j
2
(E1)
3
1
5
E1 violated
!
4
z
code
1
2
3
2
3
4
3
0
1
4
0
1
5
2
5
22
Maintaining R - Constraint R4
For all i: z[i] = maximum j such that code[j] = i
Split the constraint into two different constraints
(E1) z[i] ≠ 0 code[z[i]] = i
(E2) code[j] = i z[i] ≥ j
2
(E1)
3
1
5
4
z
code
1
0
3
2
3
4
3
0
1
4
0
1
5
2
5
23
Maintaining R - Constraint R4
For all i: z[i] = maximum j such that code[j] = i
Split the constraint into two different constraints
(E1) z[i] ≠ 0 code[z[i]] = i
(E2) code[j] = i z[i] ≥ j
2
3
check z ≥ 3
z = max {0,3,4}
(E2)
1
5
check z ≥ 4
4
z
code
1
0
3
2
3
4
3
0
1
4
0
1
5
2
5
24
Maintaining R - Constraint R4
For all i: z[i] = maximum j such that code[j] = i
Split the constraint into two different constraints
(E1) z[i] ≠ 0 code[z[i]] = i
(E2) code[j] = i z[i] ≥ j
2
(E2)
3
1
5
4
z
code
1
4
3
2
3
4
3
0
1
4
0
1
5
2
5
25
Maintaining R - Other Constraints
Local checks: Can be checked and corrected
without contacting any other node
(R2) , (R3) (i), (R5)
(R1) For all i: code[f[i]] = parent[i]
Inquire node f[i] to get code[f[i]] and match with
parent[i]
On mismatch, reset parent[i] to agree with
code[f[i]]
26
Analysis of Algorithm for maintaining R
Theorem: The algorithm requires O(1) time
per node and O(1) messages per node on
average in one cycle
Theorem: The algorithm stabilizes in O(d)
time, where d is the upper bound on the
number of times a node appears in the code
With high probability, a random code assignment
would have d = O(log n/ log log n)
27
Conclusion
Self stabilization algorithm for spanning tree
Requires O(1) messages per node on average
Provides fast stabilization
Allows changing root node and systematic
modification of the tree
28
Future Work
Remove the restriction on topology and
labels
Apply the strategy of core and non-core
states to other problems
29
Questions ?
30
Neville’s code → Spanning Tree
x = least node with degree 1
for i = 1 to n-1
parent[x] = code[i]
degree[x]--; degree[parent[x]]--;
If (degree[parent[x]] == 1)
x = code[i]
else
x = least node with degree 1
31
Round vs Bounded Delivery Time
Round: Every process takes atleast one step
Definition allows one process to send/receive
multiple messages in one time unit
32
Self Stabilization using Neville’s code
Need to maintain “parent” for each node
Auxiliary data structures for efficient detection
code[i] : Neville’s code
f[i] : Iteration in which node i was selected as x
z[i] : last occurrence of node i in code
Node i maintains ith components of data
structures
Put constraints on these data structures so
that the parent pointers give a valid tree
33
Constraints
(R1) For all i: code[f[i]] = parent[i]
(R2) 1 <= i <= n-2, 1 <= code[i] <= n
and code[n – 1] = n
(R3) (i) 1 <= f[i] <= n – 1
(ii) f is a permutation on [1…n]
(R4) For all i: z[i] = max. j such that code[j] = i
(R5) For all i: z[i] != 0 => f[i] = z[i] + 1
34
Two sets of constraints
R = { R1, R2, R3(1), R4, R5}
Resulting spanning tree may differ from the one
given by code in the leaves
Self-stabilization is easier and more efficient
C = { R1, R2, R3, R4, R5}
Resulting spanning tree is isomorphic to the one
given by code
Self-stabilization is harder and becomes inefficient
35
One interesting constraint
For all i: z[i] = maximum j such that code[j] = I
Split the constraint into two different constraints
(E1) z[i] ≠ 0 code[z[i]] = i
(E2) code[j] = i z[i] ≥ j
For (E1), node i queries the node z[i] to get
code[z[i]] and matches it against i
For (E2),
every node j with code[j] = i sends a
message to node i containing j
Node i then sets z[i] = max { z[i], j }
36
References
1. Y. Afek, S. Kutten, and M. Yung. Memory-efficient self stabilizing protocols for general networks.
In Proc. of the 4th Int’l Workshop on Distributed Algorithms, pages 15–28. SpringerVerlag, 1991.
2. S. Aggarwal and S. Kutten. Time optimal self-stabilizing spanning tree algorithm. In Proc.
of the 13th Conference on Foundations of Software Technology and Theoretical Computer
Science, pages 400–410, 1993.
3. G. Antonoiu and P. Srimani. Distributed self-stabilizing algorithm for minimum spanning
tree construction. In European Conference on Parallel Processing, pages 480–487, 1997.
4. A. Arora and M. Gouda. Distributed reset. IEEE Transactions on Computers, 43(9):1026–
1038, 1994.
5. B. Awerbuch, B. Patt-Shamir, and G. Varghese. Self-stabilization by local checking and
correction (extended abstract). In IEEE Symposium on Foundations of Computer Science,
pages 268–277, 1991.
6. Z. Collin and S. Dolev. Self-stabilizing depth-first search. Information Processing Letters,
49(6):297–301, 1994.
8. E. W. Dijkstra. Self-stabilizing systems in spite of distributed control. Communications of
the ACM, 17:643–644, 1974.
9. S. Dolev, A. Israeli, and S. Moran. Self-stabilization of dynamic systems assuming only
read/write atomicity. In Proc. of the ninth annual ACM symposium on Principles of Distributed
Computing, pages 103–117. ACM Press, 1990.
10. S. Huang and N. Chen. A self stabilizing algorithm for constructing breadth first trees.
Information Processing Letters, 41:109–117, 1992.
11. C. Johnen. Memory efficient, self-stabilizing algorithm to construct bfs spanning trees. In
Proc. of the sixteenth annual ACM symposium on Principles of Distributed Computing, page
288. ACM Press, 1997.
12. E. H. Neville. The codifying of tree-structure. Proceedings of Cambridge Philosophical
Society, 49:381–385, 1953.
37