• Aucun résultat trouvé

The Case of Regular Communication Graphs

An Algorithmic Framework to Compute Global Functions

3.5 The Case of Regular Communication Graphs

3.5.1 Tradeoff Between Graph Topology and Number of Rounds

A graph is characterized by several parameters, among which its number of vertices n, its number of edgese, its diameterD, and its maximal degree, are particularly important.

On the Message Complexity This appears clearly in the message complexity (de-notedC in the following) of the previous algorithm for whichCis upper bounded by 2e(D+1). IfDis known by the processes, one round is saved, and we have C=2eD. This means that

• If the graph is fully connected we haveD=1,e=n(n−1)/2, andC=O(n2).

• If the graph is a tree we havee=(n−1), andC=O(nD).

This shows that it can be interesting to first build a spanning tree of the com-munication graph and then use it repeatedly to compute global functions. However, for some problems, a tree is not satisfactory because the tree that is obtained can be strongly unbalanced in the sense that processes may have a distinct number of neighbors.

The Notion of a Regular Graph Hence, for some problems, we are interested in communication graphs in which the processes have the same number of neighbors (i.e., the same degree). When, they exist, such graph are called regular. In such a graph we havee=(n)/2, and consequently we obtain

C=nD.

This relation exhibits a strong relation linking three of the main parameters associ-ated with a regular graph.

What Regular Graphs Can Be Built? GivenandD, Moore’s bound (1958) is an upper bound on the maximal number of vertices (processes) that a regular graph with diameterDand degreecan have. This number is denotedn(D, ), and we haven(D, )≤1++(−1)+ · · · +(−1)D−1, i.e.,

n(D,2)≤2D+1, and n(D, )(−1)D−2

−2 for >2.

3.5 The Case of Regular Communication Graphs 73 This is an upper bound. Therefore (a) it does not mean that regular graphs for whichn(D, )is equal to the bound exist for any pair(D, ), and (b) when such a graph exists, it does not state how to built it. However, this bound states that, in the regular graphs that can be built, we have≥ √D

This formula relates clearly the number of roundsDand the number of messages exchanged at each round, namelynD

n.

3.5.2 De Bruijn Graphs

The graphs known as De Bruijn’s graphs are directed regular graphs, which can be easily built. This section presents them, and shows their interest in computing global functions. (These graphs can also be used as overlay structures in distributed applications.)

Letxbe a vertex of a directed graph.+(x)denotes its input degree (number of incoming edges), while(x)denotes its output degree (number of output edges).

In a regular network, we have∀x: +(x)=(x)=, and the valuedefines the degree of the graph.

De Bruijn’s Graph Let us consider a vocabularyV ofletters (e.g.,{0,1,2}for =3).

• The vertices are all the words of lengthDthat can be built on a vocabularyV of letters. Hence, there aren=Dvertices.

• Each vertex x= [x1, . . . , xD1, xD] has output edges that connect it to the verticesy= [x2, . . . , xD, α], whereαV (this is called the shifting property).

It follows from this definition that the input channels of a vertexx= [x1, . . . , xD1, xD]are thevertices labeled[β, x1, . . . , xD1], whereβV.

Let us also observe that the definition of the directed edges implies that each vertex labeled[a, a, . . . , a],aV, has a channel to itself (this channel counts then as both an input channel and an output channel).

A De Bruijn’s graph defined from a specific pair(, D)is denoted dB(, D).

Such a graph hasn=Dvertices ande=ndirected edges.

Examples of De Bruijn’s Graphs Examples of directed De Bruijn’s graphs are described Fig.3.7.

Fig. 3.7 The De Bruijn’s directed networks dB(2,1), dB(2,2), and dB(2,3)

A Fundamental Property of a De Bruijn’s Graph In addition to being easily built, De Bruijn’s graphs possess a noteworthy property which makes them attractive for the computation of global functions, namely there is exactly one directed path of lengthDbetween any pair of vertices (including each pair of the form(x, x)).

