Available online at www.sciencedirect.com

SCIENCE DIRECT«

Electronic Notes in Theoretical Computer Science 154 (2006) 79-94

www.elsevier.com/locate/entcs

Distributed Graph Traversals by Relabelling Systems with Applications

Bilel Derbel and Mohamed Mosbah 1

LaBRI, University of Bordeaux 1 351, cours de la libration 33405 Bordeaux, France

Abstract

Graph traversals are in the basis of many distributed algorithms. In this paper, we use graph relabelling systems to encode two basic graph traversals which are the broadcast and the convergecast. This encoding allows us to derive formal, modular and simple encoding for many distributed graph algorithms. We illustrate this method by investigating the distributed computation of a breadth-first spanning tree and the distributed computation of a minimum spanning tree. Our formalism allows to focus on the correctness of a distributed algorithm rather than on the implementation and the communication details.

Keywords: Distributed algorithms, Graph traversals, Relabelling systems.

1 Introduction

1.1 Motivation and contribution

Distributed algorithms are designed to run on networks consisting of interconnected autonomous entities of computations (processes) cooperating to solve given problems. Many of these algorithms, mainly dealing with the traversal of the network, appear as the compositions of some basic tasks. These basic tasks include the broadcasting or the propagation of information and the echo or convergecast algorithm [4,15,10,14]. For instance, in the message-passing scheme, a distributed computation of a spanning tree can be per-

1 Email: derbel@labri.fr, mosbah@labri.fr

1571-0661/$ - see front matter © 2006 Elsevier B.V. All rights reserved. doi:10.1016/j.entcs.2005.03.034

formed by broadcasting a message from an initial node to all other nodes of the graph; each node propagates the message to its neighbors upon receiving it. This simple algorithm may be described in some other way depending on the distributed model. In fact, in the distributed setting, many distributed algorithms are inherently dependent on the model one considers i.e., message-passing, shared memory, synchronous, asynchronous etc. A distributed algorithm which is designed and implemented in a given model becomes in general obsolete in another model. Even though it is possible, one has often to re-adapt or to re-encode the algorithm depending on the model specification.

In this context, graph relabelling systems and local computations [8,7,9] can be viewed as a tool which allows to encode distributed algorithms in a formal and unified way. In fact, a graph relabelling system is based on a set of relabelling rules which are executed locally and concurrently. These rules are described using mathematical and logic formulas which enables to derive formal and rigorous mathematical proofs of their correctness and by the same way to prove the correctness of an algorithm on a distributed system.

In this paper, we are interested in a high level encoding of some basic Wave and graph traversal algorithms which are in the basis of many sophisticated distributed algorithms. In particular, we show that by expressing the broadcast and the convergecast by graph relabelling systems, a large class of graph traversals can in turn be expressed by graph relabelling systems. The highlevel encoding of such algorithms in form of graph relabelling systems allows to encode them and to prove them in a unified and simple way. Furthermore, we show that it is possible to combine these two subroutines to give a formal encoding for some basic applications which illustrate our approach.

First, we show how to encode the classical distributed layered breadth-first spanning (BFS for short) construction [5,15,13]. This algorithm involves the encoding of many iterations of a classical technique in distributed computing which is known as the "Propagation of Information with Feedback" (PIF for short) [14]. Even though our encoding is given in the special case of the BFS tree construction, it gives a general idea about how to design sophisticated algorithms based on the PIF technique.

Second, by using the convergecast as a building block, we give a general method to encode with relabelling system distributed algorithms for computing some particular (commutative and associative) global functions.

These two basic applications are then combined to derive the graph relabelling system that encodes the classical Prim's distributed algorithm for computing a minimum spanning tree (MST for short) [5,15,13]. This example aims to show how to combine the basic graph traversals we have encoded in order to obtain a simple and formal encoding of more advanced algorithms.

1.2 Graph model and notations

