Oracle size: a new measure of difficulty for communication tasks Pierre Fraigniaud∗§
David Ilcinkas†§
Andrzej Pelc‡
Abstract We study the problem of the amount of knowledge about a communication network that must be given to its nodes in order to efficiently disseminate information. While previous results about communication in networks used particular partial information available to nodes, such as the knowledge of the neighborhood or the knowledge of the network topology within some radius, our approach is quantitative: we investigate the minimum total number of bits of information (minimum oracle size) that has to be available to nodes in order to perform efficient communication. It turns out that the minimum oracle size for which a distributed task can be accomplished efficiently, can serve as a measure of the difficulty of this task. We use this measure to make a quantitative distinction between the difficulty of two apparently similar fundamental communication primitives: the broadcast and the wakeup. In both of them a distinguished node, called the source, has a message, which has to be transmitted to all other nodes of the network. In the wakeup, only nodes that already got the source message (i.e., are awake) can send messages to their neighbors, thus waking them up. In the broadcast, all nodes can send control messages even before getting the source message, thus potentially facilitating its future dissemination. In both cases we are interested in accomplishing the communication task with optimal message complexity, i.e., using a number of messages linear in the number of nodes. We show that the minimum oracle size permitting the wakeup with a linear number of messages in an n-node network, is Θ(n log n), while the broadcast with a linear number of messages can be achieved with an oracle of size O(n). We also show that the latter oracle size is almost optimal: no oracle of size o(n) can permit to broadcast with a linear number of messages. Thus an efficient wakeup requires strictly more information about the network than an efficient broadcast. Keywords: algorithm, communication network, broadcast, wakeup, oracle
∗
CNRS, Laboratoire de Recherche en Informatique (LRI), Universit´e Paris-Sud, 91405 Orsay, France. E-mail:
[email protected] † Laboratoire de Recherche en Informatique (LRI), Bˆ at. 490, Universit´e Paris-Sud, 91405 Orsay, France. E-mail:
[email protected] Phone: (+33) 1 69 15 31 06. Fax: (+33) 1 69 15 65 86. § Pierre Fraigniaud and David Ilcinkas were both supported by the projects PairAPair of the ACI Masses de Donn´ees, and FRAGILE of the ACI S´ecurit´e Informatique. Additional support from the INRIA project “Grand Large”. ‡ D´epartement d’informatique, Universit´e du Qu´ebec en Outaouais, Gatineau, Qu´ebec J8X 3X7, Canada. E-mail:
[email protected] Andrzej Pelc was supported in part by NSERC discovery grant and by the Research Chair in Distributed Computing of the Universit´e du Qu´ebec en Outaouais.
1
Introduction
1.1
Background and related work
For many network problems (such as leader election, constructing a minimum spanning tree, exploration, wakeup, broadcast, etc.), the quality of the algorithmic solutions often depends on the amount of knowledge given to nodes of the network. For example, if every node knows the topology of the network within radius ρ of it, it is shown in [1] that Θ(min{m, n1+Θ(1)/ρ }) is the minimum number of messages of bounded length permitting the wakeup of a network with n nodes and m edges. (In [1] the authors talk about the broadcast but their model does not permit transmissions before receiving the source message, hence it is called wakeup in our terminology). Broadcasting time in radio networks is another subject where information available to nodes significantly influences efficiency. In [9] it is shown that if nodes have complete knowledge of the network then deterministic broadcast can be done in time O(D +log3 n), for n-node radio networks with diameter D. (This result has been recently improved to O(D + log2 n) in [11]). On the other hand, in [3] a lower bound of Ω(n log D) is proved on deterministic broadcast time in radio networks in which nodes know only their own identity. (An almost matching upper bound of O(n log2 D) is proved in [6]). Another problem, in which partial information about the network significantly influences the efficiency of solutions, is network exploration by a mobile agent. For instance, it is proved in [2] that, if an upper bound n ˆ on the number n of nodes of an anonymous digraph is known, then a mobile agent can explore this digraph in time polynomial in n ˆ , using one pebble, while without this knowledge, Θ(log log n) pebbles are necessary and sufficient. On the other hand, in [7] the authors investigate the exploration of various types of graphs when the exploring agent is provided with an unlabeled map of the graph, and show how the cost of exploration changes when no map is available. In fact, the impact of knowledge concerning the environment is significant in many areas of distributed computing, as witnessed by [8, 12] where hundreds of impossibility results and lower bounds for distributed computing are surveyed, many of them depending on whether or not the nodes are provided with partial knowledge of the topology of the network. Finally, notice that the
2
amount of knowledge has also a strong impact on computing in anonymous networks (cf., e.g., [10], where the impact of knowing the total number of nodes is studied in depth).
1.2
The oracle
A network is modeled as an undirected connected graph whose nodes have distinct labels, and ports at any node v of degree deg(v) are labeled 0,1,...,deg(v) − 1. One distinguished node of the network is called the source. A priori, every node has only information concerning itself: it knows its own label and degree, and it knows whether it is the source or not. All additional knowledge available to the nodes of the network (in particular knowledge concerning the rest of the network), is modeled by an oracle. An oracle is a function O whose arguments are networks, and the value O(G), for a network G = (V, E), is in turn a function f : V 7→ {0, 1}∗ assigning a binary string to every node v of the network. Intuitively, the oracle looks at the entire labeled network and assigns to every node some information, coded as a string of bits. The size of the oracle on a given network G is the sum of the lengths of all the strings it assigns to nodes. Hence this size is a measure of the amount of information about the network, available to its nodes. Solving a network problem P using oracle O consists in designing an algorithm that is unaware of the network G at hand but solves the problem P for it, as long as every node v of the network G is provided with the string of bits f (v), where f = O(G). Typical distributed network problems that may be solved using an oracle are various communication tasks, such as broadcast, wakeup or gossip (information exchange among nodes), as well as, e.g., the construction of a BFS tree or a minimum spanning tree. The formulation of the problem P may include a demand on the efficiency of the solution, thus we may be interested in communicating within a prescribed time, or constructing a minimum spanning tree using at most a prescribed number of messages. Given the problem P, we ask what is the minimum size of an oracle for solving it. This minimum oracle size can be considered as a measure of the difficulty of the problem P. The novelty and significance of the use of an oracle to model knowledge about the network is that it enables asking quantitative questions about the required knowledge, regardless of what kind of knowledge is supplied. This should be contrasted with the traditional approach that assumes availability of particular items of
3
information, such as the neighborhood of a node. It turns out that the minimum oracle size, for which a distributed task can be accomplished efficiently, can be used to make a quantitative distinction between the difficulty of apparently similar problems. We show this for two fundamental communication primitives performing information dissemination: the broadcast and the wakeup from a single source. In both of them a distinguished node, called the source, has a message which has to be transmitted to all other nodes of the network. Nodes send messages along edges of the network. In the wakeup, only nodes that already got the source message (i.e., are awake) can send messages to their neighbors, thus waking them up. In the broadcast, all nodes can send control messages even before getting the source message, thus potentially facilitating its future dissemination. In both cases we are interested in accomplishing the communication task with optimal message complexity, i.e., using a number of messages linear in the number of nodes. We ask what is the minimum size of an oracle permitting to do that.
1.3
Our results
We show that the minimum oracle size permitting the wakeup with a linear number of messages in a network with at most n nodes, is Θ(n log n), while the broadcast with a linear number of messages can be achieved with an oracle of size O(n). We also show that the latter oracle size is almost optimal: no oracle of size o(n) can permit to broadcast with a linear number of messages. Thus an efficient wakeup requires strictly more information about the network than an efficient broadcast. Our upper bounds are constructive: we show specific oracles of appropriate size and design wakeup and broadcast algorithms using them and accomplishing information dissemination with a linear number of messages. Apart from their tightness, our results have the following additional strength. Both upper bounds hold even for totally asynchronous communication, for anonymous nodes (no distinct labels), and using only bounded-size messages. On the other hand, both lower bounds hold even for synchronous communication, for labels of nodes 1,...,n, and for arbitrarily long messages.
4
1.4
Terminology and preliminaries
We now describe broadcast algorithms using oracles, in a more detailed manner. Wakeup algorithms will be a particular type of broadcast algorithms, subject to an additional constraint. Consider a network, i.e., a connected graph G = (V, E) with a distinguished source s. Every node v of degree deg(v) has a distinct label id(v), and ports at v are labeled 0, 1, ..., deg(v) − 1. The port at node v, corresponding to edge e, is denoted by portv (e). Every node v has also a bit s(v) called the status bit, which is set to 1 if the node v is the source, and to 0 otherwise. Fix an oracle O and let f = O(G) be a function f : V 7→ {0, 1}∗ , assigning binary strings to nodes of G. A broadcast algorithm A using oracle O is a function A : {0, 1}∗ × {0, 1} × IN × IN 7→ Σ, where IN denotes the set of non-negative integers and Σ denotes the set of broadcast schemes (to be defined below). For a given node v, algorithm A takes the quadruple (f (v), s(v), id(v), deg(v)) and returns a broadcast scheme Sv = A(f (v), s(v), id(v), deg(v)) for the node v. It remains to define what is such a scheme. Intuitively, this is a prescription whether and on which ports the node should send messages, and what messages, given a particular history of communication to date. Such a history (at node v) is a sequence H = (f (v), s(v), id(v), deg(v), (m1 , p1 ), (m2 , p2 ), . . . , (mk , pk )), where the prefix (f (v), s(v), id(v), deg(v)) is the knowledge of the node before the broadcast starts, and (m1 , m2 , . . . , mk ) are messages already received by v, where mi came to node v on port pi . Intuitively, the history describes the total knowledge of the node at a given point of the broadcast process. Given a history H at node v, a broadcast scheme Sv returns a set of couples {(m′1 , p′1 ), . . . (m′r , p′r )}, where 0 ≤ p′i < deg(v). This means that v should send message m′i on port p′i , for i ≤ r. At each point of the scheme execution some nodes are informed. Intuitively, these are nodes that already got the source message. In the beginning only the source is informed. A node becomes informed after receiving a message from an informed node (indeed, the source message can be appended to any such message). Broadcast is completed when all nodes of the network are informed. Wakeup algorithms using oracles produce wakeup schemes in a similar manner as above: a wakeup scheme for v is a broadcast scheme that does not send any messages (returns the empty set) on all histories with no messages, unless v is the source. Intuitively, nodes other than the source can spontaneously transmit in the broadcast but they cannot in the wakeup. The 5
message complexity of a broadcast or a wakeup scheme is the total number of messages that it produces.
2
Oracle size for the wakeup
In this section we show that the minimum oracle size permitting the wakeup with a linear number of messages is Θ(n log n). Establishing the upper bound is easy. Fix a network G, and let T be any spanning tree of G rooted at the source. The value f of oracle O on the network G is defined as follows. For any node v that is not a leaf of T , f (v) is a binary string coding those port numbers at v that lead to its children in T , and the string f (v) is empty if v is a leaf of T . Since port numbers are integers smaller than n, there exists such a string of length at most c(v)⌈log n⌉ + O(log log n), where c(v) is the number of children of v in T . (One way of constructing such an encoding string is this. Concatenate all binary representations of the c(v) port numbers that lead to the children of v in T , using exactly ⌈log n⌉ bits for each of them. Let the obtained sequence α have length x = c(v)⌈log n⌉. Construct another binary sequence β as follows. Let b1 . . . br be the binary representation of ⌈log n⌉. Let β = b1 b1 b2 b2 . . . br br 10. Finally, concatenate α with β. The obtained sequence has length x + O(log log n), and the original representations of the c(v) port numbers are easy to obtain from it.) Hence the size of the oracle is n log n + o(n log n). Given this oracle, the wakeup scheme at v tells the node to send messages on all ports coded by f (v). This scheme uses exactly n − 1 messages. Thus we have: Theorem 2.1 There exists an oracle of size O(n log n) permitting the wakeup with a linear number of messages of networks with at most n nodes. The main result of this section establishes a matching lower bound on oracle size for this task. Theorem 2.2 The minimum oracle size permitting the wakeup with a linear number of messages of networks with at most n nodes, must have size Ω(n log n). To prove this theorem, we use an auxiliary problem, called edge discovery, defined as follows. We denote by Kn∗ the n-node complete graph Kn whose vertices are labeled from 1 to n, and the port 6
number at node i of the edge leading to node j is labeled (i − j) mod (n − 1). The instances of the problem edge discovery are triples (n, X, Y ) where n is a positive integer, and X and Y are two disjoint subsets of edges of Kn∗ . In fact, the edges in X are given distinct labels between 1 and |X|. So formally, X = {(e1 , ℓ1 ), . . . , (e|X| , ℓ|X| )}, where ℓi is the label of ei . The problem consists in designing a communication scheme that, given n, |X|, and Y , eventually discovers X. Whenever an edge e is traversed by a message of the communication scheme, the following information is obtained: if (e, ℓ) ∈ X then (e, ℓ) is revealed; otherwise it is revealed that (e, ℓ) 6∈ X for any label ℓ. We prove the following lemma that will be used later as a key tool for proving our lower bounds. Lemma 2.1 Let I be a subset of instances of edge discovery, all yielding the same input for the problem (i.e., these instances differ only in the sets X, and all these sets X have the same size). |I| . The worst-case message complexity of edge discovery restricted to I is at least log |X|!
Proof. For any given instance (n, X, Y ) of edge discovery, the edges in X are called special. Let us consider any communication scheme S solving edge discovery for all instances in I. Messages traverse edges during the execution of S. At the beginning of the execution of the scheme, all instances in I are called active. When an edge is traversed, the scheme learns whether this edge is special or not. This knowledge enables to discard instances from the set of active instances. For example, if the traversed edge e is not special, then all currently active instances in which e is special can be discarded. Conversely, if the traversed edge e is special, then all currently active instances in which e is not special can be discarded. We describe an adversary that aims at slowing down the discovery of the special edges by S. We consider the synchronous execution of S. A set J ⊆ I of active instances, after t messages have been sent by S and r special edges have been discovered by S, for some t ≥ 0 and r ≥ 0, is said to be uniform if (1) the t first messages are sent by S through the same edges in all instances in J, and (2) the set of revealed couples (e, ℓ), for special edges e, is the same in all instances of J. If J is uniform, then the scheme S will proceed identically at the next step of its execution in all instances of J. That is, a message is sent through edge e and this edge is the same for all instances in J. The adversary considers uniform sets of active instances, and proceeds as follows. Let Jspecial (resp., Jregular ) be the set of instances in a uniform set J, for which e is special (resp., not special). If 7
|Jspecial | ≥ |Jregular | then the adversary decides that e is special, else it decides that e is not special. Note that |Jspecial | ≥ 12 |J| in the former case, and |Jregular | ≥
1 2 |J|
in the latter case. In case e
is set to be special by the adversary, the label ℓ(e) remains to be set. The adversary proceeds as follows. Since r special edges have been already discovered, the label of e can take |X| − r values. (l )
0 of active instances in Jspecial for which The adversary chooses the label l0 such that the set Jspecial
(l )
0 | ≥ ℓ(e) = l0 , has the largest size. Note that then |Jspecial
|J| 2(|X|−r) .
We say that Jregular is the
(l )
0 regular subset of J, and Jspecial is the special subset of J.
(l)
By construction, Jregular , as well as all Jspecial for 1 ≤ l ≤ |X|, are uniform. Hence, we can define recursively the following sequence of sets: I0,0 = I and It+1,r = the regular subset of It,r , if the (t + 1)th edge is set as not special; It+1,r+1 = the special subset of It,r , if the (t + 1)th edge is set as special.
By construction, depending on which of the cases holds, we have |It+1,r | ≥ |It,r |/2 or |It+1,r+1 | ≥ |It,r |/(2(|X| − r)). For the above defined adversary, let xt,r denote the number of active instances after t messages have been sent in S, and r special edges have been discovered. Thus, x0,0 = |I| and xt+1,r ≥
xt,r xt,r and xt+1,r+1 ≥ . 2 2(|X| − r)
Therefore, by simple induction on r and t, we get
xt,r ≥
x0,0 (|X| − r)! . 2t |X|!
As a consequence, xt,r ≥ x0,0 /(2t |X|!) for any r ≤ |X|. When the communication scheme S is completed, only one instance remains active, i.e., xt,r ≤ 1. By the previous inequality, our adversarial scenario guarantees that this cannot occur before t messages have been sent, where |I| , which completes the proof of x0,0 /(2t |X|!) ≤ 1. Since x0,0 = |I|, we conclude that t ≥ log |X|!
Lemma 2.1.
Proof of Theorem 2.2.
8
We first prove that, for any α < 1/2, there exists ǫ > 0 such that, for any integer n greater than some constant, there exists a (2n)-node graph for which no algorithm can perform wakeup with less than ǫ (2n) log(2n) messages, if the oracle size is not more than α (2n) log(2n). Fix a positive integer n. Recall that Kn∗ is the n-node complete graph with the following labeling. The nodes of Kn∗ are labeled from 1 to n. The port numbers of the edges are fixed as follows: for any 1 ≤ i, j ≤ n, the port number at i of the edge {i, j} is (i − j) mod (n − 1). For any n-tuple S = (e1 , e2 , . . . , en ) of distinct edges in Kn∗ , let Gn,S be the graph defined from Kn∗ as follows. For any 1 ≤ i ≤ n, a node wi labeled n + i is inserted in the middle of the edge ei = {ui , vi }. The port number at ui (resp. at vi ), of the edge {ui , wi } (resp. {vi , wi }), is the same as the port number at ui (resp. at vi ), of the former edge {ui , vi }. Assume, without loss of generality, that the label of ui is smaller than the label of vi . Then the port number at wi of the edge {ui , wi }, (resp. {vi , wi }), is 0 (resp. 1). Other port numbers remain unchanged. Let node with label 1 be the source. Intuitively, an oracle has to give a lot of information to help a wakeup algorithm to find the n subdivided edges with only O(n) messages. This is mainly due to the fact that there exists a lot of different graphs Gn,S . The graphs Gn,S are indeed distinct for different sets S. There are n P = n! (n2 ) such (labeled) graphs, as there are n2 edges in Kn∗ . Let us compute a lower bound
on P . First note that, for any a, b such that 1 ≤ b ≤ a, we have a a b . ≥ b b This implies
n 2
n
Moreover, we have
n 2
=
n(n+1) 2
≥
n 2
n
(1)
!n
≥ n2 /2. Hence P ≥ n!
9
n n 2
(2)
Consider an arbitrary wakeup algorithm using an oracle O. Assume that O has size at most q = α(2n) log(2n) on all graphs of size 2n, for some α < 1/2. We will prove that there are many graphs Gn,S for which the oracle has the same output. Let us first compute how many different functions f an oracle O of size at most q can output for (2n)-node graphs. Let v1 , . . . , v2n be the list of nodes of such a graph, in increasing order of their identifiers. Consider a function f = O(G). For any 1 ≤ i ≤ 2n, f (vi ) is the (possibly empty) string given by the oracle to the node vi in the graph G. Let s be the concatenation of the strings f (vi ) in increasing order of i. Let q ′ be the size of s. By definition of q, we have q ′ ≤ q. There are ′
2q possible different strings s for a given q ′ . Moreover, using standard combinatorial arguments, ′ +2n−1 one can show that there are q 2n−1 different ways to partition the q ′ bits of the string s into ′ +2n−1 ′ 2n (possibly empty) substrings f (vi ). To summarize, an oracle of size q ′ can output 2q q 2n−1
different functions for (2n)-node graphs. Since q ′ can be chosen between 0 and q, the oracle has exactly Q=
′ q X ′ q + 2n − 1 2q 2n − 1 ′
q =0
possible different outputs. ′ +2n−1 ′ is increasing as a function of q ′ , it Let us compute an upper bound on Q. Since 2q q 2n−1 . Note that q+2n−1 ≤ q+2n because q ≥ 0. Thus follows that Q is at most (q + 1) 2q q+2n−1 2n−1 2n 2n−1
we have
q
Q ≤ (q + 1) 2 Recall that q = α(2n) log(2n). Thus we have
q+2n 2n
q + 2n 2n
=
(3)
2n(1+α log(2n)) . 2n
Claim 2.1 There exist two positive integers A and B such that, for any a > A and any b > B, we have
a(1 + b) ≤ (6b)a a
The proof of the claim is in the Appendix.
10
Let N be a positive integer satisfying both 2N ≥ A and α log(2N ) ≥ B. Then, for any n > N , the number Q of possible outputs is at most (α (2n) log(2n) + 1) · 2α (2n) log(2n) · (6α log(2n))2n . Take β = 1/4 + α/2. We have α < β, and thus for n large enough, Q ≤ 22βn log(n/2) .
(4)
The oracle can output at most Q different functions for the P different graphs Gn,S . Therefore, there exists a function f such that the oracle will output f for a set G of at least P/Q different graphs Gn,S . For all these graphs, the wakeup scheme returned by the algorithm is the same. To any graph Gn,S ∈ G we can associate an instance (n, S, ∅) of the edge discovery problem, where the special edges of edge discovery are the subdivided edges of the graph Gn,S , and the label of a special edge is the rank of the subdivided edge in S. Let I be the set of instances of edge discovery obtained from all graphs in G. Clearly, I and G have the same cardinality. Performing wakeup in a graph Gn,S requires that, for any e ∈ S, at least one message be sent to the node hidden in the edge e. Moreover, this node has an identifier that corresponds to the position of e in S. Therefore, performing wakeup in a graph Gn,S requires at least the same number of messages as solving the edge discovery problem on the corresponding instance. Combining Equations 2 and 4, we get P/Q ≥ n! 2(1−2β)n log(n/2) . Since |I| ≥ P/Q, the application of Lemma 2.1 gives a worst-case message complexity of at least
log(
n! 2(1−2β)n log(n/2) ) = (1 − 2β)n log(n/2) n!
(5)
Since α < 1/2, we have β < 1/2 and thus the above message complexity is greater than ǫ (2n) log(2n) for n large enough, where ǫ is a positive constant not depending on n. We can now conclude the proof of the theorem. Assume that the theorem does not hold. Then there exists an infinite increasing sequence of integers (ni )i≥1 , an oracle of size less than 14 ni log ni
11
for the graphs with at most ni nodes, i ≥ 1, and an algorithm A using this oracle, such that the algorithm performs wakeup with a linear number of messages in any graph. Fix i ≥ 1. Let mi = ni if ni is even and mi = ni − 1 otherwise. For graphs of size at most mi , the oracle has size at most 1 4 ni log ni .
For i large enough, we have 41 ni log ni ≤ 13 mi log mi . Applying the previous result with
α = 1/3, there exists a positive constant ǫ such that A has a worst-case message complexity of at least ǫ mi log mi on mi -node graphs, for i large enough. Thus the message complexity of A is not linear. This contradiction concludes the proof of the theorem. Remark. In the above proof, we obtained a threshold 1/2 for α. Given an arbitrary constant integer c, a threshold
c c+1
can be obtained by subdividing cn edges instead of only n edges. Hence,
one can show that our upper bound n log n + o(n log n) on oracle size permitting wakeup with a linear number of messages in graphs with at most n nodes, is asymptotically optimal.
3
Oracle size for the broadcast
In this section we establish almost tight bounds on the minimum oracle size permitting the broadcast with a linear number of messages. In particular, the following upper bound, together with Theorem 2.2, shows that an efficient wakeup requires strictly more information about the network than an efficient broadcast. Theorem 3.1 There exists an oracle of size O(n) permitting the broadcast with a linear number of messages in networks with at most n nodes. Proof. We construct an oracle O and a broadcast algorithm A using it, which returns a broadcast scheme B with linear message complexity. We first describe the oracle O. Let G = (V, E) be any n-node network. Every edge e = {u, v} ∈ E is given the weight w(e) = min{portu (e), portv (e)}.
12
Let #2 (w) be the number of bits for encoding a non-negative integer w using standard binary representation, that is #2 (w) = 1 if w ≤ 1, and #2 (w) = ⌊log w⌋ + 1 if w > 1. Call the number #2 (w(e)) the contribution of the edge e. Claim 3.1 There exists a spanning tree T0 of G, for which
P
e∈E(T0 ) #2 (w(e))
≤ 4n.
We establish the claim by constructing a tree T0 that yields this contribution. The construction is a variant of Kruskal’s minimum-weight spanning tree (MST) algorithm (cf. [5]), similar to the one in [4]. It maintains a collection of trees. Initially, each node of G forms a tree on its own. The construction merges these trees into larger trees until it remains with a single tree giving the solution T0 . More precisely, the construction proceeds in phases. Each phase k ≥ 1 of the construction consists of four steps. At the beginning of the phase, we identify the collection of “small” trees for the phase: Tsmall (k) = {T : |T | < 2k }, where |T | denotes the size (number of nodes) of a tree T . Second, for each tree T ∈ Tsmall (k), we look at the set S(T ) of edges that connect T to G \ T , and select an edge e(T ) of minimum weight in S(T ). (Note that S(T ) 6= ∅ since the graph G is connected.) Third, we add these edges to the collection of trees, thus merging the trees into subgraphs. Each subgraph may contain a cycle, thus, finally, for the last of the four steps, in each subgraph we arbitrarily select one of the edges on the cycle and erase it, effectively transforming the subgraph back into a tree. This process is continued until a single tree remains, which is the desired tree T0 . To prove the claim, let us denote the collection of trees at the beginning of the kth phase, k ≥ 1, (k)
(k)
by T1 , . . . , Tqk , where qk is the number of trees maintained in phase k. We have q1 = n, and Pk (1) (k) |Ti | = 1 for any 1 ≤ i ≤ n. Moreover, qi=1 |T1 | = n for every k ≥ 1. By induction, we easily (k)
get that |Ti | ≥ 2k−1 for every k ≥ 1 and 1 ≤ i ≤ qk . Thus qk ≤ n/2k−1 for every k ≥ 1. In
particular, the number of phases of the construction is at most ⌈log n⌉. (k)
Assume that, when considering a small tree Ti (k)
some node x of Ti
(k)
in the kth phase, the edge e(Ti ) incident to
was selected. The only edges incident to node x excluded from consideration
(k)
(k)
are the at most |Ti | − 1 edges leading from x to the other nodes in Ti . Hence even if all of these (k)
edges are “lighter” than the edges leading outside the tree, the port number used for e(Ti ) is at
13
(k)
(k)
(k)
most |Ti | − 1, hence w(e(Ti )) ≤ |Ti | − 1. Therefore #2 (w(e(T (k) ))) = 1 i (k)
For Ti
if k = 1
#2 (w(e(T (k) ))) ≤ ⌊log(|T (k) | − 1)⌋ + 1 if k > 1 i i (k)
∈ Tsmall(k), we have log |Ti | < k. Since outgoing edges are selected only for small trees, (k)
we have #2 (w(e(Ti ))) ≤ k. Hence the total contribution Ck of the edges added to the structure throughout the kth phase satisfies Ck ≤ k |Tsmall (k)| ≤ k qk ≤ k n/2k−1 . Therefore, the total P P P contribution k≥1 Ck of all edges of the resulting tree T0 satisfies k≥1 Ck ≤ k≥1 kn/2k−1 ≤ 4n.
This completes the proof of Claim 3.1.
For every edge e = {u, v} ∈ E(T0 ), the oracle O assigns the binary representation of w(e) to the extremity x ∈ {u, v} such that w(e) = portx (e), where ties are broken arbitrarily. The same node may receive binary representations of several weights w(e1 ), . . . , w(et ), in which case they can P be encoded by one binary string of length 2 ti=1 #2 (w(ei )). In view of Claim 3.1, the size of the oracle is at most 8n.
Based on the strings assigned to the nodes of G by oracle O, Algorithm A constructs the broadcast scheme B defined in Figure 1. Claim 3.2 The scheme B has linear message complexity, and achieves broadcast in G. We establish the first part of the claim by combining the following properties. Clearly, the source message M as well as the “hello” messages are sent only through the n − 1 edges of T0 . The message M does not traverse an edge more than once because M is sent by x only through edges of Kx \ Sx , where Sx is the set of edges through which either M has been sent by x before, or M has been received by x. A “hello” message traverses an edge e of T0 in one direction only because only one extremity x of e is given the port number portx (e) by the oracle. The second part of the claim is established by induction on the distance d of a node from the source, in the tree T0 . Let P (d) be the property “all nodes at distance ≤ d from the source in T0 eventually receive the message M ”. P (0) clearly holds. Assume P (d) holds for d ≥ 0, and consider a node x at distance d + 1 from the source in T0 . Node x is a neighbor in T0 of a node 14
/* Broadcast Scheme B executed by node x. M is the source message. */ begin Kx ← list of port numbers given by the oracle O to x; /* Kx = incident edges known by x */ Hx ← Kx ; /* Hx = incident edges through which “hello” messages may be sent */ Sx ← ∅; /* Sx = incident edges through which the message M has transited */ repeat if x receives the message M via port p then Kx ← Kx ∪ {p}; Sx ← Sx ∪ {p}; if x receives the message M then send message M on all ports of Kx \ Sx ; Sx ← K x ; Hx ← Hx \ S x ; if Hx 6= ∅ then send “hello” messages on all ports of Hx ; Hx ← ∅; if x receives a “hello” message via port p ∈ / Kx then Kx ← Kx ∪ {p}; endrepeat end
Figure 1: Broadcast Scheme B y at distance d from the source in T0 . The edge e = {x, y} is eventually discovered by y because, by definition of the oracle O, either y is given porty (e), or x is given portx (e), and, in the latter case, x will eventually send a message “hello” to y, enabling e to be known by y. By the induction hypothesis, y will eventually receive the message M . Therefore the message will eventually be sent through e by y. Therefore P (d + 1) holds too, and hence B achieves broadcast.
Theorem 3.2 Any broadcast algorithm using an oracle of size o(n) in networks with at most n nodes, cannot return a broadcast scheme of linear message complexity. Proof. The proof uses a similar construction as for proving Theorem 2.2, but requires novel ideas, since the nodes can now transmit spontaneously. Recall that Kn∗ denotes the n-node complete graph Kn whose vertices are labeled from 1 to n, and the port number at node i of the edge leading to node j is labeled (i − j) mod (n − 1). For any k and n such that 4k divides n, and for any (n/k)-tuple S = (e1 , . . . , en/k ) of distinct edges of Kn∗ , let us consider the graphs obtained from Kn∗ by replacing edge ei by a clique Hi of size k, for i = 1, . . . , n/k. More precisely, one edge {ai , bi } of the clique Hi replacing ei is removed from Hi , and ai is connected to one extremity of 15
ei in Kn∗ , while bi is connected to the other extremity of ei in Kn∗ . Nodes of Hi are labeled from n + (i − 1)k + 1 to n + ik, for i = 1, . . . , n/k. The port number at node n + (i − 1)k + a of the edge leading to node n + (i − 1)k + b is labeled (a − b) mod (k − 1). By abuse of notation, the edge {n + (i − 1)k + a, n + (i − 1)k + b} is called the edge {a, b} of Hi . The set S does not fully specify the graph resulting from the above transformation because edges {ai , bi } are not yet specified. Let C=
n
o (a1 , b1 ), . . . , (an/k , bn/k ) | (ai , bi ) ∈ {1, . . . , k}2 , ai < bi , i = 1, . . . , n/k .
Any C ∈ C (together with the set S) fully characterizes the graph as follows. For any edge ei in S, i = 1, . . . , n/k, let ei = {ui , vi }, where id(ui ) < id(vi ). The edge ei of Kn∗ and the edge fi = {ai , bi } of Hi are replaced by the edges {ai , ui } and {bi , vi }. The port number at ui (resp., vi ) of the edge {ai , ui } (resp., {bi , vi }) is the same as the port number at ui (resp., vi ) of the edge ei . Similarly, the port number at ai (resp., bi ) of the edge {ai , ui } (resp., {bi , vi }) is the same as the port number at ai (resp., bi ) of the edge fi . The resulting graph is denoted by Gn,S,C . Let the node with label 1 be the source. For any pair of positive integers (n, k) such that 4k divides n, the family of graphs defined as above is denoted by Gn,k . In other words, we have Gn,k = {Gn,S,C | S is an (n/k)-tuple of edges of Kn∗ , C ∈ C }. Note that, by construction, every graph in Gn,k has 2n nodes, and in each such graph, all nodes with labels larger than n (i.e., those in the added cliques) have degree k − 1. Claim 3.3 For n and k large enough, such that k ≤ algorithm using an oracle of size at most
n 2k ,
√ log n and 4k divides n, any broadcast
for all graphs in Gn,k , cannot return a broadcast
scheme with message complexity less than n(k − 1)/8. To establish the claim, let us assume, for the purpose of contradiction, that there exists a broadcast algorithm A using an oracle O of size at most
n 2k ,
for all graphs in Gn,k , which produces
a broadcast scheme of message complexity less than n(k − 1)/8. Let σi be the sum of numbers of n/k
bits given by the oracle O to the nodes of Hi . Since Σi=1 σi ≤ 16
n 2k ,
we get that at least half of the
cliques do not receive any bit of information. On the other hand, if
A(∅, 0, n + (i − 1)k + a, k − 1) is not defined for some pair (i, a), where 1 ≤ i ≤ n/k and 1 ≤ a ≤ k, then at least one node of Hi requires some information from the oracle to specify its broadcast scheme, and thus the clique Hi must receive at least one bit of information. Such an index i is called heavy. Let i ∈ {1, . . . , n/k} be a non heavy index (i.e., i is such that A(∅, 0, n + (i − 1)k + a, k − 1) is defined for all a = 1, . . . , k), and let us observe the behavior of the communication scheme produced by A in the clique Hi , when the oracle gives no information to the nodes of Hi . If in the synchronous execution of the scheme, all edges of Hi are eventually traversed by at least one message, then i is called internal. Otherwise, i.e., if the communication scheme leaves at least one edge of Hi not traversed by any message in the synchronous execution of the scheme, then i is called external. External indices result from the fact that the scheme exchanges messages but lets always one edge free of message, or result from the fact that the execution of the scheme reaches a point at which the action of a node is not defined (the history of the execution cannot be produced by the broadcast scheme returned by A). For every internal index i, let us consider the synchronous execution of the scheme, and let fi = {ai , bi } be an edge of Hi that is traversed last. For every external index i, let us again consider the synchronous execution of the scheme, and let fi be any edge of Hi that is not traversed by any message. Finally, for every heavy index i, let fi be any edge of Hi . This setting of the fi ’s defines one (n/k)-tuple from C, denoted by C ∗ . We will now restrict attention to those graphs in Gn,k , for which S takes all possible values of (n/k)-tuples of edges of Kn∗ , but C = C ∗ . Fix S and consider Gn,S,C ∗ . As observed before, at least half of the cliques in Gn,S,C ∗ receive no information from the oracle. Let I be the corresponding set of indices. We have |I| ≥ n/(2k). Indices in I are either internal or external because cliques with heavy indices must receive at least one bit of information from the oracle. Hence I can be decomposed into two sets Iint and Iext that are subsets of internal and external indices, respectively, and such that I = Iint ∪Iext . For all cliques Hi with i ∈ Iext , the setting of the fi ’s implies that the broadcast scheme generated by A has the property that, in its synchronous execution, no message goes out of Hi before a message goes into 17
Hi from the rest of the graph. Among all cliques Hi with i ∈ Iint , some may have the property that, in the synchronous execution of the broadcast scheme, a message goes out of Hi before any + message goes into Hi from the rest of the graph. Let Iint be the indices from Iint , for which this + , the message complexity of the phenomenon occurs. By the setting of the fi ’s, for every i ∈ Iint
broadcast scheme restricted to Hi is at least k(k − 1)/2 since fi is one of the edges traversed last. Therefore, since the broadcast scheme generated by A has message complexity less than n(k − 1)/8, + |< we get that |Iint
n 4k .
+ |≥ Thus, |I \ Iint
n 4k .
This inequality implies that the number of cliques Hi
such that, in the synchronous execution of the broadcast scheme, no message goes out of Hi before a message goes into Hi from the rest of the graph, is at least In other words, at least
n 4k
n 4k .
cliques have to be discovered from the outside, and at most
3n 4k
can reveal themselves spontaneously to the rest of the graph. Therefore, the broadcast problem in Gn,S,C ∗ is at least as hard as the auxiliary problem edge discovery with instances (n, X, Y ) satisfying |X| =
n 4k
3n 4k .
and |Y | =
For n, |X|, and Y fixed, there are |X|!
n 2
− |Y | |X|
different instances of edge discovery. Hence, for |X| =
n 4k
and |Y | =
3n 4k ,
the number of different
instances P = |X|! P ′ satisfies ′
P =
n 2
−
n 4k
3n 4k
≥
n 2
−
n 4k
3n 4k
!n
n2 4
4k
≥
−
n 4k
3n 4k
!n
4k
≥ (nk − 3)
n 4k
≥
nk 2
n
4k
(6)
where the first inequality follows from Equation 1. On the other hand, let Q be the number of possible functions output by an oracle of size at most q for the graphs of Gn,k . By the same calculations as for deriving Equation 3, we get q
Q ≤ (q + 1)2 By Claim 2.1, we have
2n + n 2k
n 2k
=
n
2k (1
+ 4k)
n 2k
18
2n + q . q
n
≤ (24k) 2k
for n and k large enough. Thus, since
n 2k
+ 1 < nk , we get that if q ≤
Q≤
n 2k
then
n n n 2 2k (24k) 2k . k
Therefore, for n and k large enough, n
Q ≤ (50k) 2k .
(7)
There exists a set of graphs of size at least P/Q for which the oracle returns the same function. Combining Equations 6 and 7, we conclude that there exists a set of graphs of size at least
|X|!
n n 4k 5000 k
for which the oracle returns the same function. Applying Lemma 2.1 to this set of graphs, we get √ n n log( 5000 that the number of exchanged messages is at least 4k log n, and for n and k ). For k ≤ k large enough, this number is at least n(k − 1)/8, a contradiction with the hypothesis that A produces a broadcast scheme of message complexity less than n(k − 1)/8. This completes the proof of Claim 3.3. To complete the proof of the theorem, let us consider a broadcast algorithm A using an oracle O of size f (n) in networks of at most n nodes, where f (n) is in o(n). Let fb be the function defined
n by fb(n) = max{f (n), √log }. Hence A uses an oracle O of size at most fb(n) in networks of at n ′ most n nodes. For any n ≥ 1, let k(n) = n/fb(n), and let k′ (n) = ⌊ k(n) 4 ⌋. Let n be the largest
integer smaller or equal to n and divisible by 4k′ (n). Note that, since n/k′ (n) grows to infinity, we have n′ ≥ n/2, for n large enough. The oracle O has size at most fb(n) in networks with at most n′
nodes. We have
fb(n) =
2n′ n′ n ≤ ≤ . k(n) k(n) 2 k′ (n)
′
Therefore, O has size at most 2 kn′ (n) in networks with at most n′ nodes. By the construction of √ fb, we get k′ (n) ≤ log n′ . Hence Claim 3.3 applies, and we conclude that the broadcast scheme
returned by A on graphs with at most n′ nodes has message complexity at least n′ (k′ (n) − 1)/8,
which is not in O(n′ ). Therefore, any broadcast algorithm A using an oracle O of size f (n) in 19
networks with at most n nodes, where f (n) is in o(n), returns a broadcast scheme that does not have a linear message complexity.
4
Conclusion
We investigated oracles: a new way of modeling knowledge that nodes have about the network. We showed that the minimum oracle size for which a task can be accomplished efficiently, can serve as a measure of difficulty of this task, and can be used to quantitatively differentiate the difficulty of related tasks. In this paper we concentrated on two similar communication tasks, broadcast and wakeup with a linear number of messages, and used oracle size to strictly separate their difficulty. However, we conjecture that oracles can be also used to assess difficulty of a broader range of distributed network problems, not only concerning information dissemination but also, e.g., spanner construction or exploration by mobile agents. Moreover, oracles could be potentially used to establish precise tradeoffs between the amount of knowledge available to nodes of a network and the efficiency (in terms of time or message complexity) of accomplishing a given task.
References [1] B. Awerbuch, O. Goldreich, D. Peleg and R. Vainish, A trade-off between information and communication in broadcast protocols, Journal of the ACM 37 (1990), 238-256. [2] M.A. Bender, A. Fernandez, D. Ron, A. Sahai and S. Vadhan, The power of a pebble: Exploring and mapping directed graphs, Information and Computation 176 (2002), 1-21. [3] A.E.F. Clementi, A. Monti and R. Silvestri, Selective families, superimposed codes, and broadcasting on unknown radio networks, Proc. 12th Ann. ACM-SIAM Symposium on Discrete Algorithms (SODA 2001), 709-718. [4] R. Cohen, P. Fraigniaud, D. Ilcinkas, A. Korman and D. Peleg. Labeling Schemes for Tree Representation. Proc. of 7th International Workshop on Distributed Computing (IWDC 2005), LNCS 3741, 13-24. 20
[5] T.H. Cormen, C.E. Leiserson, and R.L. Rivest. Introduction to Algorithms. MIT Press, McGraw-Hill, 1990. [6] A. Czumaj and W. Rytter, Broadcasting algorithms in radio networks with unknown topology, Proc. 44th Ann. Symposium on Foundations of Computer Science (FOCS 2003), 492-501. [7] A. Dessmark and A. Pelc, Optimal graph exploration without good maps, Theoretical Computer Science 326 (2004), 343-362. [8] F. Fich and E. Ruppert. Hundreds of impossibility results for distributed computing, Distributed Computing, 16 (2003), 121-163. [9] L. Gasieniec, D. Peleg and Q. Xin, Faster communication in known topology radio networks, Proc. 24th Annual ACM Symposium on Principles of Distributed Computing (PODC 2005), 129-137. [10] T. Kameda and M. Yamashita. Computing on anonymous networks: Part I – characterizing the solvable cases. IEEE Transactions on Parallel and Distributed Systems, 7 (1996), 69-89. [11] D. Kowalski and A. Pelc, Optimal deterministic broadcasting in known topology radio networks, manuscript. [12] N. Lynch. A hundred impossibility proofs for distributed computing. Proc. 8th Ann. ACM Symposium on Principles of Distributed Computing (PODC 1989),1-28.
21
APPENDIX Proof of Claim 2.1 First recall the Stirling formula: n! ∼
√
2πn
n n e
From the definition of equivalence, there exists an integer N0 such that, for any n > N0 , we have n n n n √ 1√ 2πn ≤ n! ≤ 2 2πn 2 e e We use these inequalities to bound
a(1 + b) a
= ≤ ≤ ≤
The function 1 +
a(1+b) , a
for a > N0 :
a(b + 1) ! a! (ab)! s 1 a(b + 1) · 2 2π a (ab) s 1 1 1+ 2 2π a s 1 1 1+ 2 2π a
a(b+1) a(b + 1) aa (ab)ab 1 (b + 1)a(b+1) b bab !a 1 b 1 a 1+ (b + 1) b b
1 b b
converges to e, when b grows. Therefore there exists a positive constant B b such that for any b > B we have 1 + 1b ≤ 3. Consequently s a(1 + b) 1 1 1 1+ (b + 1)a · 3a ≤ 2 2π a b a
Since we also have b > 1, we obtain
r a(1 + b) 1 1 ≤ (6b)a ≤ (6b)a a 2 πa
which concludes the proof of the claim.
22