Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

A New Method to Automatically Compute Processing Times for Random Walks

Based Distributed Algorithms

Thibault Bernard† Alain Bui† Marc Bui‡ Devan Sohier†,‡


†: Dpt Math & Info, URCA, BP1039, 51687 Reims cedex, France
‡: LRIA - EPHE, 41 rue G. Lussac, 75005 Paris, France
Emails: {thibault.bernard, alain.bui, devan.sohier}@univ-reims.fr,
marc.bui@univ-paris8.fr

Abstract tion, a random token circulation strategy is well designed to


tolerate networks subject to topological changes.
Random walks constitute an attractive technique in dis- In this paper, we develop the results obtained in our
tributed computing. In this paper, we present an original paper [BBS03] in order to automatically compute quan-
method using relationship between electrical resistance and tities evaluating complexity of distributed algorithms us-
random walks, to automatically compute quantities such as ing random walks. Our method use the relationship be-
cover time, and more generally any processing time mea- tween electrical resistance and random walks established in
sure defined through hitting times. This method comes from [DSca, CRR+ 97]. We provide an automatic way to com-
electrical theory by using Millman’s theorem. pute resistances on graphs modeling distributed networks.
As an example, we state results on ring and complete net-
works.
1 Introduction
2 Preliminaries
Random walks [AKL+ 79, Lov93] are often used in the
design and the analysis of distributed algorithms. Random Distributed systems
walks can be useful to obtain global information on anony-
mous networks. It is a good solution to cover the network
A distributed system can be viewed as an undirected con-
efficiently, without any knowledge of its structure and pro-
nected graph G = (V, E), where V is a set of processors
vides easy solutions that do not depend on processors iden-
with |V | = n and E is the set of bidirectional communica-
tifiers. For example, a spanning tree construction can be
tion links with |E| = m. (We use the terms “node”, “ver-
achieved as follows: each processor, when receiving a to-
tex”, “site” and “processor” interchangeably). We con-
ken for the first time, sets its parent variable to the sender,
sider asynchronous networks. A communication link (i, j)
and sends the token each time it receives to one of its neigh-
exists if and only if i and j are neighbors. Every proces-
bour chosen uniformly at random. The successive positions
sor i can distinguish all its links and i maintains its set of
of the token constitute a random walk. The results of this
neighbors denoted as Ni . The degree of i is the number of
procedure gives a random spanning tree, i.e. a connected
neighbors of i, i.e. |Ni |, denoted deg(i).
subgraph with every vertices, without any cycle, chosen
uniformly at random between all the graphs of this kind
([BIZ89]). Random walks
Solutions using random walks have been designed for
many control problems in distributed computing such that A random walk is a sequence of vertices visited by a to-
mobile agent in wireless networks [BDDN01] or self stabi- ken that starts at i and visites other vertices according to
lizing mutual exclusion [IJ90]. the following transition rule: if the token is at i at time
In particular, a random approach can provide efficient so- t then at time t + 1 it will be at one of the neighbors of
lutions to GRID computing paradigm in a fully distributed i chosen uniformly at random among all of them. More
computation [BBS03]. Indeed, unlike a deterministic solu- formally, a random walk is a finite homogeneous Markov
Chain with states set V and with transition matrix probabil- link (edge) (i, j) is assigned a real value: the resistance
ity P = (pij )(i,j)∈V 2 given by r(i, j). Interesting results can be deduced by application
of the two famous Kirchhoff’s law and Ohm’s law. In par-
 1