In this section, we illustrate, in an intuitive way, the notion of graph relabelling systems by showing how some algorithms on networks of processors may be encoded within this framework [9]. As usual, such a network is represented by a graph G = (V, E) whose nodes stand for processors and edges for (bidirectional) links between processors. We only consider undirected connected graphs without multiple edges and self-loops. At every time, each node and each edge is in some particular state encoded by a node or an edge label. According to its own state and to the states of its neighbors, each node may decide to realize an elementary computation step. After this step, the states of this node, of its neighbors and of the corresponding edges may have changed according to some specific computation rules. Let us recall that graph relabelling systems satisfy the following requirements:

(C1) they do not change the underlying graph but only the labelling of its components (edges and/or nodes), the final labelling being the result,

(C2) they are local, that is, each relabelling changes only a connected subgraph of a fixed size in the underlying graph,

(C3) they are locally generated, that is, the applicability condition of the relabelling only depends on the local context of the relabelled subgraph.

A precise description and definition of local computations can be found in [7]. We recall here only the description of local computations and we explain the convention under which we will describe graph relabelling systems later. A relabelling system is a triple R = (L, I, P) where L = Lv U Le a set of labels, Lv a set of node labels, cv a set of edge labels, I a subset of L called the set of initial labels and P a finite set of relabelling rules.

For each relabelling rule, we will consider a generic star-graph of generic center v0 and of generic set of nodes B(v0,1) (star of radius 1 centered at v0) and we will refer to a node v = v0 of the star graph by writing v E B (v0,1). Within these conventions, each relabelling rule is described by its precondition and relabelling. If A(v) is the label of v in the precondition, then A'(v) will be its label in the relabelling. We will omit in the relabelling the description of labels that are not modified by the rule. This means that if A(v) is a label such that A'(v) is not explicitly described in the rule for a given v, then A'(v) = A(v). The label of a node can be composed of k components (with k a given integer). In this case, we denote by Lv = {L1 x L2 x ... x Lk} the set of labels where Li (1 < i < k) is a set of possible values of the ith component. For every node v, we denote by A(v).Li the ith component of the label of v. We adopt the same notations for edge labels. For instance, consider a node v E B(v0, 1), then A(v0, v) refers to the labels of the edge e = (v0,v) in the

precondition and A'(v0, v ) will be its label in the relabelling. The preconditions and the relabelling are written as logic formulas. We use the logic symbols A, V, 3, 3! and V to denote respectively the logic operators "and", "or", "it exist", "it exists a unique" and "for all". In the case of a weighted graph Gw, if e = (u, v) is an edge then we will denote by W(u, v) the weight of e.

1.3 Summary

The paper is organized as follows. In Section 2, we give an encoding of the broadcast and convergecast process using graph relabelling systems. In Section 3, we give two basic applications which are the distributed layered construction of a BFS tree and the computation of global functions. As a combination of these two applications, in Section 4, we give a formal and detailed algorithm for computing a minimum spanning tree. Finally, in Section 5, we give some concluding remarks.

2 Building blocks

Many basic distributed algorithms can be described as a combination of many couples of broadcast and convergecast. The broadcast is usually used to deliver a given information (e.g: the value of a variable, the beginning of a new step in the algorithm) to all the nodes of the network. The convergecast is in general used to collect some information into one single node. This information is for example used to activate some treatment. In the next two subsections, we give the relabelling systems corresponding to the broadcast and convergecast operations. In this section, we do not care about the information to be broadcast or collected. We only give the intuitive method to do it using relabelling systems.

2.1 The broadcast technique

The broadcast operation can be defined as the dissemination of some information from a source node to all nodes in the network. It can be encoded with the relabelling system nb = (cb,Ib, Pb) defined by: Lb = {E} u {0,1}, where E e {A,s,o}, Ib = {A,o} u{0} and Pb = {Rb,RjJ}. Initially, one source node from whom the broadcast is initiated is labelled A and all other nodes are labelled O. All the edges of the graph are initially labelled 0. The label S encodes the fact that the broadcast process has reached some node.

Rb : Broadcast : initial step

Precondition : • A (v0).E = A Relabelling :

B. Derbel, M. Mosbah /Electronic Notes in Theoretical Computer Science 154 (2006) 79—94 Vv e B(vo, 1) (A(v).E = O (A'(v) := S,A'(v,vo) := 1))

Broadcast

Precondition : • \(v0).E = S