Computing a Function on a De Bruijn’s Graph The algorithm described in Fig.3.8is tailored to compute a global functionF ()in a round-based synchronous (or asynchronous) distributed system whose communication graph is a De Bruijn’s graph (as seen in Fig.2.9, messages have to carry the parity bit of the current round number in the asynchronous case).

This algorithm is designed to benefit from the fundamental property of De Bruijn’s graphs. Letc_ini denote the set ofinput channels andc_outi denote the set ofoutput channels ofpi. At the end of a round, the local variable receivedi

contains all pairs(j,inj)received bypi in the current round (lines3–7). Initially, receivedi contains the input pair ofpi, i.e.(i,ini). When, it starts a round, a process pisends the value of receivedi on each of its output channels (line2). Hence, during a roundr, a process sends on each of its output channels what it has learned from all its input channels during the previous round(r−1). There is neither filtering nor memorization of what has been received during all previous roundsr< r.

It follows from the fundamental property of De Bruijn’s graphs that, at the end of the last round r =D, the set receivedi of each process pi contains all the input values, each exactly once; i.e., we have then receivedi = {(1,in1),

3.6 Summary 75 init receivedi← {(i,ini)}.

(1) whenr=1,2, . . . , Ddo begin synchronous round

(2) for eachxc_outidosendMSG(receivedi)onchanneli[x]end for;

(3) receivedi← ∅; (4) for eachxc_inido

(5) wait (MSG(rec)received on channeli[x]);

(6) receivedireceivedirec (7) end for

end synchronous round (8) end when;

(9) outiF (receivedi);

(10) return(outi).

Fig. 3.8 A generic algorithm for a De Bruijn’s communication graph (code forpi)

(2,in2), . . . , (n,ini)}. Each process can consequently computeF (receivedi)and re-turns the corresponding result.

A Simple Example Let us consider the communication graph DB(2,2) (the one described in the middle of Fig.3.7). We have the following:

• At the end of the first round:

– The process labeled 00 is such that received00= {(00,in00), (10,in10)}.

– The process labeled 10 is such that received10= {(01,in01), (11,in11)}.

At the end of the second round, the process labeled 01 is such that received01

contains the values of received00and received10computed at the previous round.

We consequently have received01= {(00,in00), (10,in10), (01,in01), (11,in11)}.

If the function F () is associative and commutative, a process can compute to_send=F (receivedi)at the end of each round, and send this value instead of receivedi during the next round (line2). Merging of files, max(), min(), and+are examples of such functions.

3.6 Summary

This chapter has presented a general framework to compute global functions on a set of processes which are the nodes of a network. The main features of this framework are that all processes execute the same local algorithm, and no process learns more than what it needs to computeF. Moreover, the knowledge of the diameterDis not necessary and the time complexity is 2(D+1), while the total number of messages is upper bounded by 2e(D+2), whereeis the number of communication channels.

3.7 Bibliographic Notes

• The general round-based framework presented in Sect.3.2and its improvement presented in Sect. 3.4 are due to J.-Cl. Bermond, J.-Cl. König, and M. Ray-nal [48].

• The algorithm that computes the cut vertices of a communication graph is due to J.-Cl. Bermond and J.-Cl. König [47]. Other distributed algorithms determining cut vertices have been proposed (e.g., [187]).

• The tradeoff between the number of rounds and the number of messages is ad-dressed in [223,243] and in the books [292,319].

• The use of the general framework in regular directed networks has been inves-tigated in [46]. Properties of regular networks (such as hypercubes, De Bruijn’s graphs, and Kautz’s graphs) are presented in [45,49].

• A general technique for network synchronization is presented [27].

A graph problem is local if it can be solved by a distributed algorithm with time complexity smaller thanD(the diameter of the corresponding graph). The inter-ested reader will find in [236] a study on the locality of the graph coloring problem in rings, regular trees of radiusr, andn-vertex graphs with largest degree.

3.8 Problem

1. Adapt the general framework presented in Sect.3.2to communication graphs in which the channels are unidirectional. It is, however, assumed that the graphs are strongly connected (there is a directed path from any process to any process).

Chapter 4

Outline

Documents relatifs