deg(i) if (i, j) ∈ E ticular, through the notion of effective resistance (explained
pij =
0 if (i, j) 6∈ E below), we present an innovative method to automatically
compute bounds on cover time, exact values of commute
where deg(i) is the degree of node i. Let P t be the tth time and hitting times, exact values of cyclic cover time and
power of P , whose entries are pt (i, j), (i, j) ∈ V 2 . total hitting time for any arbitrary graph.
Some characteristic values are useful in the context of
distributed computing. Review of basic ideas on electricity
The mean time to reach vertex j, starting from the vertex
i which may be regarded as the conditional expectation of Relation between potential difference between two
the random number of transitions before entering j for the nodes, electrical resistance and electrical current are given
first time when starting from i, is called hitting time and by Ohm’s law: U = R × I. Kirchhoff’s law states that the
denoted hij . In particular, we have hii = 1/πi . We often sum of currents entering and exiting a node must equal zero.
use the quantity max{hij /j ∈ V }, which is an upper bound
for a random walk starting at i to hit a fixed, but unknown For two resistors (or resistives networks) R1 and R2 con-
vertex, for example, when the average time to look for an nected in series, we have: Rglobal = R1 + R2
information owned by a unknown vertex is required.
κij = hij + hji called the commute time, is the expected For two resistors (or resistives networks) R1 and R2 con-
1
number of steps for a random walks starting at vertex i to nected in parallel, we have : Rglobal = R11 + R12
reach vertex j for the first time and reach i again. It can be
viewed as the average time to fetch back to i an information Effective resistance
owned by the vertex j.
The expected time for a random walk starting at i to visit R(i, j) is the effective resistance (resistance of the elec-
all the vertices of the graph is called the cover time Ci . Let trical network) between i and j, if we replace each edge
C = max{Ci /i ∈ V }. Ci will be the average time needed in the graph by a 1Ω resistor. R denotes the maximal ef-
by i to build a spanning tree thanks to the algorithm de- fective resistance between two nodes of the network i.e.
scribed in the introduction. C will be an upper bound of the R = max(i,j)∈V 2 R(i, j).
average time for an unknown vertex to build a spanning tree
thanks to the algorithm described above. Previous results
In [BBS03], we introduced the notions of cyclic cover
time (see also [CFS96]) and total hitting time. These two A tight relationship between resistances in electric net-
notions are used to estimate global time computation. Both works and random walks characteristic values such as
notions are based on hitting times. commute times and cover time, has been established in
The cyclic cover time is closed to the cover time notion. [CRR+ 97]. In particular, it has been shown that:
It is defined to be the average time to visit all the vertices in
the best deterministic arrangement: Lemma 1
( , )
X κij = hij + hji = 2mR(i, j) (1)
CCT = min hσ(i)σ(i+1) σ ∈ Sn
i∈V where i and j denote two distinct vertices and m, the
where Sn denotes the set of all permutations over number of vertices.
{1, . . . , n}. The total hitting time is defined as the sum of From this equation, we have:
all possible hitting times on the graph. It can be viewed as
Lemma 2
a worst case computation time:
mR < C < O(mR log n) (2)
X
T HT = hij
In [Tet91], hitting time are expressed only in terms of
(i,j)∈V 2
resistances:
3 Random walks and electrical resistance Lemma 3
1X
A distributed system may be viewed as an electrical net- h(i, j) = mR(i, j) + deg(k)[R(j, k) − R(i, k)] (3)
2
work (both may be viewed as an undirected graph). Each k∈V
Redefinitions Theorem 1 (Millman’s theorem) Consider an electrical
network, on any node 0, we have the following relation:
The main results explained here concern cover time, hit-
ting time and commute time. These three values allow us to Pk Vi
i=1 r(0,i)
evaluate the complexity of random walks based distributed V0 = Pk 1
algorithms. From lemma 1, we can redefine the notions of i=1 r(0,i)
cyclic cover time and total hitting time introduced in the
previous section in terms of effective resistances: that is

Definition 1 For symmetrical graphs, the cyclic cover time V0 − V1 V0 − V2 V0 − Vk


is defined by + + ··· + =0
r(0, 1) r(0, 2) r(0, k)
 
n−1
X  where 1, · · · , k are the neighbors of 0, V1 , · · · , Vk are the
CCT = min m × R(σ(j), σ(j + 1))/σ ∈ Sn voltages on each of these nodes.
 
j=1

where Sn denotes the set of all permutations over The Algorithm


{1, . . . , n}
Definition 2 The total hitting time measure T is defined by To compute R(h, k), we apply a potential of 1V on node
h and of 0V on node k. Then, we write Millman’s theo-
X 2m
rem on every vertex except the ones on which we apply po-
X
m R(i, j) +
2
deg(i) tentials. We obtain n − 2 linear equations on n unknowns.
(i,j)∈V i∈V
Since Vh = 1 and Vk = 0, we have n−2 equations on n−2
In the following, we will call ”processing times” these unknowns. Then, we solve this system and we deduce the
notions. effective resistance, between h and k: R(h, k).