■ 3v e B(vo, 1)(A(v).E = O) Relabelling :

■ Vf e s(f0,i) (A(f)-B = o

(A'(v) := S,A'(v,vo) := 1))

Rule (resp. R2) can be applied as follows. If a star center v0 is labelled A (resp. S) then for each node v in the star B(v0,1), if v is labelled O then it becomes labelled S and the edge (v0,v) becomes labelled 1. Note that as a basic application of the relabelling system Rb, once the broadcast is terminated, we obtain a spanning tree by considering the edges with labels 1. Figure 1 shows an example of the broadcast algorithm using the relabelling system Rb. Note that the rules can be applied by many nodes on distinct balls as far as their precondition states are at the same time satisfied.

• : label A O : label O O : label S - : label 0 - : label 1

Fig. 1. An example of a broadcast using the relabelling system Rb.

2.2 The convergecast technique

The convergecast operation consists in collecting information upwards on a tree. The most fundamental example is to let a source node, that has broadcast some information, detects that the broadcast has terminated. In fact, in order to detect the "broadcast termination", a convergecast process can be performed as follows. First, each leaf of the tree which has been reached by the broadcast sends an acknowledgment to its parent. Upon receipt of an acknowledgment from all its children, a node sends an acknowledgment to its parent and so on. When the source node receives an acknowledgment from all

its children then the source node knows that the broadcast has reached all the nodes of the graph. This example can be generalized when we want to collect some other information in some root node.

We assume that we have a precomputed rooted spanning tree (Recall that the relabelling system enables us to construct such a tree). Then, the con-vergecast operation can be encoded using the relabelling system R = (Lc,Ic,Pc) defined by: L = {E} u {0,1}, where E e {A,s,f,t}, i = {A,s}u{0, 1} and Pc = {Rl,R?}. Initially, the source node is labelled A, all other nodes are labelled S, an edge belonging to the spanning tree is labelled 1 and all other edges are labelled 0. If a node becomes labelled F then it has finished the convergecast. When the source node A becomes labelled T then the converge-cast process is terminated. Figure 2 shows an example of the execution of the convergecast algorithm using the relabelling system Rc.

RC : A node becomes a leaf

Precondition :

■ \{v0).e = s

■ 3! vc e B(v0,1) ((A(vi).E = S V A(vi).E = A) A A(vo,vi) = 1)

Relabelling :

■ \'(vo).e := f

Termination detection

Precondition :

■ A {v0).e = a

■ Vv e B(vo, 1) (A(v).E = F) Relabelling :

■ A>0 ).e:=t

3 Two basic applications

3.1 Layered BFS tree construction

Many distributed algorithms can be implemented by performing as many as necessary phases of broadcast and convergecast. Each phase corresponds to a propagation of some information with feedback (PIF). The broadcast can be viewed as the beginning of a new stage of the algorithm and the convergecast corresponds to the termination of that stage. This technique is fundamental when designing distributed algorithms because, in the distributed setting, there is no centralized entity which supervises in a global way the execution of an algorithm. In the following, our main goal is to show how to encode by graph relabelling systems the Dijkstra's layered BFS tree [5,15,13] algorithm which is based on the PIF operation.

Recall that a BFS tree of a graph G with respect to a root node r is a spanning tree with the property that for every node v, the path leading from the root r to v in the tree is of the minimum (unweighted) length possible. One classical technique to construct a BFS tree begins by growing the tree from one pre-distinguished node. Then, it proceeds in many iterations by constructing the tree in a layered fashion beginning from the root downwards. At each iteration, the unprocessed nodes which are adjacent to some node marked as part of the tree are added. Once a layer is added, the construction of a new layer can begin. The main difficulty here is to begin adding the next layer only when the previous layer has been completely added.

The classical layered BFS tree construction can be encoded using the graph relabelling system r = (Lt,It,Pt) defined by: Lt = {E x i} u {0,1}, where E e {A,s,f,t,o} and i e {-1,1}; It = {(O,-1), (A,-1)} u {0} and Pt =

/p1 P2 P3 P4 P5 P6 P7\ {Rt ,Rt ,Rt ,Rt ,Rt ,Rt ,Rt}.

