A Faster Counting Protocol for Anonymous Dynamic Networks
aa r X i v : . [ c s . D C ] S e p A Faster Counting Protocol for Anonymous Dynamic Networks
Alessia Milani and Miguel A. Mosteiro LABRI, University of Bordeaux, INP, France [email protected] Department of Computer Science, Kean University, USA [email protected]
Abstract.
We study the problem of counting the number of nodes in a slotted-time communication network, underthe challenging assumption that nodes do not have identifiers and the network topology changes frequently. That is,for each time slot links among nodes can change arbitrarily provided that the network is always connected.This network model has been motivated by the ongoing development of new communication technologies that en-able the deployment of a massive number of devices with highly dynamic connectivity patterns. Tolerating dynamictopologies is clearly crucial in face of mobility and unreliable communication. Current communication networksdo have node identifiers though. Nevertheless, even if identifiers may be still available in future massive networks,it might be convenient to ignore them if neighboring nodes change all the time. Consequently, knowing what isthe cost of anonymity is of paramount importance to understand what is feasible or not for future generations ofDynamic Networks.Counting is a fundamental task in distributed computing since knowing the size of the system often facilitates thedesing of solutions for more complex problems. Also, the size of the system is usually used to decide terminationin distributed algorithms. Currently, the best upper bound proved on the running time to compute the exact networksize is double-exponential. However, only linear complexity lower bounds are known, leaving open the question ofwhether efficient Counting protocols for Anonymous Dynamic Networks exist or not.In this paper we make a significant step towards answering this question by presenting a distributed Countingprotocol for Anonymous Dynamic Networks which has exponential time complexity. Our algorithm ensures thateventually every node knows the exact size of the system and stops executing the algorithm. Previous Countingprotocols have either double-exponential time complexity, or they are exponential but do not terminate, or terminatebut do not provide running-time guarantees, or guarantee only an exponential upper bound on the network size.Other protocols are heuristic and do not guarantee the correct count.
We study the problem of
Counting the number of nodes in a communication network, under the challengingassumption that nodes do not have identifiers (IDs) and the network topology changes frequently. We con-sider broadcast networks in slotted-time scenarios. That is, in any given time slot, a message sent by a givennode is received by all nodes directly connected to it ( one-hop neighbors ). Worst-case topology changesare modeled assuming the presence of an adversary that, for each time slot, chooses the set of links amongnodes. The choice is arbitrary as long as, in each time slot, the network is connected. This dynamic topologymodel, called , was introduced in [11] for Dynamic Networks where each node has aunique identifier.The network model described, called
Anonymous Dynamic Network , has attracted a lot of attentionrecently [4–6, 12]. The model has been motivated by the ongoing development of new communication tech-nologies that enable the deployment of a massive number of devices with highly dynamic connectivitypatterns. Tolerating dynamic topologies is clearly crucial in face of mobility and unreliable communication.Current communication networks do have node IDs (or otherwise a labeling is defined at startup). Never-theless, in future massive networks, it might be suitable to avoid nodes IDs to facilitate mass production.Or, even if IDs are still available it might be convenient to ignore them under highly dynamic conditionshere neighboring nodes change all the time. Consequently, knowing what is the cost of anonymity is ofparamount importance to understand what is feasible or not for future generations of Dynamic Networks.Counting is a fundamental distributed computing problem since knowing the size of the system facili-tates the solution of more complex problems. Also this parameter is usually used to ensure the terminationof the algorithm.Counting can be solved in Anonymous Dynamic Networks, but the best known upper bound on the timecomplexity is double-exponential [4]. A double-exponential running time precludes the application of suchalgorithm to networks of significant size, but only linear lower bounds are known. Such a large gap leavesopen the question of whether practical protocols exist or not.The protocol presented in this paper makes a significant step towards answering the latter question,reducing the time complexity for exact
Counting to exponential. Our algorithm ensures that there is a timeslot when all nodes know the exact size of the system and they stop executing the algorithm. All nodes stopat the same round and this is known by every node. Thus it is easy to concatenate another algorithm whichuses the system size.Previous Counting protocols for Anonymous Dynamic Networks have either double-exponential timecomplexity [4], or they are exponential but do not terminate [4], or terminate but do not provide running-time guarantees [5], or guarantee only an exponential upper bound on the network size [12]. Other protocolsare heuristic and do not guarantee the correct count [6].All current Counting protocols for Anonymous Dynamic Networks [4–6, 12] assume the presence ofone distinguished node, usually called leader , and additionally use some knowledge of the number of neigh-bors of each node, called degree . In our model, we include both assumptions. Namely, the presence of aleader node, and an upper bound on the maximum degree of the adversarial topology which is known by allnodes. While these assumptions may seem too strong it was proved in [12] that Counting is not solvable inAnonymous Networks without the presence of a leader , even if the topology does not change. In the samework, it was conjectured that any non-trivial computation is impossible without knowledge of some networkcharacteristics.Our algorithm is inspired by the algorithm presented by Di Luna et al. in [4], which starts computingan upper bound on the network size using the algorithm presented in [12]. Then, it verifies each candidatesize down to the correct size. To verify each candidate size, an energy-transfer approach is used. Namely,each non-leader node is initially assigned a unit of energy which is shared evenly with neighbors in eachcommunication round, except for the leader that works as a sink. This energy-transfer protocol is a back-wards version of mass-distribution and gossip-based algorithms [1, 9, 10] used to compute the size in othernetwork models. The unit mass initially held in only one node in the latter system is shared throughout thenetwork, converging to the average which is the inverse of the size. The energy-transfer protocol is shownto be at most exponential in the candidate size which in turn is exponential in the worst case, yielding adouble-exponential Counting protocol.The protocol presented here leverages the above idea of verifying candidate sizes using an energy-transfer protocol, but rather than starting with an upper bound, it follows a bottom-up approach. That is, itverifies , , . . . , etc. up to the actual size. A carefully chosen energy threshold to decide when the count isaccurate yields an exponential speedup in the worst-case running-time guarantees. The running time provedalso identifies the collection of energy at the leader as the speedup bottleneck for gossip-based Counting,given that all other factors in the time complexity obtained are polynomial. In contrast, in the running timeof other exact Counting protocols that terminate, all factors are exponential or double exponential [4], or therunning time is not proved [5]. 2 ontributions In the following we summarize the main contributions of our work. – Following-up on the Conscious Counting protocol of [4], we present an improved Counting protocol forAnonymous Dynamic Networks that computes the exact number of nodes in less than (2 ∆ ) n +1 ( n +1) ln( n + 1) / ln(2 ∆ ) communication rounds, where n is the number of nodes and ∆ is any upper boundon the maximum number of neighbors that any node will ever have. Our algorithm tolerates worst-casechanges of topology, limited to 1-interval connectivity. The protocol requires the presence of one leadernode and knowledge of ∆ . – The running time of our protocol entails an exponential speedup over the previous best Counting al-gorithm in [4], which was proved to run in O ( e ( ∆ n ) ∆ n ) communication rounds, which is double-exponential. The speedup attained is mainly due to a carefully chosen energy threshold used to verifycandidate sizes that are not bigger than the actual size. Our analysis shows the correctness of such veri-fication. – The time complexity proved identifies the phase where the leader collects energy from all other nodes asthe speedup bottleneck for Counting with gossip-based protocols. Indeed, the exponential cost is due tothis collection, whereas all other terms in the time complexity are polynomial. In contrast, in the runningtime of [4] all terms are exponential or double exponential.
Roadmap
The rest of the paper is organized as follows. In Section 2 we briefly overview previous work directly relatedto this paper. After formally defining the model and the problem in Section 3, we present our Countingprotocol in Section 4 and its analysis in Section 5.
The following is an overview of previous work on Counting in Anonymous Dynamic Networks directlyrelated to this paper. Other related work may be found in a survey on Dynamic Networks and Time-varyingGraphs by Casteigts et al. [2], and in the papers cited below.Worst-case topology changes in Dynamic Networks may be limited assuming that the network is alwaysconnected (cf. [4,11,12,14]), or sometimes disconnected but for some limited time (cf. [7,8,13,15]). The T -interval connectivity model was introduced in [11]. For T ≥ , a network is said to be T -interval connectedif for every T consecutive rounds the network topology contains a stable connected subgraph spanning allnodes. In the same paper, a Counting protocol was presented, but it requires each node to have a uniqueidentifier. In [11] it is also proved that, if no restriction on the size of the messages is required, the countingproblem can be easily solved in O ( n ) time when nodes have IDs. In our work, we focus on Anonymous
Dynamic Networks. Understanding if a linear counting algorithm exists also when IDs are not available willhelp to understand the difficulty introduced by anonymity (if any).A Counting protocol for Anonymous Dynamic Networks where an upper bound ∆ on the maximumdegree is known was presented in [12]. The adversarial topology is limited only to 1-interval connectivity,but the algorithm obtains only an upper bound on the size of the network n , which in the worst case isexponential, namely O ( ∆ n ) . In our work, we aim to obtain an exact count, rather than only an upper bound.The Conscious Counting algorithm presented later in [4] does obtain the exact count for the same net-work model, but requires knowledge of an initial upper bound K on the size of the network. Conscious3ounting would be exponential if such upper bound were tight, since it runs in O ( e K K ) communicationrounds. However, K is obtained using the algorithm in [12] mentioned above. Consequently, in the worstcase the overall running time of the Conscious Counting Algorithm is O ( e ( ∆ n ) ∆ n ) , which is double-exponential. In our work, we obtain the exact count in exponential time. That is, we reduce exponentiallythe best known upper bound for exact Counting.Anonymous Dynamic Networks where an upper bound on the maximum degree is not known where alsostudied [4–6]. In [4], the protocol does not have a termination condition. That is, nodes running the protocoldo not know whether the correct count has been reached or not. Hence, they have to continue running theprotocol forever. In a companion paper [6], the authors stop the protocol heuristically. Hence, the countobtained is not guaranteed to be correct. Indeed, errors appear when the conductance of the underlyingconnectivity graph is low. In our work, we aim for Counting algorithms that terminate returning always thecorrect count. The protocol in [5] is shown to eventually terminate, although the running time is not proved.In their model, it is assumed that each node is equipped with an oracle that provides an estimation of itsdegree at each round. This is still an assumption of knowledge of network characteristics, although local.This and the above shortcomings are not unexpected in light of the conjecture in [12], which states thatCounting (actually, any non-trivial computations) in Anonymous Dynamic Networks without knowledge ofsome network characteristics is impossible. Nevertheless, a proof of such conjecture has not been found yet.Known lower bounds for Counting in Anonymous Dynamic Networks include only the trivial Ω ( D ) ,where D is the dynamic diameter of the network, and Ω (log n ) even if D is constant, proved in [3]. An algorithm is said to solve the
Counting problem if whenever it is executed in a Dynamic Networkcomprising n nodes, all nodes eventually terminate and output n . We consider a synchronous Dynamic Network composed of a fixed set of nodes V where | V | = n . Nodeshave no identifiers (IDs) or labels. We also assume the presence of a special node called the leader anddenoted ℓ .Nodes communicate by broadcast. In particular, communication proceeds in synchronous rounds . Ateach round a node broadcasts a message to its neighbors and simultaneously receives the messages broadcastin the same round by its neighbors (if any), then it makes some local computation. The time of computationis negligible. Thus, we compute the time complexity in rounds of communication.At each round the set of communication links changes adversarially. Thus, the network is modeled as adynamic graph G = ( V, E ) where E : N → { ( u, v ) s.t. ( u, v ) ∈ V } is a function mapping a round number r to a set of undirected edges E ( r ) . In particular, we consider the following -interval connectivity modelproposed by Kuhn et al. in [11]. Definition 1.
A dynamic graph G = ( V, E ) is 1-interval connected if for all r ∈ N , the static graph G r := ( V, E ( r )) is connected. Throughout the paper, log means logarithm base , unless otherwise stated. ∆ > atevery round, and we assume that ∆ is known by the nodes.At a first glance, some knowledge of the degree seems unnecessary because, after one message fromeach neighbor has been received in a given round, the degree is simply the message count. However, forthe next round of communication, the degree may change due to changing topology. Thus, a node does notknow its current degree before sending messages to its neighbors. The algorithm consists of a sequence of iterations. In each iteration, a candidate size is checked to decide ifit is correct. If not, the candidate size is increased and a new iteration starts. In the following, we provide ahigh level explanation of the algorithm executed in each iteration.At the beginning of each iteration every node is assigned energy value , except for the leader whichhas energy. Then, the iteration proceeds in three consecutive phases described below. Each phase lasts afixed amount of rounds which only depends on the current estimation of the system size. This is intended tosynchronize the computation at all the nodes in the system without extra communication.During the first phase, called the Collection Phase , each node discharges itself by sending at each rounda fraction at most half of its current energy to its neighbors. Then it computes its new energy by takinginto account the energy given to its neighbors and the energy received from them. The leader acts as a sinkcollecting energy but not disseminating it. This phase completes when the leader has received an amountof energy such that, if the candidate size for the current iteration is the correct system size n , there is nonode in the system with more than /k c residual energy, for some constant c > . The function τ ( k ) inAlgorithms 1 and 2 gives the number of iterations of the Collection Phase needed to guarantee this. Anexponential upper bound on τ ( k ) is computed in Corollary 1. However, the bound may not be tight, so τ ( k ) is left as a parameter in the protocol. Should a better bound on τ ( k ) be proved, the protocol can be used asis. Then, the Verification Phase starts. During this phase, the energy at each node does not change and theleader verifies the correctness of the current candidate size looking for a node with residual energy greaterthan /k c . To this aim at each round of the Verification phase each non leader node broadcasts the maximalenergy it has “heard” during this phase. At the beginning each such node broadcasts its own residual energy.This phase lasts sufficiently long to ensure that if a node with residual energy greater than /k c exists, thenthe leader will hear from it. If the leader does not hear from such node, it knows that the candidate size wasindeed correct, and the verification phase completes successfully.The last phase, called Notification Phase , is used by the leader when the verification phase completessuccessfully. To notify such event, the leader broadcasts a special h Halt i message, and each node in turnbroadcasts it as soon as it is received and as long as the Notification Phase is not completed. If the VerificationPhase completes unsuccessfully, the leader and every other node simply wait for the same number of roundsof communication without taking any action, and then all the nodes start a new iteration. This procedureensures synchronism. A node stops executing the algorithm at the end of the Notification phase if it hasreceived the h Halt i message. At this time every node knows the exact size of the system.The protocol for the leader and non-leader nodes is detailed in Algorithms 1 and 2. PseudoCodeVariables at the leader node. lgorithm 1: Algorithm of the leader node. k ← halt ← false while ¬ halt do k ← k + 1 IsCorrect ← true e ℓ ← // Collection Phase for each of τ ( k ) communication rounds do receive e , e , . . . e s from neighbors, where ≤ s ≤ ∆ e ℓ ← e ℓ + e + e + . . . + e s // Verification Phase for each of l k − /k c m communication rounds do receive e , e , . . . e s from neighbors, where ≤ s ≤ ∆ if k − − /k c ≤ e ℓ ≤ k − then for j := 1 . . . s do if e j > /k c then IsCorrect ← false else IsCorrect ← false // Notification Phase for each of k communication rounds do if IsCorrect then broadcast h Halt i halt ← true else do nothing output k – e ℓ is the energy of the leader at the current round. It is initialized to at the beginning of each iteration. – k is the estimation of the system size. Initially equal to 1 and increased by one in each iteration. – /k c is a threshold value for the energy such that, for a given estimate k , if k is the correct size of thesystem, after the Collection Phase no node has energy greater than /k c for some constant c > . – IsCorrect , initially true is set to f alse if the leader discovers that its estimate k is wrong. This happensif the value of e ℓ > k − at the end of the Collection phase or if during the Verification phase the leaderdiscovers a node with energy greater than /k c . – halt , initially f alse is set to true when the leader verifies that k is the correct size of the system. Variables at non leader nodes.– e is the energy of the node at the current round. It is initialized to at the beginning of each iteration. – k is the estimation of the system size. Initially equal to 1 and increased by one in each iteration. – e max , is the maximum energy the node is aware of at the current round of the Verification Phase. – halt , initially f alse , is set to true when the node receives a h Halt i message.6 lgorithm 2: Algorithm of non-leader nodes. k ← halt ← false while ¬ halt do k ← k + 1 e ← // Collection Phase for each of τ ( k ) communication rounds do broadcast h e ∆ i and receive e , e , . . . e s from neighbors, where ≤ s ≤ ∆ e ← e · (1 − ∆ ) + P sj =1 e j // Verification Phase e max ← e for each of l k − /k c m communication rounds do broadcast h e max i and receive e , e , . . . e s from neighbors, where ≤ s ≤ ∆ for j := 1 . . . s do if e j > e max then e max ← e j // Notification Phase for each of k communication rounds do if halt then broadcast h Halt i if receive h Halt i from some neighbor then halt ← true output k The following notation will be used. The energy of node i at the beginning of round r , is denoted as e ri ,which is also generalized to any set of nodes S ⊆ V as e rS = P i ∈ S e ri . For any given round r and node i , letthe set of neighbors of i be N ri and the average energy of i ’s neighbors be e N ri . The superindex indicatingthe round number will be omitted when clear from context or irrelevant. Also, at any time, let P i ∈ V e i becalled the system energy and P i ∈ V \{ ℓ } e i be called the energy left . At the beginning of each iteration ofthe protocol, that is, for each new size estimate k , the energy of the leader is reset to zero and the energyof the non-leader nodes is reset to . Thus, the system energy is P i ∈ V e i = n − and the energy left is P i ∈ V \{ ℓ } e i = n − . Lemma 1.
For any network of n nodes, including a leader ℓ , running the Counting Protocol under thecommunication and connectivity models defined the following holds. For any given node i ∈ V \ { ℓ } andfor any given round r of the Collection Phase, it is e ri ≤ .Proof. Fix some arbitrary (non-leader) node i . Consider the transition between round r and r + 1 . We havethat e r +1 i ≤ e ri + e N ri | N ri | ∆ − e ri | N ri | ∆ = e ri + ( e N ri − e ri ) | N ri | ∆ . e N ri ≤ e ri , then e r +1 i ≤ e ri . That is, i ’s energy does not increase from round r to round r + 1 . If on theother hand it is e N ri > e ri , we have e r +1 i ≤ e ri + ( e N ri − e ri ) / e ri + e N ri ) / . That is, the energy of i in round r + 1 is at most the average between the energy of i in round r and theaverage of i ’s neighbors’ energy in round r .Now consider the evolution of the protocol along many rounds. We ignore the rounds when e N ri ≤ e ri since they do not increase the energy. For the other rounds, given that all nodes start with energy , and thatthe average of some numbers cannot be bigger than the maximum, the energy at any given node cannot getbigger than . Hence, the claim follows. Lemma 2.
For any network of n nodes, under the communication and connectivity models defined, thefollowing holds. If a message m is held by all nodes in a set V ⊆ V , after | V | − | V | rounds when everynode holding the message broadcasts m in each round, all nodes in V hold the message.Proof. For any round r > , consider the partition of nodes { V r , V r } defined by the nodes holding themessage at the beginning of round r . That is, ∀ i ∈ V r the node i holds m and ∀ j ∈ V r the node j does nothold m . By 1-interval connectivity, there must exist a link u, v , such that u ∈ V r and v ∈ V r . Given that allnodes holding the message broadcast m , v must receive the message in round r . Thus, at the beginning ofround r + 1 it is | V r +11 | ≥ | V r | + 1 and | V r +12 | ≤ | V r | − . Applying the same argument inductively, after | V r +12 | more rounds all nodes hold the message.The following lemma is a straightforward application of Lemma 2 to the Notification Phase, where themessage broadcasted is h Halt i for the first time when k = n . Lemma 3. Correctness of the Notification Phase:
For any network of n nodes, including a leader ℓ ,running the Counting Protocol under the communication and connectivity models defined the followingholds. If at the end of the Verification Phase IsCorrect = true , then at the end of the Notification Phaseall nodes stop the Counting Protocol holding the size n . Lemma 4. Correctness of the Verification Phase:
For any network of n > nodes, including a leader ℓ , running the Counting Protocol under the communication and connectivity models defined the followingholds. For any estimate of the size of the network k and constant c > , at the end of the Verification Phase IsCorrect = true if and only if k = n .Proof. We start observing that, for each estimate k , each non-leader node is initialized with one unit ofenergy (Line 5 in Algorithm 2) and the leader’s energy is initialized to (Line 6 in Algorithm 1). Until anew iteration of the outer loop (in both algorithms) is executed, no energy is lost or gained by the system asa whole. Hence, the system energy is always n − .We prove first that, if k = n , at the end of the Verification Phase it is IsCorrect = true . Given that k = n , the system energy is k − and therefore e ℓ ≤ k − . Also because k = n , we know that after theCollection Phase it is e ℓ ≥ k − − /k c by definition of τ ( k ) . Therefore, IsCorrect is not set to falsein Line 17 of Algorithm 1. Also because e ℓ ≥ k − − /k c at the end of the Collection Phase, we knowthat the energy left at the beginning of the Verification Phase is e V \{ ℓ } = k − − e ℓ ≤ /k c . Therefore,no non-leader node could have more than that energy. That is, ∀ i ∈ V \ { ℓ } : e i ≤ /k c . Thus, duringthe Verification Phase, the leader will not be able to detect a node with energy bigger than /k c . Therefore,8 sCorrect is not set to false in Line 15 of Algorithm 1 either. There is no other line where IsCorrect is setto false. Hence, at the end of the Verification Phase it is
IsCorrect = true .We prove now the other direction of the implication. That is, if at the end of the Verification Phase IsCorrect = true , then it is k = n . For the sake of contradiction, assume that IsCorrect = true but k = n . Notice that k cannot be larger than n , because the estimate is increased one by one, we alreadyproved that if k = n at the end of the Verification Phase it is IsCorrect = true , and Lemma 3 shows thatall nodes would have stopped running the protocol. Thus, we are left with the case when k < n .Notice that if e ℓ > k − the variable IsCorrect is set to false in Line 17 of Algorithm 1. Hence, it mustbe e ℓ ≤ k − and, given that the system energy is n − , the energy left is e V \{ ℓ } ≥ n − k . This energyleft is stored in the n − non-leader nodes. Hence, there must exist some node j ∈ V \ { ℓ } in the networksuch that e j ≥ ( n − k ) / ( n − . If IsCorrect = true it means that the leader did not detect a node withenergy bigger than /k c in Line 14 of Algorithm 1. However, for any ≤ k ≤ n − , n > , and c > , itis /k c < ( n − k ) / ( n − which means that such node must exist.To see why the latter inequality is true, we verify that k c ( n − k ) − n + 1 > as follows. With respectto k , this function has a maximum for k = cn/ ( c + 1) . That is, for ≤ k ≤ n − (recall that we are in thecase k < n ), the function has minima in and n − . Then, it is enough to verify that c ( n − − n + 1 > ,which is true for any c > and n > , and that ( n − c − n + 1 > , which is also true for any c > and n ≥ .Thus, to complete the proof, it is enough to show that k c +1 / ( k c − rounds are enough to detecta node with energy bigger than /k c . To do that, we upper bound the number of nodes in the network withenergy at most /k c as follows. We know that at any time when the leader has energy e ℓ , the energy leftis n − − e ℓ . Let S ⊆ V be the set of nodes with energy at most /k c . Then, we have that n − − e ℓ = P j ∈ S e j + P k ∈ V \ S e k . To maximize the size of S , we minimize the size of V \ S assuming thatall nodes in V \ S have maximum energy, which according to Lemma 1 is at most 1. Then, we have that n − − e ℓ = P j ∈ S e j + ( n − | S | ) which yields | S | − − e ℓ = P j ∈ S e j Given that P j ∈ S e j ≤ | S | /k c ,we have that | S | ≤ (1 + e ℓ ) / (1 − /k c ) . Recall that e ℓ ≤ k − because IsCorrect would have been set tofalse in Line 17 of Algorithm 1 otherwise. Replacing, we get | S | ≤ k c +1 / ( k c − .Let { V , V } be a partition of V such that V = S ∪ { ℓ } . Recall that, for any v ∈ V it is e v > /k c .Using Lemma 2, we know that | V | = 1 + k c +1 / ( k c − iterations in the Verification Phase of Algorithm 1are enough for the leader to detect that there is a node with energy larger than /k c , which contradicts ourassumption that IsCorrect = true .The following theorem establishes our main result. Theorem 1.
For any anonymous dynamic network of n > nodes, including a leader ℓ , and for anyconstant c > log 5 , the following holds. If the adversarial topology is limited by a maximum degree ∆ and the connectivity model defined, and nodes run the Counting Protocol in Algorithms 1 and 2 under thecommunication model defined, after r rounds, all nodes stop holding the size of the network n , where r < n ( n + 3) + ln n − n X k =2 τ ( k ) . Where τ ( k ) is a function such that, if k = n and the Collection Phase is executed for at least τ ( k ) rounds,then at the end of the phase the leader has energy e ℓ ≥ k − − /k c . roof. Correctness is a direct consequence of Lemmas 3 and 4. The running time is obtained adding thenumber of iterations of each phase, as follows. r = n X k =2 (cid:18) τ ( k ) + (cid:24) k − /k c (cid:25) + k (cid:19) ≤ n X k =2 (cid:18) τ ( k ) + 2 + k − /k c + k (cid:19) = n ( n + 3) − n X k =2 (cid:18) τ ( k ) + kk c − (cid:19) . Using that k/ ( k c − < /k for any c > log 5 and k ≥ , we obtain the following. r < n ( n + 3) − n X k =2 (cid:18) τ ( k ) + 1 k (cid:19) ≤ n ( n + 3) + ln n − n X k =2 τ ( k ) . Bounding the running time of the Collection Phase using Lemma 2 in [4] in Theorem 1, the followingcorollary is obtained.
Corollary 1.
For any anonymous dynamic network of n > nodes, including a leader ℓ , the followingholds. If the adversarial topology is limited by a maximum degree ≤ ∆ ≤ n − and the connectivitymodel defined, and nodes run the Counting Protocol in Algorithms 1 and 2 under the communication modeldefined, after r rounds, all nodes stop holding the size of the network n , where r < (2 ∆ ) n +1 ( n + 1) ln( n + 1)ln(2 ∆ ) . Proof.
Lemma 2 in [4] proves that, for any estimate k ≥ n and integer ρ > , starting with e ℓ = 0 and e i = 1 for all i ∈ V \ { ℓ } , after running ρk rounds of the energy transfer protocol the energy stored in theleader is e ℓ ≥ n (1 − (((2 ∆ ) k − / (2 ∆ ) k ) ρ ) . Notice in Theorem 1 that the condition e ℓ ≥ k − − /k c only applies when k = n . Thus, it is enough to find ρ such that k (cid:18) − (cid:18) (2 ∆ ) k − ∆ ) k (cid:19) ρ (cid:19) ≥ k − − /k c ρ ≥ ln( k/ (1 + 1 /k c ))ln (1 / (1 − / (2 ∆ ) k )) . Using that − x ≤ e − x for x ≤ , it is enough to have ρ = ⌈ (2 ∆ ) k ln k ⌉ . Replacing in Theorem 1, weobtain 10 < n ( n + 3) + ln n − n X k =2 k ⌈ (2 ∆ ) k ln k ⌉≤ n ( n + 3) + ln n − n X k =2 k (1 + (2 ∆ ) k ln k )= n (3 n + 7) / n − n X k =2 k (2 ∆ ) k ln k. Bounding with the integral, r < n (3 n + 7) / n − Z n +1 k =2 k (2 ∆ ) k ln k d k = n (3 n + 7) / n − ∆ ) k (( k ln(2 ∆ ) −
1) ln k −
1) + Ei ( k ln(2 ∆ ))ln (2 ∆ ) (cid:12)(cid:12)(cid:12)(cid:12) n +12 ≤ n (3 n + 7) / n + (2 ∆ ) n +1 ((( n + 1) ln(2 ∆ ) −
1) ln( n + 1) −
1) + Ei (( n + 1) ln(2 ∆ ))ln (2 ∆ ) . Using that Ei (ln x ) = li ( x ) < x , for any real number x = 1 , it is Ei (( n + 1) ln(2 ∆ )) < (2 ∆ ) n +1 .Replacing, r < n (3 n + 7) / n + (2 ∆ ) n +1 (( n + 1) ln(2 ∆ ) −
1) ln( n + 1)ln (2 ∆ )= n (3 n + 7) / n + (2 ∆ ) n +1 ( n + 1) ln( n + 1)ln(2 ∆ ) − (2 ∆ ) n +1 ln( n + 1)ln (2 ∆ ) . Using that n (3 n + 7) / n < (2 ∆ ) n +1 ln( n + 1) / ln (2 ∆ ) for any n > and ≤ ∆ ≤ n − , the claimfollows. In this paper we have studied the problem of Counting in Anonymous Dynamic Networks. The problem ischallenging because the lack of identifiers and changing topology make difficult to decide if a new messagehas been received before from the same node. Also, the obvious lack of knowledge of the network sizemakes difficult to decide when the algorithm has to stop.Assuming an upper bound on the size of the system facilitates termination but may lead to very bad timecomplexity if the upper bound is a huge overestimate. According to our knowledge, the algorithm in [12] isthe only one to compute an upper bound of the system size for Anonymous Dynamic Networks and in theworst case it is exponential, i.e. O ( ∆ n ) where n is the size of the system and ∆ is an upper bound on thenodes’ degree. Finding the termination condition when an upper bound on the network size is not availableis more challenging, but it is expected to provide more efficient algorithms. Our algorithm does not assumesuch upper bound, and computes the exact size of the system applying a bottom-up approach where the sizeis possibily underestimated several times. 11t is known that if no restriction on the size of the messages is required, the counting problem canbe easily solved in O ( n ) time when nodes have IDs [11]). In this paper we have made a significant steptowards understanding if a linear counting algorithm exists also when IDs are not available, by identifyingthe speedup bottleneck and reducing exponentially the best known upper bound. This will help to understandthe difficulty introduced by anonymity (if any). Despite our contribution, there is still a big gap with respectto the linear lower bound trivially given by the dynamic diameter.Finally, although we focus on communication networks, our results carry over into any distributed sys-tem of similar characteristics. We thank Arnaud Casteigts for introducing the model to us, and Antonio Fern´andez Anta for useful dis-cussions. This study has been carried out with financial support from the French State, managed by theFrench National Research Agency (ANR) in the frame of the “Investments for the future” Programme IdExBordeaux - CPU (ANR-10-IDEX-03-02), from the National Science Foundation (CCF-1114930), and fromKean University UFRI Grant.
References
1. P. S. Almeida, C. Baquero, M. Farach-Colton, P. Jesus, and M. A. Mosteiro. Fault-tolerant aggregation: Flow-updating meetsmass-distribution. In A. Fern´andez Anta, G. Lipari, and M. Roy, editors,
Principles of Distributed Systems - 15th Interna-tional Conference, OPODIS 2011, Toulouse, France, December 13-16, 2011. Proceedings , volume 7109 of
Lecture Notes inComputer Science , pages 513–527. Springer, 2011.2. A. Casteigts, P. Flocchini, W. Quattrociocchi, and N. Santoro. Time-varying graphs and dynamic networks.
InternationalJournal of Parallel, Emergent and Distributed Systems , 27(5):387–408, 2012.3. G. A. Di Luna and R. Baldoni. Investigating the cost of anonymity on dynamic networks.
CoRR , abs/1505.03509, 2015.4. G. A. Di Luna, R. Baldoni, S. Bonomi, and I. Chatzigiannakis. Conscious and unconscious counting on anonymous dynamicnetworks. In M. Chatterjee, J.-n. Cao, K. Kothapalli, and S. Rajsbaum, editors,
Distributed Computing and Networking , volume8314 of
Lecture Notes in Computer Science , pages 257–271. Springer Berlin Heidelberg, 2014.5. G. A. Di Luna, R. Baldoni, S. Bonomi, and I. Chatzigiannakis. Counting in anonymous dynamic networks under worst-caseadversary. In
Distributed Computing Systems (ICDCS), 2014 IEEE 34th International Conference on , pages 338–347. IEEE,2014.6. G. A. Di Luna, S. Bonomi, I. Chatzigiannakis, and R. Baldoni. Counting in anonymous dynamic networks: An experimentalperspective. In P. Flocchini, J. Gao, E. Kranakis, and F. Meyer auf der Heide, editors,
Algorithms for Sensor Systems , volume8243 of
Lecture Notes in Computer Science , pages 139–154. Springer Berlin Heidelberg, 2014.7. K. Fall. A delay-tolerant network architecture for challenged internets. In
Proceedings of the 2003 conference on Applications,technologies, architectures, and protocols for computer communications (SIGCOMM) , pages 27–34, 2003.8. A. Fern´andez Anta, A. Milani, M. A. Mosteiro, and S. Zaks. Opportunistic information dissemination in mobile ad-hocnetworks: the profit of global synchrony.
Distributed Computing , 25(4):279–296, 2012.9. A. Fern´andez Anta, M. A. Mosteiro, and C. Thraves. An early-stopping protocol for computing aggregate functions in sensornetworks.
J. Parallel Distrib. Comput. , 73(2):111–121, 2013.10. D. Kempe, A. Dobra, and J. Gehrke. Gossip-based computation of aggregate information. In
Proc. of the 44th IEEE Ann.Symp. on Foundations of Computer Science , pages 482–491, 2003.11. F. Kuhn, N. Lynch, and R. Oshman. Distributed computation in dynamic networks. In
Proceedings of the Forty-second ACMSymposium on Theory of Computing , STOC ’10, pages 513–522, New York, NY, USA, 2010. ACM.12. O. Michail, I. Chatzigiannakis, and P. G. Spirakis. Naming and counting in anonymous unknown dynamic networks. In
Stabilization, Safety, and Security of Distributed Systems , pages 281–295. Springer, 2013.13. O. Michail, I. Chatzigiannakis, and P. G. Spirakis. Causality, influence, and computation in possibly disconnected synchronousdynamic networks.
Journal of Parallel and Distributed Computing , 74(1):2016–2026, 2014.14. R. O’Dell and R. Wattenhofer. Information dissemination in highly dynamic graphs. In
Proceedings of the 2005 Joint Workshopon Foundations of Mobile Computing , DIALM-POMC ’05, pages 104–110, New York, NY, USA, 2005. ACM.15. L. Pelusi, A. Passarella, and M. Conti. Opportunistic networking: data forwarding in disconnected mobile ad hoc networks.
Communications Magazine, IEEE , 44(11):134–141, 2006., 44(11):134–141, 2006.