Millman’s theorem
Architecture of the algorithm
Our method uses the Millman’s theorem to compute au-
tomatically effective resistance. As shown above, we can 1: Build Millman’s matrix to compute R(h, k) (1).
compute, thanks to resistances, bounds on cover time, exact 2: Matrix completion with Vh = 1 and Vk = 0 (2).
values of cyclic cover time, exact values of commute time 3: Solve linear system (3).
and total hitting time for any arbitrary graphs. 4: Current exiting h (4).
An application of the laws of electricity can provide re- 5: Ohm’s law on global circuit U = R × I (5).
sults on processing times, since we can obtain effective re- In the sequel, we detail the main functions of the algo-
sistances. For example, on a ring, by the conductance prop- rithm.
erty, the effective resistance between two nodes i and j, is:
−l2 + l × n Millman’s matrix (1)
R(i, j) =
n
The aim of this part of the algorithm is to determine the
where l is the length of the shortest path between i and j
linear system of the Millman’s theorem applied on every
and thus the maximal effective resistance is:
( vertex.
n 1: for all i ∈ V \{h; k} do
4 if n is even
RM ax = n2 −1
if n is odd 2: for all j ∈ V do
4n
3: if i = j then
In this example, we consider the ring topology to com- 4: Mij ←− −#(N (i))
pute resistances. We can achieve such a result on any arbi- 5: end if
trary graphs modelling a distributed systems by using Mill- 6: if j ∈ N (i) then
man’s theorem. 7: Mij ←− 1
FromP Kirchhoff’s law applied on a given node j, we 8: else
have: k∈N (j) Ijk = 0 where Ijk is the current from j 9: Mij ←− 0
to k ∈ N (j). Ijk is positive if the current is entering node 10: end if
j and negative if the current is leaving node j. 11: end for
Ohm’s law gives : Ijk = (Vj − Vk )/r(j, k), so we have 12: end for



 VA = 1
  
10 0 0 0 0 0 0 VB = 0


Figure 1. Example 

01 0 0 0 0 0 0
 56
VC =
  

   101
1 1 -4 1 0 0 0 1
  
 52
VD =
  
 1 1 1 -4 1 0 0 0  101
Matrix Completion (2)  
VE = 51
1 1 0 1 -3 0 0 0







 101
1
1 1 0 0 0 -2 0 0 VF =


We complete the matrix to take into account the potentials
  
 2
0 0 1 0 0 0 1 -2
 86
 VG =

applied to node h and k. We obtain M = (Mij )(i,j)∈V ×V 
 101
 71
for all i ∈ V do VH =

1: 101
2: if i = h or i = k then Thus, the currents exiting A from each branch are
3: Mii ←− 1 
4: else 
 i1 = VA − VF = 21
Mhi ←− 0

5: 50
 i2 = VA − VE = 101



6: Mki ←− 0 49
i3 = VA − VD =
7: end if  101
15
VA − VG

8: end for


 i4 = = 101

45
VA − VC

i5 = = 101
Then globally in A (step (4)),
Solve Linear system (3)
419
iglobal = i11 = i1 + i2 + i3 + i4 + i5 =
This operation consists in obtaining the potential on each 202
vertex by solving M × V = S where S is a vector with all and finally (step (5))
entries to 0 except for the hth line with entry to 1 and V is U 202
the vector of the potentials. R(A, B) = =
i 419
The following resistances matrix is obtained by applica-
tion of the algorithm for each pair of nodes
Current exiting h (4)
 
Knowing potentials on each node, we can compute the cur- 0 202 177 172 203 260 299 358
 202 419 419 419 419 419 419 419 
199 178 205 260 441 440 
rent exiting h, by Ohm law:  419 0 419 419 419 419 419 419 

current ←− 0  177 199 187 266 347 358 299 
 419 419 0 419 419 419 419 419 
for all j ∈ Nh do  172 178 187 195 334 417 422 

 419 419 419 0 419 419 419 419 

current ←− current + Vh − Vj // Resistor between  203 205 266 195
i and j is r(i, j) = 1Ω  419 419 419 419 0 363 464 485 
 260 260 347 334 363 419 419 419 

529 558 
end for 
 419 419 419 419 419 0 419 419 
 299 441 358 417 464 529
 419 419 419 419 419 419 0 299

419 
358 440 299 422 485 558 299
419 419 419 419 419 419 419 0
Applicate Ohm’s law on global circuit (5)
Once all resistances are known, processing times can be
easily deduced
To get global resistance, we apply Ohm’s law between i and
j with global circuit. • Hitting time’s matrix:
Return 1/current // R(i, j) = (Vi − Vj )/current with
Vi − Vj = 1 ) 
26 3010 2595 2538 3467 5220 6267 7132

 5 419 419 419 419 419 419 419