In the remainder, by BFS tree, we mean the fragment which is being enlarged. Initially, a pre-distinguished node (the root) is labelled (A, — 1) i.e., active. All other nodes are labelled (O, —1) i.e., outside the BFS tree. All edges are labelled 0. If an edge becomes labelled 1 then it is part of the tree. The A-labelled node acts as the initiator of a new iteration of the algorithm i.e., the construction of a new layer. The label (S, 1) indicates that a node which is inside the fragment tree must broadcast some information (i.e., the construction of a new layer). In contrast, when a node is labelled (S, —1) then it is waiting for the acknowledgment of its children. A node labelled F is a node that has finished the convergecast and is waiting for an order from its parent. Finally, when a node is labelled T then this node has locally terminated i.e., it can not contribute any more in the tree construction.

Rule Rt initiates the computation of the BFS tree by adding the first layer. It also encodes the beginning of a new iteration of the algorithm. In fact, when the neighbors of the A-node become F (or T) labelled, then the A-node knows that a new layer has been added and the construction of a new layer can begin. Thus, the labels of all F-neighbors are set to (S, 1) in order to begin the broadcast of this information up to the leaves of the BFS tree.

R1 : Beginning the construction of a new layer

Precondition :

■ X(v0).E = A /*the root node*/

■ Vv e B(v0,1) (A(v).E = S) /*broadcast-convergecast finished*/

■ 3vc e B(v0,1) (A(vC).E = T) /*the computation is not over */

Relabelling :

• Vi> G B(v0,1) (A(v).E^T ==> (A» := (S,l),X'(v0,v) := 1))

If an (S, 1)-labelled node u is in the interior of the BFS tree, then it just informs its children by setting their labels to (S, 1) and it becomes (S, — 1) labelled (Rule Rj2). Otherwise, if a u is a leaf, then either there exist some not yet marked O-neighbors in which case these nodes are added to the tree and u becomes F-labelled (Rule Rf), or there are no new nodes to add. In this case, u becomes T-labelled: terminated state (Rule R^1).

R? : Broadcast

Precondition :

• \(v0) = (S, 1) /*broadcast in progress*/

■ 3vc e B(v0,1) (A(v0,vc) = 1 A A(vC).E = F) /*children are not informed*/ Relabelling :

• A>0) := (5,-1)

■ Vv e B(v0,1) ((A(v).E = F A A(v0,v) = 1) A'(v) := (S, 1))

Rf : Construction of the next layer

Precondition :

• X(vo) = (S,l)

■ 3vc e B(v0,1) (A(vC).E = O) /*some neighbors are not in the tree*/

Relabelling :

• A>0) := (F, -1)

■ Vv e B(v0,1) (A(v).E := O (A(v) := (F,-1),A'(v0,v) := 1))

R4 : No nodes to add to the next layer

Precondition : • X(vo) = (S,l)

■ Vv e B(v0,1)(A(v).E = O) /*all neighbors are in the tree*/

■ 3! vc e B(v0,1) (A(v0,vc) = 1) /*v0 is a leaf*/ Relabelling :

■ X'(v0) := (T, -1)

After the broadcast step in Rule R^, a node u which becomes (S, — 1)-labelled waits for the acknowledgment of its children. When these children become F-labelled, then u knows that the new layer that corresponds to the last broadcast has been added by the leaves of the subtree rooted at it. Thus, it becomes (F, — 1)-labelled in order to inform its parent (Rule R). Note that if all the children of u become T-labelled, then u knows that no new nodes can be added in the subtree rooted at it. Thus, it becomes T-labelled (Rule

R5 : Convergecast: Waiting for the next broadcast

Precondition :

• A(i>o) = (5,-1)

■ 3! vi e B(vo, 1) ((A(vi).E = S V A(vi).E = A) A A(vo,vi) = 1) /*all children have received an acknowledgment*/

■ 3v2 e B(vo, 1) (A(v2).E = F A A(vo,v2) = 1)

/*some children have not yet terminated the algorithm*/

Relabelling :

■ A>0) := (F, —1)

R6 : Convergecast: The tree construction is locally finished

Precondition :

• A(i'o) = (5,-1)

■ 3! vi e B(vo, 1) ((A(vi).E = S V A(vi).E = A) A A(vo,vi) = 1)

■ Vv e B(vo, 1) ((v = vi A A(vo,v) = 1) A(v).E = T) Relabelling :

■ A>0) := (T,-l)

The construction of the BFS tree is terminated when all the neighbors of the A-labelled node become T-labelled. In fact, this means that there is no new layer to add: all the nodes of the graph are in the tree. In this case, the A-labelled node becomes T-labelled (Rule Rj). Note that at this stage of the algorithm, only the A-labelled node detects the global termination of the algorithm.

Rj : Termination detection

Precondition :

■ \{v0 ).E = A

■ Vv e B(vo, 1) (A(v).E = T)

Relabelling :

■ \'(v0).E = T

3.2 Global function computation

In many distributed algorithms, the convergecast and the broadcast are used in order to compute some functions of the graph. Suppose for instance that we want a source node to compute a global function f (Xvi, Xv2,..., XVn) where Xv is an input stored in each node v. Suppose that f verifies the following properties (we adopt the same notations as in [13] page 36) :

• f is well-defined for any subset of the inputs.

• f is associative and commutative.

In the following, we assume that we have a precomputed spanning tree (obtained for example by using the relabelling system Rt). Such a function f, also called semigroup function, can be computed in a distributed manner by performing a convergecast process. In fact, f (Xvi, Xv?, ...,Xvn) can be computed using the relabelling system R = (Lf, If, Pf) defined by: Lf = {E x X x Y} u {0,1}, where E e {s,f,t}, X an input of the function f, If = {S} U {0,1} and Pf = {R},r?}. Initially, all the nodes are labelled S and an edge with label 1 is part of the precomputed spanning tree.

By local value of f in rule Rf, we mean the value of f computed on the subtree Tv rooted at the node v that executes the rule Rf. The variable Yt in rule Rf contains the value of f applied to all the entries Xvi with Vi E Tv and Vi = v. The local value of f computed by v will enable the parent u of v to compute its own local value of f. Each time a node applies Rule Rf it becomes F-labelled which means that it has finished to compute the local value of f. At the end of the process, only one node with label S remains. This node then applies rule Rj and it computes the global value f (Xvi, Xv? ,...,XVn). Note that the convergecast process used here does not end at a pre-distinguished node but at some node which is elected at random depending on the algorithm execution. However, the two rules must be executed on disjoint stars that do not overlap.

R} : Convergecast: Computation of the local value of f

Precondition :

■ A {v0).E = S

■ 3! vi e B(v0,1) (A(vi).E = S A A(v0,vi) = 1)

Relabelling :

■ Yi := f(UvieB(v0,i)(A(vi).E=FAA(v0,vi)=i)A(vi).Y)•

■ A'(v0).E := F

■ A'(v0).Y := f (A(v0).X,Yi)

R? : Convergecast: Global computation of f and termination detection

Precondition :

■ A {v0).E = S

■ Vv e B(v0,1) (A(v).E = F) Relabelling :

■ Yi := f(uvieB(vo,i)(A(vo,vi) = i)A(vi).Y).

■ A'(v0).E := T

■ A'(v0).Y := f (A(v0).X,Yi)

Using these two simple rules, we can encode in a formal way some classical distributed algorithms. For example, to compute the maximum of values

Input: a weighted graph Gyy = (V, E).

Step 1: Initially, set Et (a set of edges) empty. Set Vt (a set of nodes) empty.

Step 2: Select an arbitrary node in V, and add it to Vt.

Step 3: Find the lowest weight edge e = (u,v) such that u £ Vt but v £ Vt. Add v to Vt, and e to Et-

Step 4- Repeat Step3 until Vt equals V.

Output: A minimum spanning tree T = (V, Et).

Fig. 3. Prim's Algorithm

stored by the network nodes, we just take f := max; to compute the sum over the node inputs, we take f := +. This method can also be used to derive distributed algorithms for computing some logical functions. For example, let Xv be a variable set to 1 if some predicate Pred(v) = true and 0 otherwise. Suppose that we want to design a distributed algorithm to determine if the predicate 3vPred(v) holds in the network (i.e., : there exists some node v with Pred(v) = true). This can be done by letting f be the logical or operator. The predicate VvPred(v) can also be computed distributively be setting f := and.

4 Distributed minimum spanning tree: Prim's algorithm

4.1 Preliminaries

In this section, we focus on the distributed construction of a minimum spanning tree. This problem is of special interest because the classical distributed algorithms for solving it use the basic techniques that we have described in previous sections as basic procedures. Our main motivation is to show that by using relabelling systems, we can design such a sophisticated algorithm in a detailed and comprehensive way.

Recall that given a weighted graph Gw, the MST problem consists in computing a spanning tree T such that the sum of the weights of the edges of T is the minimum over all possible spanning trees of Gw . The problem has been heavily studied and many features of the MST problem, such as the distributed computability of such a tree or the time complexity for constructing it, were studied under many assumptions in past works. In this paper, we assume that the edge weights are unique, real and positive. Under this assumption, it is well known that there exists a unique minimum spanning tree of Gw (see [5,15,13] and references there).

One of the most basic algorithms for computing such a MST is the Prim's algorithm [5,15,13] (see Figure 3). Starting from one node, this algorithm consists in growing a fragment by adding at each iteration the minimum outgoing

edge (MOE for short) to this fragment. The correctness of the algorithm relies on the fact that, at each iteration, the constructed fragment is part of the MST.

The classical distributed implementation of this algorithm consists of many phases, each one consists of two stages. In the first stage, the nodes in a fragment cooperate to compute the weight of the MOE. This is performed using a convergecast in the already computed fragment. The second stage consists in adding the MOE which is performed by broadcasting the weight of the MOE to all nodes in the fragment. When learning about the weight of the MOE, a node either adds the new edge to the fragment (if the MOE is incident to it) or re-initialize its state in order to begin another phase. The main difficulty here is to combine many broadcast and convergecast operations with the MOE computation. In the following, we give the relabelling system which encodes this MST algorithm.

By combining Rt and Rf=min, Prim's algorithm can be encoded by the graph relabelling system Rm=(Lm,Im,pm) defined by: Lm={Ex ws„Mree x wiocai xi}u {0,1} where E e {S,F,T,O}, i e {-1,1} and (ws„Mree,w;ocai) e R+ u±; Im = {(O,±, ±,-1), (S, ±, ±,-1)}u{0} and Pm={Rm,R2;,RSm,R^, Rim}. Note that, if the value of attribute wsubtree (or wlocal) is equal to ±, then this value has not been set yet.

Initially, there is a distinguished node with label (S,±,±,-1) which is the first node in the fragment. All other nodes are labelled (O, ±, ±, -1). As for the relabelling system Rt, if the value of the attribute i is equal to 1 (resp. — 1) then an S-labelled node knows that it is in the broadcast (resp. convergecast) stage. At the beginning, all edges are labelled 0. If an edge becomes labelled 1 then it is part of the tree.

4.2 Computing the weight of the MOE: convergecast

The nodes of the fragment have to cooperate in order to compute the MOE i.e., convergecast from the leaves of the fragment up to an elected node (rule R^J. Each node must compute the attributes wsubtree which is the weight of the minimum outgoing edge of the subtree rooted at it. Note that, during the convergecast, each node also stores the attribute wlocal which is the weight of incident edges that connect it to nodes with label O. This will serve in the broadcast stage to find and to add the MOE of the whole fragment.

Rmi : Computing the minimum outgoing edge

Precondition :

• \(v0) = (S, ±, ±, — 1) /*convergecast stage*/

■ Vv e B(v0,1)((A(v).E = S A A(v0,v) = 1) ^ A(v).i = -1)

■ 3! vi e B(v0,1) (A(vi).E = S A A(v0,vi) = 1)

/*all children have received an acknowledgment */

Relabelling :

■ w := min{{W(v0,v) | v G B(v0,1)(A(v).E = O)} U {+oo}} /*local MOE*/

■ Wmin := min{{A(v).ws„btree | v e B(vo, 1)(A(vo,v) = 1 A A(v).E = F)} U {w}} /*the MOE of the subtree rooted at v0*/

■ (wmin =+<) ^ A'(vo).E := T /*local termination*/

■ (wmin = + <) ^ A'(vo) := (F, Wmin ,w, -1)

At the end of the convergecast, the weight wmin of the MOE is computed at some elected node (rule R^). This node sets its label to (S, wmin, w, 1) in order to begin the broadcast phase. (Note also that rule R2rn also enables to initialize the MST construction).

R- : Election of a node

Precondition :

■ \(v0) = (£,±,±,-1)

■ Vv e B(vo, 1)(A(vo, v) = 1 A(v).E = S) Relabelling :

■ w := min{{W(v0,v) | v G B(v0,l)(\(v).E = O)} U {+00}}

■ wmin := min{{A(v).ws„6tree | v e B(vo, 1)(A(vo,v) = 1 A A(v).E = F)} U {w}}

■ (w-min = ^ A'(vo).E := T

■ (wmin = +to) ^ A'(vo) := (S, Wmin ,w,1)

Rules Rm and R^ also allow to detect the termination of the MST construction. In fact, if the weight of the MOE is equal to then there is no node with label O at the frontier of the fragment and thus all the nodes of the graph are in the fragment.

4.3 Finding and adding the MST: broadcast

At the end of the convergecast process (rule Rm), there is an elected node with label (S, w,w', 1) that begins the broadcast (attribute i is equal to 1). Thus, a node u with label (S, w,w', 1) first compares w and w'. If w=w' then the MOE is incident to u itself. Thus, the minimum edge is added and u sets its variable i to — 1 in order to reinitialize the computation of another minimum edge (Rule Rm). Otherwise, if w = w' then there must exist a neighbor with label (F, w, w'', —1) from whom u has inherited its w value and the MOE must be in the subtree rooted at that neighbor. Thus, the F-labelled neighbor becomes (S, w, w'', 1)-labelled (Rule Rm). The other F-labelled children become (S, ±, ±, 1)-labelled in order re-initialize the computation of a new MOE (Rule

R- : Broadcast the weight of the MOE

Precondition :

• X(vo) = {S,w,w', 1)

■ w = w' A (w = +<) A (w = ±)

■ 3! vi e B(vo, 1) (A(vo,vi) = 1 A A(vi).ws„btree = w) /*weights are unique*/

Relabelling :

• A'(vo) := (S,1,1,-1)

• A'(vi).E := S, A'(vi).i := 1

• Vv e B(vo, 1) ((v = vi A A(vo,v) = 1 A A(v).E = F) ^ A'(v) := (S, ±, ±, 1))

Rm : Adding the MOE

Precondition : • A(i'o) = (S1, 1)

■ (w = A (w = ±)

■ 3! vi e B(v0,1) (A(v0,vi) = 1 A A(vi).E = O AW (v0,vi) = w) Relabelling :

■ A'(i'o) := (S,±,±,-l)

■ Vv e B(v0,1) ((v = vi A A(v0,v) = 1 A A(v).E = F) ^ A'(v) := (S, ±, ±, 1))

■ A'(vi) := (S, ±, ±,-1)

■ A'(v0,vi) := 1

Reinitialization

Precondition :

• A(i'o) = (s, ±, ±, 1) /*the MOE is not in the subtree rooted at vq*/ Relabelling :

■ A'(i'o) = (S,±,±,-l)

■ Vv e B(v0,1) ((A(v).E = F A A(v0,v) = 1) ^ A'(v) := (S, ±, ±, 1))

5 Concluding Remarks

In this paper, we give a general technique that provides a modular construction of a large class of distributed computing algorithms. By exploiting this modular construction and the properties of graph relabelling systems, we obtain a general and a unified framework for expressing, proving and implementing distributed algorithms. The expressiveness has been clearly demonstrated by the numerous algorithms described in the paper. However, some other features concerning the proof techniques and the impelmentation issues remains to be studied in future work.

In fact, in order to prove the correctness of a graph relabelling system, that is the correctness of the algorithm encoded by such a system, it is useful to exhibit (i) some invariant properties associated with the system (i.e., some properties of the graph labelling that is satisfied by the initial labelling and that is preserved by the application of every relabelling rule) and (ii) some properties of irreducible graphs [11]. The correctness of the algorithms given in this paper can be formally proven using that technique. Nevertheless, because our algorithms are clearly expressed as a combination of some few basic procedures, proving these basic procedures allows us to get basic building blocks which can be used as a bottelneck for proving the more sophisticated algorithms. Our aim is to give more generic algorithms allowing to automatically combine the basic techniques presented in this paper by using some

logical functions F to be formally defined in future work. This will allow to automatically derive the relabelling system AF corresponding to a distributed algorithm A expressed in term of some basic procedures (convergcast, broadcast, PIF, etc.). By the same way, by using the properties of F together with the proofs of these basic procedures, we hope to develop new modular techniques that help proving the correcteness of the relabelling system AF.

In addition to be formal, provable and tractable, the relabelling systems given in this paper can be translated in practical distributed algorithms in the message passing model. In fact, a new language called Lidia has been developped in [12] in order to automatically transform a given relabelling system in an executable distributed program using the Visidia [6,1,2] platform (i.e., a software tool for the simulation and the visualization of distributed algorithms in the message passing model). Furthermore, the distributed model studied in [3] combined with ideas from this paper will enable to translate a distributed algorithm expressed in a message passing model in a more formal and theoritical framework. This will enable to verify and to debug existing sophisticated algorithms which are in general hard to validate.

Acknowledgement

We would like to thank J. Chalopin and Y. Metivier for helpful remarks and suggestions.

References

[1] Bauderon, M., Y. Metivier, M. Mosbah and A. Sellami, From local computations to asynchronous message passing systems, Technical Report RR-1271-02, LaBRI (2002).

URL http://www.labri.fr/visidia/

[2] Bauderon, M. and M. Mosbah, A unified framework for designing, implementing and visualizing distributed algorithms., Electr. Notes Theor. Comput. Sci. 72 (2003).

[3] Chalopin, J. and Y. Metivier, A bridge between the asynchronous message passing model and local computations in graphs., in: MFCS, 2005, pp. 212-223.

[4] Chang, E. J. H., Echo algorithms: Depth parallel operations on general graphs., IEEE Trans. Software Eng. 8 (1982), pp. 391-401.

[5] Cormen, T. H., C. E. Leiserson and R. L. Rivest, "Introduction to Algorithms," MIT Press/McGraw-Hill, Cambridge, MA, 1990.

[6] Derbel, B. and M. Mosbah, Distributing the execution of a distributed algorithm over a network, in: 7th IEEE International Conference on Information Visualization, IV03-AGT., 2003, pp. 485-490.

[7] Godard, E., Y. Metivier and A. Muscholl, Characterizations of classes of graphs recognizable by local computations, Theory of Computing Systems 37 (2004), pp. 249-293.

[8] Litovsky, I., Y. Metivier and E. Sopena, Different local controls for graph relabelling systems, Math. Syst. Theory 28 (1995), pp. 41-65.

[9] Litovsky, I., Y. Metivier and E. Sopena, Graph relabelling systems and distributed algorithms, Handbook of graph grammars and computing by graph transformation 3 (1999), pp. 1-56.

[10] Lynch, N. A., "Distributed Algorithms," Morgan Kaufmann Publishers, Inc., 1996.

[11] Metivier, Y., M. Mosbah and A. Sellami, Proving distributed algorithms by graph relabeling systems: Examples of trees in networks with processor identities, in: Applied Graph Transformations, Grenoble, 2002, pp. 45-57.

[12] Mosbah, M. and R. Ossamy, A programming language for local computations in graphs: Computational completeness, in: 5th Mexican Int. Conference in Computer Science Colima Mexico 20-24 September (2004), pp. 12-19.

[13] Peleg, D., "Distributed Computing, A Locality-Sensitive Approach," SIAM Monographs on Discrete Mathematics and Applications, 2000.

[14] Segall, A., Distributed network protocols., IEEE Transactions on Information Theory 29 (1983), pp. 23-34.

[15] Tel, G., "Introduction to distributed algorithms," Cambridge University Press, 2000.