2242 13 2497 2232 3109 4836 7729 7814

 
419 2 419 419 419 419 419 419
An example 
 2007 2677 13 2439 3992 6057 6740 6071



 419 419 2 419 419 419 419 419 
1934 2396 2423 13 3061 5880 7499 7662

 
419 419 419 2 419 419 419 419
Let G be the graph of the figure 1, and the electrical net-
 
 1811 2221 2924 2009 26 5731 7584 7955 
work associated with it:

 419 419 419 419 3 419 419 419 
1540 1924 2965 2804 3707 7417 7892

In order to compute R(A, B), we obtain the following

 419 419 419 419 419 13 419 419


1507 3737 2568 3343 4480 6337 3985
419 13
 
Millman’s matrix (step (1) and (2)), and the solution (step  419 419 419 419 419 419 
(3)) 2176 3626 1703 3310 4655 6616 3789
419 419 419 419 419 419 419 13
The average number of steps for the token being at 1 Proof Let compute the effective resistance between 0 and
to first hit 2 is about 7.2. 1. Assume that V0 = 0 and V1 = 1. Due to the symmetry
558
of the graph, ∀(i; j) ∈ {2; . . . ; n − 1}2 , Vi = Vj . Then no
• Bounds on cover time : 13 × 419 < C < (2 × 13 × current flows through the channel (i; j). Thus, the current
558
419 × (1 + log(8)) ingoing 0 is:
Then, the average time to cover the network is less than
n−1 n−1
107 steps. X X
Ii0 = r0i (V0 − Vi )
• Commute time’s matrix: i=1 i=1
n−1
X (4)
=− Vi since r0i = 1 and V0 = 0
  i=1
52 5252 4602 4472 5278 6760 7774 9308
 5 419 419 419 419 419 419 419 = −(n − 2)V2 − V1
5252 5174 4628 5330 6760 11466 11440


 419 13 419 419 419 419 419 419


 4602 5174
13 4862 6916 9022 9308 7774  The current outgoing 1 is:

 419 419 419 419 419 419 419 
4472 4628 4862 5070 8684 10842 10972


 419 419 419 13 419 419 419 419

 n−1
X n−1
X
 5278 5330 6916 5070 52 9438 12064 12610  I1i + I10 = ri1 (Vi − V1 ) + r01 (V0 − V1 )
 419 419 419 419 3 419 419 419 
 6760 6760 9022 8684 9438 13754 14508
 i=2 i=1

 419 419 419 419 419 26 419 419

 n−1
7774 11466 9308 10842 12064 13754 7774
X
26 (5)
 
 419 419 419 419 419 419 419  = Vi − (n − 1)V1
9308 11440 7774 10972 12610 14508 7774
419 419 419 419 419 419 419 26 i=2
since r1i = 1 and V0 = 0, V1 = 1
• Total hitting time: = (n − 2)V2 − (n − 1)V1
X X 2m Since current is injected only in 1 and removed only in 0,
T =m R(i, j) +
deg(i) currents in equations 4 and 5 are equal, and:
(i,j)∈V 2 ,i6=j i∈V
7864909 2(n − 2)V2 = (n − 2)V1
=
12570
Thus, since V1 = 1,
The mean time to hit an unknown vertex, starting from 1
V2 =
an unknown vertex is less than 10 (T /n2 ), and the 2
number of steps to visit all the vertices in a given but Then, the current outgoing 1 is n−2
− (n − 1) = − n2 . So,
2
unknown arrangement is about 78 (T /n). R01 = V0−−Vn
1
= n2
2

• Cyclic cover time 


 
X We are now able to state:
CCT = min  m × R (σ(i), σ(i + 1))
σ∈Sn
i∈{1,··· ,n−1}
• The commute time between two nodes, is equal to:
12856 ∀(i, j) ∈ V 2 ,
=
419
κij = 2mR(i, j)
The time to visit all the vertices in the best determinis- n×n−1 2
=2× ×
tic order is 31 steps on average. 2 n
= 2(n − 1)
4 Results on complete graph
• Bounds for cover time (computation of a spanning
tree) on complete graph
General results can be achieved for specific topologies,
for example for the complete graph.
 
2m 2m
<C<O log(n)
n n
Proposition 2 In a complete graph G = (V, E), all resis-
tances (except trivial case R(i, i) = 0, for all i ∈ V ) are so
equal to n2 where n is the number of vertex of G n − 1 < C < O((n − 1) log(n))
• The hitting time between two nodes is: [BDDN01] Marc Bui, Sajal K. Das, Ajoy Kumar Datta,
and Dai Tho Nguyen. Randomized mobile
∀(i, j) ∈ V 2 , agent based routing in wireless networks. In-
h(i, j) = mR(i, j) ternational Journal of Foundations of Com-
1 X puter Science, 12(3):365–384, 2001.
+ d(w)[R(w, j) − R(w, i)]
2 [BIZ89] J Bar-Ilan and D Zernik. Random leaders and
w∈V
= mR(i, j) random spanning trees. In WDAG89, pages
1,12, 1989.
n×n−1 2
= ×
2 n [CFS96] Don Coppersmith, Uriel Feige, and James
=n−1 Shearer. Random walks on regular and irreg-
ular graphs. SIAM Journal on Discrete Mathe-
• The total hitting time T is equal to: matics, (9(2)):301–308, 1996.
X 2m [CRR+ 97] Ashok K. Chandra, Prabhakar Raghavan, Wal-
T = n(n − 1)2 + ter L. Ruzzo, Roman Smolensky, and Prasoon
d(i) (6)
i∈V
Tiwari. The electrical resistance of a graph cap-
= n(n − 1)2 + n2 tures its commute and cover times. Computa-
tional Complexity, 6(4), 1997.
• Finally, the cyclic cover time is
[DSca] Peter G. Doyle and J. Laurie Snell. Random
Walks and Electric Networks. 2000 (first edi-
X tion 1984 Mathematical Association of Amer-
CCT = m × R(σ(i), σ(i + 1))
ica).
i∈{1,··· ,n−1}
[IJ90] Amos Israeli and Marc Jalfon. Token man-
X
= n−1 (7)
i∈{1,··· ,n−1}
agement schemes and random walks yield self-
stabilizing mutual exclusion. In 9th ACM sym-
= (n − 1)2 posium on Principles of distributed computing,
pages 119–131, 1990.
5 Conclusion
[Lov93] László Lovász. Random walks on graphs: A
In this paper, we have developed a new method to eval- survey. In T. Szõnyi ed. D. Miklós, V. T. Sós,
uate ”complexity” of distributed algorithms using random editor, Combinatorics: Paul Erdos is Eighty
walks. Given a distributed system topology, we have de- (vol. 2), pages 353–398. János Bolyai Mathe-
scribed a methodology for automatically compute process- matical Society, 1993.
ing time based on hitting times through their relationship [Tet91] P; Tetali. Random walks and effective resis-
with resistances of electrical networks. tance of networks. J. Theoretical Probability,
This method, as we show in last section, can be used to 1991.
determine general results on some specific topology.

References

[AKL+ 79] R. Aleliunas, R. Karp, R. Lipton, L. Lovasz,


and C. Rackoff. Random walks, universal
traversal sequences and the complexity of maze
problems. In 20th Annual Symposium on Foun-
dations of Computer Science, pages 218–223,
1979.

[BBS03] Alain Bui, Marc Bui, and Devan Sohier. Ran-


domly distributed tasks in bounded time. In
Innovative Internet Community System. LNCS
Springer Verlag, 2003.

You might also like