Abstract 1 Introduction 2 Preliminaries 3 Self-Stabilizing Two-Hop Coloring 4 Loosely-Stabilizing Leader Election 5 Conclusion References

Almost Time-Optimal Loosely-Stabilizing Leader Election on Arbitrary Graphs Without Identifiers in Population Protocols

Haruki Kanaya ORCID Nara Institute of Science and Technology, Japan Ryota Eguchi ORCID Nara Institute of Science and Technology, Japan Taisho Sasada ORCID Nara Institute of Science and Technology, Japan Michiko Inoue ORCID Nara Institute of Science and Technology, Japan
Abstract

The population protocol model is a computational model for passive mobile agents. We address the leader election problem, which determines a unique leader on arbitrary communication graphs starting from any configuration. Unfortunately, self-stabilizing leader election is impossible to be solved without knowing the exact number of agents; thus, we consider loosely-stabilizing leader election, which converges to safe configurations in a relatively short time, and holds the specification (maintains a unique leader) for a relatively long time. When agents have unique identifiers, Sudo et al. (2019) proposed a protocol that, given an upper bound N for the number of agents n, converges in O(mNlogn) expected steps, where m is the number of edges. When unique identifiers are not required, they also proposed a protocol that, using random numbers and given N, converges in O(mN2logN) expected steps. Both protocols have a holding time of Ω(e2N) expected steps and use O(logN) bits of memory. They also showed that the lower bound of the convergence time is Ω(mN) expected steps for protocols with a holding time of Ω(eN) expected steps given N.

In this paper, we propose protocols that do not require unique identifiers. These protocols achieve convergence times close to the lower bound with increasing memory usage. Specifically, given N and an upper bound Δ for the maximum degree, we propose two protocols whose convergence times are O(mNlogn) and O(mNlogN) both in expectation and with high probability. The former protocol uses random numbers, while the latter does not require them. Both protocols utilize O(ΔlogN) bits of memory and hold the specification for Ω(e2N) expected steps.

Keywords and phrases:
Population protocols, Leader election, Loose-stabilization, Self-stabilization
Copyright and License:
[Uncaptioned image] © Haruki Kanaya, Ryota Eguchi, Taisho Sasada, and Michiko Inoue; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Distributed algorithms
Related Version:
Full Version: https://arxiv.org/abs/2411.03902
Funding:
The second author was supported by JSPS KAKENHI Grant Number 22H03569.
Editors:
Silvia Bonomi, Letterio Galletta, Etienne Rivière, and Valerio Schiavoni

1 Introduction

The population protocol model, introduced by Angluin et al. [3], is a computational model widely recognized in distributed computing and applicable to passive mobile sensor networks, chemical reaction systems, and molecular calculations, etc. This model comprises n finite state machines (called agents), which form a network (called a population). Agents’ states are updated through communication (called interaction) among a pair of agents. A simple connected digraph G=(V,E) (called a communication graph) determines the possibility of interaction among the agents. In this model, only one pair of agents interacts at each step. The interactions are determined by a uniform random scheduler.

The leader election problem is one of the most studied problems in population protocols. This problem involves agents electing a unique leader agent from the population and maintaining this unique leader forever. Angluin et al. [3] first studied this problem for complete graphs with designated common initial state. Under this assumption, many studies have been conducted  [3, 6, 11, 17], and a time and space optimal protocol [6] has already been proposed. Several studies also exist for arbitrary graphs [1, 2], and a time-optimal protocol [2] has already been proposed.

The self-stabilizing leader election problem requires that agents start from any configuration, elect and externally maintain a unique leader agent. It is known that there is no self-stabilizing leader election protocol for arbitrary graphs [4] and complete graphs [8], and researchers have explored the problem in three ways. The first approach involves assuming that all agents initially know the exact number n of agents [7, 8, 22]. The second approach introduces an oracle that informs agents about the existence of leaders [5, 9, 10]. The third approach relaxes the requirement of maintaining a unique leader forever, introducing a loosely-stabilizing leader election problem, where agents start from any configuration, elect a unique leader within a short time, and maintain this leader for a long time. Sudo et al. [16] first addressed this problem on complete graphs. Subsequent studies have continued to explore this problem [12, 15, 18, 19, 20, 21] as follows and summarized in Table 1.

Sudo, Ooshita, Kakugawa, and Masuzawa [18] first addressed this problem for arbitrary graphs, and it is significantly improved by Sudo, Ooshita, Kakugawa, Masuzawa, Datta, and Lawrence [20] introducing a novel concept of Same Speed Timer. They proposed two protocols. The first protocol, 𝒫ID2 , assumes that agents have unique identifiers and are given N as initial knowledge. 𝒫ID2 converges within O(mNlogn) expected steps and holds the unique leader with Ω(Ne2N) expected steps, using O(logN) bits of memory. The second protocol, 𝒫RD2, assumes that agents can make randomized transitions and is given N as initial knowledge. 𝒫RD2 converges within O(mN2logN) expected steps and holds the unique leader with Ω(Ne2N) expected steps using O(logN) bits of memory. Sudo et al. also demonstrated that the lower bound of the convergence time is Ω(mN) steps for any loosely-stabilizing protocols with holding a unique leader Ω(eN) expected steps.

Loosely-stabilizing leader election protocols without requiring unique identifiers or random numbers were proposed [19] and then improved [22]. The protocol, 𝒫AR, given N and Δ as initial knowledge, converges within O(mnDlogn+mNΔ2logN) expected steps and holds with Ω(NeN) expected steps using O(logN) bits of memory [22].

Table 1: Convergence and Holding Times for Loosely-Stabilizing Leader Election Protocols with Exponential Holding Times. n denotes the number of agents, N denotes the upper bound of n, m denotes the number of edges of the communication graph, D denotes the diameter of the communication graph, and Δ denotes the upper bound of the maximum degree of the communication graph. All protocols are given N as initial knowledge. Protocols with are also given Δ. The symbol represents lower bounds of convergence time or memory usage for protocols with holding time of Ω(eN).
Graph Convergence Holding Memory Requisite
[16] complete O(nNlogn) Ω(NeN) O(logN)
[12] complete O(nN) Ω(eN) O(logN)
[12] complete Ω(nN) Ω(eN)
[12] complete Ω(eN) Ω(logN)
[18] arbitrary O(mΔNlogn) Ω(NeN) O(logN) agent identifiers
[18] arbitrary O(mΔ2N3logN) Ω(NeN) O(logN) random numbers
[20] arbitrary O(mNlogn) Ω(Ne2N) O(logN) agent identifiers
[20] arbitrary O(mN2logN) Ω(Ne2N) O(logN) random numbers
[20] arbitrary Ω(mN) Ω(eN)
[19] arbitrary O(mnDlogn+mNΔ2logN) Ω(NeN) O(logN)
This arbitrary O(mNlogn) Ω(Ne2N) O(ΔlogN) random numbers
This arbitrary O(mNlogN) Ω(Ne2N) O(ΔlogN)

1.1 Our Contribution

In this paper, we propose a protocol 𝒫BC whose convergence time is nearly optimal on anonymous (without unique identifiers) arbitrary graphs, as supported by the lower bound [20]. The lower bound for the complete graph [12] is Ω(nN), but this is a special case, as the lower bound [20] is known to hold even when m=Θ(n2). Given N and Δ, 𝒫BC converges within O(mNlogn) steps if the transition is randomized, and O(mNlogN) steps if the transition is deterministic111 Transition is said to be deterministic if it does not require random numbers in the transition. Though the transition is deterministic, we allow the protocol to exploit the randomness with which initiator and responder roles are chosen. , both in expectations and with high probability. The protocol holds the unique leader with Ω(Ne2N) expected steps and utilizes O(ΔlogN) bits of memory. The proposed 𝒫BC has better convergence time than SOTA self-stabilizing leader election protocol [22] which converges with O(mn2Dlogn) steps with requiring the knowledge of n.

To achieve the convergence time of 𝒫BC, we utilize the Same Speed Timer proposed in 𝒫RD2 [20], which requires two-hop coloring. The self-stabilizing two-hop coloring protocol was first studied by Angluin et al. [4], and further explored by Sudo et al. [20] (see Table 2). In this paper, we propose two new self-stabilizing two-hop coloring protocols; 𝒫LRU with randomized transitions, and 𝒫LRU with deterministic transitions. Both protocols require N and Δ as initial knowledge. 𝒫LRU converges within O(mn) steps, both in expectation and with high probability, and uses O(ΔlogN) bits of memory. 𝒫LRU converges within O(m(n+ΔlogN)) steps, both in expectation and with high probability, and also uses O(ΔlogN) bits of memory. In 𝒫LRU, agents generate random numbers independently from interactions among themselves. To ensure the independence among random numbers, we employ the self-stabilizing normal coloring protocol 𝒫NC to assign superiority or inferiority between adjacent agents. When interacting, only the superior agent uses the interaction to generate random numbers. 𝒫NC converges within O(mnlogn) steps, both in expectation and with high probability, and utilizes O(logN) bits of memory.

Table 2: List of Convergence Times for Self-Stabilizing Two-Hop Coloring Protocols on Arbitrary Graphs. n denotes the number of agents, N denotes the upper bound of n, m denotes the number of edges of the communication graph, δ denotes the maximum degree of the communication graph, and Δ denotes the upper bound of δ.
Convergence Memory Knowledge Requisite
Angluin et al. [4] O(Δ2) Δ random numbers
Angluin et al. [4] O(Δ2) Δ
Sudo et al. [20] O(mnδlogn) O(logN) N random numbers
𝒫LRU (this) O(mn) O(ΔlogN) N,Δ random numbers
𝒫LRU (this) O(mn+mΔlogN) O(ΔlogN) N,Δ

2 Preliminaries

In this paper, denotes the set of natural numbers no less than one, and logx refers to log2x. If we use the natural logarithm, we explicitly specify the base e by writing logex.

A population is represented by a simple connected digraph G=(V,E), where V (|V|2) represents a set of agents, and E{(u,v)V×Vuv} represents the pairs of agents indicating potential interactions. An agent u can interact with an agent v if and only if (u,v)E, where u is the initiator and v is the responder. We assume G is symmetric, that is, if for every (u,v)V×V, the preposition (u,v)E(v,u)E holds. We also denote n=|V| and m=|E|. The diameter of G is denoted by D. The degree of agent u is denoted by δu=|{vV(u,v)E(v,u)E}|, and the maximum degree is denoted by δ=maxuV{δu}. The upper bound N of n satisfies Nn, and the upper bound Δ of δ satisfies δΔ2(N1) 222 Given only N, δ2(N1) holds, thus Δ2(N1). .

A protocol 𝒫 is defined as a 5-tuple (Q,Y,R,T,O), where Q represents the finite set of states of agents, Y represents the finite set of output symbols, R represents the range of random numbers, T:Q×Q×RQ×Q is the transition function, and O:QY is the output function. When an initiator u, whose state is pQ, interacts with a responder v, whose state is qQ, each agent updates their states via the transition function using their current states and a random number rR to p,qQ such that (p,q)=T(p,q,r). An agent whose state is pQ outputs O(p)Y. A protocol 𝒫 is with deterministic transitions if and only if r,rR,p,qQ:T(p,q,r)=T(p,q,r) holds. Otherwise, a protocol 𝒫 is with randomized transitions. The memory usage of protocol 𝒫 is defined by log|Q| bits.

A configuration C:VQ represents the states of all agents. The set of all configurations by protocol 𝒫 is denoted by 𝒞all(𝒫). A configuration C transitions to C by an interaction e=(u,v) and a random number rR if and only if (C(u),C(v))=T(C(u),C(v),r) and wV{u,v}:C(w)=C(w) holds. Transitioning from a configuration C to C by an interaction e and a random number r is denoted by Ce,rC. A uniform random scheduler Γ=Γ0,Γ1, determines which pair of agents interact at each step, where ΓtE (for t0) is a random variable satisfying (u,v)E,t:Pr(Γt=(u,v))=1/m. An infinite sequence of random numbers Λ=R0,R1, represents a random number generated at each step, where Rt (for t0) is a random variable satisfying rR,t:Pr(Rt=r)=1/|R|. Given an initial configuration C0𝒞all(𝒫), a uniform random scheduler Γ, and a sequence of random numbers Λ, the execution of protocol 𝒫 is denoted by Ξ𝒫(C0,Γ,Λ)=C0,C1, where CtΓt,RtCt+1 (for t0) holds. If Γ and Λ are clear from the context, we may simply write Ξ𝒫(C0). A set of configurations 𝒮 is safe if and only if there is no configuration Ci𝒮(i) for any configuration C0𝒮 and any execution Ξ(C0)=C0,C1,. A protocol is silent if and only if there is no state changed after reached safe configurations.

For a protocol 𝒫 that solves a population protocol problem, the expected holding time and the expected convergence time are defined as follows. The specification of the problem, which is a required condition for an execution, is denoted by 𝒮𝒞. For any configuration C𝒞all(𝒫), any uniform random scheduler Γ, and any infinite sequence of random numbers Λ, the expected number of steps that an execution Ξ𝒫(C,Γ,Λ) satisfies 𝒮𝒞 is defined as the expected holding time, denoted EHT𝒫(C,𝒮𝒞). For any set of configurations 𝒮𝒞all(𝒫), any configuration C𝒞all(𝒫), any uniform random scheduler Γ, and any infinite sequence of random numbers Λ, the expected number of steps from the beginning of the execution Ξ𝒫(C,Γ,Λ) until the configuration reaches 𝒮 is defined as the expected convergence time, denoted ECT𝒫(C,𝒮). A computation is considered to be finished with high probability if and only if the computation finishes with probability 1O(nc) for c1.

The leader election problem requires that all agents output either L or F, where L represents a leader and F represents a follower. The specification of the leader election is denoted by LE. For an execution Ξ𝒫(C0)=C0,C1,,Cx,, the configurations C0,,Cx satisfy LE if and only if there is an agent u such that i[0,x]:O(Ci(u))=L, and i[0,x],vV{u}:O(Ci(v))=F holds.

Definition 1 (Loosely-stabilizing leader election[16]).

A protocol 𝒫 is an (α,β)-loosely-stabilizing leader election protocol if and only if there exists a set of configurations 𝒮𝒞all(𝒫) such that maxC𝒞all(𝒫)ECT𝒫(C,𝒮)α and minC𝒮EHT𝒫(C,LE)β holds.

A protocol 𝒫 is a self-stabilizing protocol of a problem if and only if there exists safe configurations that any execution starting from any safe configuration satisfies the specification of the problem (called closure), and any execution starting from any configuration includes a safe configuration reaches the safe configurations (called convergence).

Definition 2.

A protocol 𝒫 is a self-stabilizing normal coloring protocol if and only if there exists non-negative integer x such that for any configuration C0𝒞all(𝒫), and the execution Ξ𝒫(C0)=C0,C1,,Cx,, the following condition holds: i,vV:O(Cx(v))=O(Cx+i(v)) and v,uV:(u,v)EO(Cx(u))O(Cx(v)).

Definition 3.

A protocol 𝒫 is a self-stabilizing two-hop coloring protocols if and only if there exists non-negative integer x such that for any configuration C0𝒞all(𝒫), and the execution Ξ𝒫(C0)=C0,C1,,Cx,, the following condition holds: i,vV:O(Cx(v))=O(Cx+i(v)) and v,u,wV:(u,v)E(v,w)EO(Cx(u))O(Cx(w)).

3 Self-Stabilizing Two-Hop Coloring

In this section, we introduce a self-stabilizing two-hop coloring protocol with randomized transitions 𝒫LRU, alongside a deterministic self-stabilizing two-hop coloring protocol with deterministic transitions 𝒫LRU.

Two distinct agents u,vV are called two-hop located if and only if there exists wV such that (u,w)E(v,w)E. A graph is considered two-hop colored if and only if, for any pair of agents u and v that are two-hop located, u and v are assigned distinct colors.

The basic strategy is similar to that described by Angluin et al. [4] and Sudo et al. [20]. The differences lie in the methods for generating colors and the length of the array used to record the colors of interacted agents. Angluin et al. memorized all generated colors using an array of length Δ(Δ1)+1, whereas Sudo et al. recorded only the most recent color. In the protocols, the agents record the last Δ colors.

We present a general strategy for color collision detection. When interacting two agents, they record each other’s color with a common binary random stamp. If there is no color collision, when they interact again they find that they remember each other’s color with the same stamp value. Assume that agents v and w have a color collision, that is, they are two-hop located with a common neighbor u and have the same color. Consider the scenario in which interactions occur in the order of (u,v), (u,w), (u,v), and u (resp. v) records v’s (resp. u’s) color with a stamp 0 and then u records w’s color (it is also v’s color) with a stamp 1. When u and v interact again, they notice they remember each other’s color with different stamp values and detect the color collision.

In both protocols, each agent has arrays whose size are Δ to record the last Δ colors and their stamps. Both protocols are the same except for the way to generate colors. In 𝒫LRU, agents generate colors by using the ability of generating uniform random numbers. In 𝒫LRU, agents generate colors by using the roles of initiator and responder. To generate x-digit binary random number, each agent generates a one random bit according to its role (initiator or responder) in each interaction, and repeats it x times. To ensure the independence of random numbers, only one agent can use the interaction to generate random numbers for each interaction. To solve this issue, we use normal coloring. A graph is considered normal colored if and only if agents u and v are different colors for any pair (u,v)E. We call agents’ colors which are colored by normal coloring the normal color. To guarantee independency among random numbers, when two agents interact, the agent with larger normal color value can use the interaction to generate random numbers. Though this mechanism does not give a chance to generate random numbers to agents with smaller normal color, random numbers are used when two agents detect a color collision. In such cases, two random numbers are provided as new colors from an agent who has larger normal color value and already generated two or more numbers.

3.1 Protocol 𝓟𝐋𝐑𝐔

In this subsection, we introduce the randomized self-stabilizing two-hop coloring protocol 𝒫LRU. Given N and Δ, the protocol 𝒫LRU achieves convergence within O(mn) steps, both in expectation and with high probability, while requiring O(ΔlogN) bits of memory per agent.

An agent a in 𝒫LRU has four variables: a.𝚑𝚘𝚙𝚌𝚘𝚕𝚘𝚛{1,,8N3Δ2}, a.𝚙𝚛𝚎𝚟{1,,8N3Δ2}Δ, a.𝚜𝚝𝚊𝚖𝚙{0,1}Δ, and a.𝚒𝚍𝚡{0,,Δ}. The variable a.𝚑𝚘𝚙𝚌𝚘𝚕𝚘𝚛 represents the two-hop color of the agent. The variable a.𝚙𝚛𝚎𝚟 is an array that stores the last Δ colors interacted by the agent. The variable a.𝚜𝚝𝚊𝚖𝚙 is an array of size Δ, with each entry being either 0 or 1, used to record the stamp associated with each color memorized. Lastly, a.𝚒𝚍𝚡 serves as a temporary index to locate the color of the interacting agent in a.𝚙𝚛𝚎𝚟.

Algorithm 1 Self-Stabilizing two-hop coloring 𝒫LRU.
Outout Function O : Each agent a outputs a.𝚑𝚘𝚙𝚌𝚘𝚕𝚘𝚛.
when  an initiator a0 interacts with a responder a1 do
1 forall  i{0,1} do
2    ai.𝚒𝚍𝚡0
3    for  j1toΔ do
4       if ai.𝚙𝚛𝚎𝚟[j]=a1i.𝚑𝚘𝚙𝚌𝚘𝚕𝚘𝚛 then
5          ai.𝚒𝚍𝚡j
6          break
7          
8       
9    
10 Generate_Color ()
11 forall  i{0,1} do
12    if ai.𝚒𝚍𝚡=0 then  ai.𝚒𝚍𝚡Δ
13    for  jai.𝚒𝚍𝚡1downto 1 do
14       (ai.𝚙𝚛𝚎𝚟[j+1],ai.𝚜𝚝𝚊𝚖𝚙[j+1])(ai.𝚙𝚛𝚎𝚟[j],ai.𝚜𝚝𝚊𝚖𝚙[j])
15       
16    
17 Generate_Bit ()
18 
function Generate_Color():
19 if a0.𝚒𝚍𝚡>0a1.𝚒𝚍𝚡>0a0.𝚜𝚝𝚊𝚖𝚙[a0.𝚒𝚍𝚡]a1.𝚜𝚝𝚊𝚖𝚙[a1.𝚒𝚍𝚡]) then
20      generate two colors c0,c1{1,,8N3Δ2} uniformly at random
21    (a0.𝚑𝚘𝚙𝚌𝚘𝚕𝚘𝚛,a1.𝚑𝚘𝚙𝚌𝚘𝚕𝚘𝚛)(c0,c1)
22    a0.𝚒𝚍𝚡a1.𝚒𝚍𝚡0
23    
24 
function Generate_Bit():
25   generate bit b{0,1} uniformly at random
26 (a0.𝚙𝚛𝚎𝚟[1],a1.𝚙𝚛𝚎𝚟[1],a0.𝚜𝚝𝚊𝚖𝚙[1],a1.𝚜𝚝𝚊𝚖𝚙[1])(a1.𝚑𝚘𝚙𝚌𝚘𝚕𝚘𝚛,a0.𝚑𝚘𝚙𝚌𝚘𝚕𝚘𝚛,b,b)
27 

𝒫LRU is given by algorithm 1, and consists of four parts: i) reading memory, ii) collision detection, iii) saving colors, and iv) stamping.

  1. i)

    Reading memory (lines 1–6) aims to find a color of the interacting partner in an array of recorded colors. For each agent ai (where i{0,1}) interacting with another agent a1i, ai searches ai.𝚙𝚛𝚎𝚟 for a1i.𝚑𝚘𝚙𝚌𝚘𝚕𝚘𝚛 and records the minimum index in ai.𝚒𝚍𝚡 if exists, otherwise, sets ai.𝚒𝚍𝚡 as 0.

  2. ii)

    Collision detection (lines 7, and 13–16) aims to generate new colors when a stamp collision is detected. To address this, two uniform random numbers are generated from the range [1,8N3Δ2]. These numbers are then used to update a0.𝚑𝚘𝚙𝚌𝚘𝚕𝚘𝚛 and a1.𝚑𝚘𝚙𝚌𝚘𝚕𝚘𝚛 respectively.

  3. iii)

    Saving colors (lines 8–11) aims to maintain arrays 𝚙𝚛𝚎𝚟 and 𝚜𝚝𝚊𝚖𝚙 in a Least Recently Used (LRU) fashion.

  4. iv)

    Stamping (lines 12, and 17–18) aims to generate a common binary stamp to two interacting agents, and to move a color and a stamp of this current interacting partner to the heads of arrays 𝚙𝚛𝚎𝚟 and 𝚜𝚝𝚊𝚖𝚙.

We have following theorems.

Theorem 4.

Given the upper bound N and Δ, 𝒫LRU is a self-stabilizing two-hop coloring protocol with randomized transitions, and the convergence time is O(mn) steps both in expectation and with high probability.

Theorem 5.

Given the upper bound N and Δ, 𝒫LRU is a self-stabilizing two-hop coloring protocol with deterministic transitions, and converges to safe configurations within O(m(n+ΔlogN)) steps both in expectation and with high probability.

4 Loosely-Stabilizing Leader Election

In this section, we propose a loosely-stabilizing leader election protocol 𝒫BC. 𝒫BC uses a self-stabilizing two-hop coloring protocol. Thus, if it uses 𝒫LRU, 𝒫BC is with randomized transitions. If it uses 𝒫LRU, 𝒫BC is with deterministic transitions. In both cases, 𝒫BC holds a unique leader with Ω(Ne2N) expected steps and uses O(ΔlogN) bits of memory. Note that 𝒫BC (with randomized transitions) always generates random numbers deterministically like in 𝒫LRU outside of two-hop coloring since it does not affect a whole complexity.

The basic strategy of leader election is as follows: i) All agents become followers. ii) Some candidates of a leader emerge, and the number of candidates becomes 1 with high probability. iii) If there are multiple leaders, return to i). Each agent a has 6 variables and 4 timers: a.𝙻𝙵{𝙱,𝙻0,𝙻1,𝙵}, a.𝚝𝚢𝚙𝚎{1,,2logN+11}, a.𝚒𝚍{1,,2logN2+11}, a.𝚌𝚘𝚕𝚘𝚛, a.𝚙𝚌𝚘𝚕, a.𝚛𝚌 {0,1}, a.𝚝𝚒𝚖𝚎𝚛𝙻𝙵 [0,2𝚝BC], a.𝚝𝚒𝚖𝚎𝚛𝙺𝙻[0,𝚝BC], a.𝚝𝚒𝚖𝚎𝚛V[0,2𝚝BC], and a.𝚝𝚒𝚖𝚎𝚛E[0,2𝚝BC]. Here, 𝚝BC is a sufficiently large value for 𝒫BC to work correctly. A status of an agent a is represented by a.𝙻𝙵 where 𝙱 (leader candidate), 𝙻0 (leader mode), and 𝙻1 (duplication check mode) represent leaders and 𝙵 represents a follower. The variable a.𝚝𝚢𝚙𝚎 is used for detecting multiple leaders. The variable a.𝚒𝚍 represents the identifier of leaders.

In 𝒫BC, agents mainly use the broadcast (also called the epidemic and the propagation) to inform others of something. In a broadcast mechanism, information from one agent is repeatedly copied (with modification if needed) to agents when two agents interact. In order to detect the end of operations (including broadcasts) for all agents, the agents uses timers. The timers decrease by Larger Time Propagation and Same Speed Timer. Using Larger Time Propagation and Same Speed Timer, all timer values decrease gradually, almost synchronously. Larger Time Propagation means that when an agent u interacts with an agent v, u.𝚝𝚒𝚖𝚎𝚛 (resp. v.𝚝𝚒𝚖𝚎𝚛) is set to max(u.𝚝𝚒𝚖𝚎𝚛,v.𝚝𝚒𝚖𝚎𝚛1) (resp. max(v.𝚝𝚒𝚖𝚎𝚛,u.𝚝𝚒𝚖𝚎𝚛1)). A variable a.𝚛𝚌 is used to implement Same Speed Timer and represents whether a can decrease its own timers or not in the current interaction. Same Speed Timer decrease a timer value by 1 when an agent interacts the same agent continuously. For Same Speed Timer, after reaching 𝒮color, the agents use the colors to determine whether the current partner is the last partner or not. A read-only variable a.𝚌𝚘𝚕𝚘𝚛 represents a color determined in the two-hop coloring. A variable a.𝚙𝚌𝚘𝚕 represents an agent’ color that a interacted previously. The domains of a.𝚌𝚘𝚕𝚘𝚛 and a.𝚙𝚌𝚘𝚕 depend on a self-stabilizing two-hop coloring protocol. If we use 𝒫LRU, a.𝚌𝚘𝚕𝚘𝚛,a.𝚙𝚌𝚘𝚕{1,,8N3Δ2}. If we use 𝒫LRU, a.𝚌𝚘𝚕𝚘𝚛,a.𝚙𝚌𝚘𝚕{0,,2log8N3Δ21}.

4.1 Outline of 𝓟𝐁𝐂

We show the outline of 𝒫BC. We call a configuration satisfying certain conditions a phase. 𝒫BC mainly has 3 phases: i) Global Reset, ii) Leader Generation, iii) Leader Detection. We first explain the overview of the three phases with the roles of 4 timers using an example flow shown in Fig. 1, where the height of the timer represents the relative magnitude of its value.

  1. i)

    Global Reset is the phase that resets all agents when some inconsistencies are detected. (In Fig. 1(a), multiple leaders are detected.) A configuration is in the Global Reset if there exists agents whose 𝚝𝚒𝚖𝚎𝚛𝙺𝙻>0. When some inconsistency is detected, a Global Reset phase is started and the kill virus is created. The kill virus makes an agent a follower, sets the agent’s identifier to 1 (a tentative value before generating id), and also erases the search virus. The presence of kill virus is represented as a positive value of 𝚝𝚒𝚖𝚎𝚛𝙺𝙻, which serves as timer to live (TTL). When the Global Reset phase begins, some agents’ 𝚝𝚒𝚖𝚎𝚛𝙺𝙻 are set to the maximum value and spread to all agents with decreasing the values as shown in Fig. 1(b). Eventually, 𝚝𝚒𝚖𝚎𝚛𝙺𝙻 will become 0, and the Global Reset phase will be finished. While 𝚝𝚒𝚖𝚎𝚛𝙺𝙻>0, 𝚝𝚒𝚖𝚎𝚛𝙻𝙵 takes its maximum value and 𝚝𝚒𝚖𝚎𝚛V takes 0.

  2. ii)

    Leader Generation is the phase where agents generate leaders. In 𝒫BC, a leader keeps a values of 𝚝𝚒𝚖𝚎𝚛𝙻𝙵 to its maximum value, while followers propagate the value with Larger Time Propagation and Same Speed Timer. If there is no leader (Fig. 1(c)), values of 𝚝𝚒𝚖𝚎𝚛𝙻𝙵 for some followers eventually become 0. Then these followers become candidates (𝙱) (Fig. 1(d)). Each candidate for leaders generates a random number as an identifier using interactions. The way to generate random numbers is described in Section 3. The candidates broadcast their 𝚒𝚍s to all agents, and become a follower (𝙵) if it encounters a larger 𝚒𝚍 value. While generating an identifier (𝚒𝚍), 𝚝𝚒𝚖𝚎𝚛LF takes its maximum value, and it gradually decreases after generating 𝚒𝚍. When 𝚝𝚒𝚖𝚎𝚛LF of a candidate becomes 0, it becomes a leader (𝙻0). When there are no candidates for leaders, Leader Generation is finished.

  3. iii)

    Leader Detection is the phase where leaders determine whether there are multiple leaders or not. The leaders generate search viruses periodically using 𝚝𝚒𝚖𝚎𝚛E. When 𝚝𝚒𝚖𝚎𝚛E becomes 0, the agent start generating a 𝚝𝚢𝚙𝚎 of search virus. If there are multiple leaders, leaders generate search viruses almost simultaneously thanks to Larger Time Propagation. When leaders generate search viruses, they generate random numbers using interactions to determine the type of search virus. The type of search virus with its TTL 𝚝𝚒𝚖𝚎𝚛V spreads to all agents. When two different types of search viruses meet, agents create the kill virus and move to the Global Reset phase (Fig. 1(a)). While, if there is a unique leader, one search virus is periodically generated and expired (Fig. 1(e)).

Phases circulates Global Reset, Leader Generation, and Leader Detection in this order. If there exists a unique leade , the configuration stays in Leader Detection phase with high probability. Otherwise, the phase moves to Global Reset phase. Timers 𝚝𝚒𝚖𝚎𝚛𝙺𝙻 and 𝚝𝚒𝚖𝚎𝚛𝙻𝙵 are used for Global Reset and Leader Generation phases to have enough steps.

Figure 1: An example flow of 𝒫BC.
Algorithm 2 Loosely-Stabilizing Leader Election Protocol 𝒫BC (1/3).
Output function O : An agent a outputs 𝙻 if a.𝙻𝙵{𝙱,𝙻0,𝙻1}, otherwise, 𝙵.
when  an initiator a0 interacts with a responder a1 do
1   Execute self stabilizing two-hop coloring protocol
2 REPEAT_CHECK()
3 if i{0,1}:ai.𝚝𝚒𝚖𝚎𝚛𝙺𝙻>0 then  Reset()
4 LARGER_TIME_PROPAGATE(𝙺𝙻)
5 COUNT_DOWN(𝙺𝙻)
6 LARGER_TIME_PROPAGATE(E)
7 COUNT_DOWN(E)
8 if a0.𝙻𝙵,a1.𝙻𝙵{𝙻0,𝙻1,𝙵} then
9    LARGER_TIME_PROPAGATE(𝙻𝙵)
10    COUNT_DOWN(𝙻𝙵)
11    
12 forall  i{0,1} do
13    if ai.𝙻𝙵{𝙻0,𝙻1} then  ai.𝚝𝚒𝚖𝚎𝚛𝙻𝙵𝚝BC
14    
15 GenerateLeader()
16 Detect()
17 
function LARGER_TIME_PROPAGATE(x):
18 if i{0,1}:ai.𝚝𝚒𝚖𝚎𝚛x<a1i.𝚝𝚒𝚖𝚎𝚛x then
19    ai.𝚝𝚒𝚖𝚎𝚛xa1i.𝚝𝚒𝚖𝚎𝚛x1
20    
21 
function REPEAT_CHECK():
22 forall  i{0,1} do
23    if ai.𝚙𝚌𝚘𝚕=a1i.𝚌𝚘𝚕𝚘𝚛 then ai.𝚛𝚌1
24    else ai.𝚛𝚌0
25    ai.𝚙𝚌𝚘𝚕a1i.𝚌𝚘𝚕𝚘𝚛
26    
27 
function COUNT_DOWN(x):
28 forall  i{0,1} do
29    if ai.𝚛𝚌=1 then ai.𝚝𝚒𝚖𝚎𝚛xmax(0,ai.𝚝𝚒𝚖𝚎𝚛x1)
30    
31 
function Reset():
32 forall  i{0,1} do
33    (ai.𝙻𝙵,ai.𝚒𝚍,ai.𝚝𝚒𝚖𝚎𝚛V)(𝙵,1,0)
34    
35 
Algorithm 3 Loosely-Stabilizing Leader Election Protocol 𝒫BC (2/3).
function GenerateLeader():
36 if i{0,1}:ai.𝚝𝚒𝚖𝚎𝚛𝙺𝙻>0 then
37    a0.𝚝𝚒𝚖𝚎𝚛𝙻𝙵a1.𝚝𝚒𝚖𝚎𝚛𝙻𝙵𝚝BC     // prevent starting GenerateLeader
38    
39 if i{0,1}:ai.𝙻𝙵=𝙵ai.𝚝𝚒𝚖𝚎𝚛𝙻𝙵=0 then
40    if ai.𝚒𝚍1 then  a0.𝚝𝚒𝚖𝚎𝚛𝙺𝙻a1.𝚝𝚒𝚖𝚎𝚛𝙺𝙻𝚝BC // 𝚒𝚍 hasn’t been reset
41    else  (ai.𝙻𝙵,ai.𝚝𝚒𝚖𝚎𝚛𝙻𝙵)(𝙱,2𝚝BC) // a new candidate is created
42    
43 if i{0,1}:ai.𝙻𝙵=𝙱ai.𝚒𝚍<2logN2 then
44    (a1.𝙻𝙵,a1.𝚒𝚍,a1.𝚝𝚒𝚖𝚎𝚛𝙻𝙵)(𝙵,1,𝚝BC)
45    
46 if i{0,1}:ai.𝙻𝙵=𝙱ai.𝚒𝚍<2logN2 then
47    (ai.𝚒𝚍,ai.𝚝𝚒𝚖𝚎𝚛𝙻𝙵)(2ai.𝚒𝚍+i,2𝚝BC)
48    
49 if a0.𝙻𝙵{𝙵,𝙱}a1.𝙻𝙵{𝙵,𝙱}(i{0,1}:((ai.𝙻𝙵=𝙱ai.𝚒𝚍>2logN2)ai.𝙻𝙵=𝙵)ai.𝚒𝚍>a1i.𝚒𝚍) then
50    (a1i.𝙻𝙵,a1i,𝚒𝚍)(ai.𝙻𝙵,ai.𝚒𝚍)
51    
52 if i{0,1}:ai.𝙻𝙵=𝙵a1i.𝙻𝙵=𝙱 then
53    ai.𝚝𝚒𝚖𝚎𝚛𝙻𝙵𝚝BC1     // consider a1i as a leader
54    
55 forall  i{0,1} do
56    if ai.𝙻𝙵=𝙱ai.𝚛𝚌=1 then  ai.𝚝𝚒𝚖𝚎𝚛𝙻𝙵max(0,ai.𝚝𝚒𝚖𝚎𝚛𝙻𝙵1)
57    if ai.𝙻𝙵=𝙱ai.𝚝𝚒𝚖𝚎𝚛𝙻𝙵=0 then  (ai.𝙻𝙵,ai.𝚝𝚒𝚖𝚎𝚛𝙻𝙵)(𝙻0,𝚝BC)
58    
59 
Algorithm 4 Loosely-Stabilizing Leader Election Protocol 𝒫BC (3/3).
function Detect():
60 if i{0,1}:ai.𝙻𝙵=𝙱 then
61    a0.𝚝𝚒𝚖𝚎𝚛Ea1.𝚝𝚒𝚖𝚎𝚛E2𝚝BC   // prevent starting Detect
62    
63 forall  i{0,1} do
64    if ai.𝙻𝙵{𝙻0,𝙻1}ai.𝚝𝚒𝚖𝚎𝚛E=0 then
65       (ai.𝙻𝙵,ai.𝚝𝚢𝚙𝚎,ai.𝚝𝚒𝚖𝚎𝚛E)(𝙻1,1,2𝚝BC) // start the type generation
66       
67    if ai.𝙻𝙵=𝙻1ai.𝚝𝚢𝚙𝚎<2logN then
68       (ai.𝚝𝚢𝚙𝚎,ai.𝚝𝚒𝚖𝚎𝚛E)(2ai.𝚝𝚢𝚙𝚎+i,2𝚝BC)
69       if ai.𝚝𝚢𝚙𝚎2logN then
70          ai.𝚝𝚒𝚖𝚎𝚛V2𝚝BC
71          
72       
73    
74 if i{0,1}:ai.𝙻𝙵=𝙵a1i.𝙻𝙵{𝙻0,𝙻1} then
75     if ai.𝚝𝚒𝚖𝚎𝚛V>0(a1i.𝙻𝙵=𝙻0a1i.𝚝𝚢𝚙𝚎<2logN
76     ai.𝚝𝚢𝚙𝚎a1i.𝚝𝚢𝚙𝚎) then
77       a0.𝚝𝚒𝚖𝚎𝚛𝙺𝙻a1.𝚝𝚒𝚖𝚎𝚛𝙺𝙻𝚝BC  // different types are detected
78       
79    else if ai.𝚝𝚒𝚖𝚎𝚛V=0a1i.𝙻𝙵=𝙻1a1i.𝚝𝚒𝚖𝚎𝚛V>0 then
80       (ai.𝚝𝚢𝚙𝚎,ai.𝚝𝚒𝚖𝚎𝚛V)(a1i.𝚝𝚢𝚙𝚎,a1i.𝚝𝚒𝚖𝚎𝚛V1)
81       
82    
83 else if a0.𝙻𝙵=𝙵a1.𝙻𝙵=𝙵 then
84    if a0.𝚝𝚒𝚖𝚎𝚛V>0a1.𝚝𝚒𝚖𝚎𝚛V>0a0.𝚝𝚢𝚙𝚎a1.𝚝𝚢𝚙𝚎 then
85       a0.𝚝𝚒𝚖𝚎𝚛𝙺𝙻a1.𝚝𝚒𝚖𝚎𝚛𝙺𝙻𝚝BC // different types are detected
86       
87    else if i{0,1}:ai.𝚝𝚒𝚖𝚎𝚛V=0a1i.𝚝𝚒𝚖𝚎𝚛V>0 then
88       (ai.𝚝𝚢𝚙𝚎,ai.𝚝𝚒𝚖𝚎𝚛V)(a1i.𝚝𝚢𝚙𝚎,a1i.𝚝𝚒𝚖𝚎𝚛V1)
89       
90    
91 else if a0.𝙻𝙵{𝙻0,𝙻1}a1.𝙻𝙵{𝙻0,𝙻1} then
92    a0.𝚝𝚒𝚖𝚎𝚛𝙺𝙻a1.𝚝𝚒𝚖𝚎𝚛𝙺𝙻𝚝BC // multiple leaders are detected
93    
94 LARGER_TIME_PROPAGATE(V)
95 COUNT_DOWN(V)
96 forall  i{0,1} do
97    if ai.𝚝𝚒𝚖𝚎𝚛V>0 then  ai.𝚝𝚒𝚖𝚎𝚛E2𝚝BC// prevent restarting Detect
98    if ai.𝙻𝙵=𝙻1ai.𝚝𝚒𝚖𝚎𝚛E<𝚝BC/2 then  ai.𝙻𝙵𝙻0
99    
100 

4.2 Details of 𝓟𝐁𝐂

𝒫BC is given by Algorithm 2, Algorithm 3, and Algorithm 4. We explain the details of 𝒫BC. 𝒫BC has five parts: i) Two-hop coloring, ii) Timer Count Down, iii) Reset, iv) Leader Generation, v) Leader Detection. The relationship between the three phases and five parts is as follows. The Global Reset phase corresponds to the Reset part, the Leader Generation phase to the Generate part, and the Leader Detection phase to the Detect part. The Timer Count Down part operates throughout all phases, while the Two-Hop Coloring part is completed before the phases begin. Throughout this explanation, we consider when an initiator a0 interacts with a responder a1.

  1. i)

    In line 1, the agents execute the two-hop coloring protocol 𝒫LRU or 𝒫LRU.

  2. ii)

    Timer Count Down (lines 2, 4–12, and 15–22) aims to increase or decrease timers. First, the interacting agents determine whether the current partner is the same as the last partner in REPEAT_CHECK (lines 2, and 17–20) to implement Same Speed Timer. After that, each agent saves the current partner’s color to its own 𝚙𝚌𝚘𝚕. Then, agents decrease timers if ai.𝚛𝚌=1 holds. 𝚝𝚒𝚖𝚎𝚛𝙺𝙻 (lines 4–5) and 𝚝𝚒𝚖𝚎𝚛E (lines 6–7) are handled by Larger Time Propagation and Count Down. That is, for i{0,1}, ai.𝚝𝚒𝚖𝚎𝚛𝙺𝙻 is set to max(ai.𝚝𝚒𝚖𝚎𝚛𝙺𝙻,a1i.𝚝𝚒𝚖𝚎𝚛𝙺𝙻1), and if ai.𝚛𝚌=1 holds, ai.𝚝𝚒𝚖𝚎𝚛𝙺𝙻 is decreased by 1 (resp. 𝚝𝚒𝚖𝚎𝚛E). If both interacting agents are not candidates (𝙱), they increase or decrease 𝚝𝚒𝚖𝚎𝚛𝙻𝙵 like 𝚝𝚒𝚖𝚎𝚛𝙺𝙻 (lines 8–10). For i{0,1}, if ai is a leader (𝙻0 or 𝙻1), ai.𝚝𝚒𝚖𝚎𝚛𝙻𝙵 is set to 𝚝BC (lines 11–12). If a0 or a1 is a candidate (𝙱), 𝚝𝚒𝚖𝚎𝚛𝙻𝙵 increases or decreases in Leader Generation. 𝚝𝚒𝚖𝚎𝚛V increases or decreases in Leader Detection.

  3. iii)

    Reset (lines 3, and 23–24) aims to reset the population when some inconsistency is detected. For i{0,1}, if ai.𝚝𝚒𝚖𝚎𝚛𝙺𝙻>0 holds, ai sets (ai.𝙻𝙵,ai.𝚒𝚍,ai.𝚝𝚒𝚖𝚎𝚛V) to (𝙵,1,0). In other words, ai becomes a follower, its identifier becomes 1, and ai erases the search virus. This Reset is happened when and only when there are multiple leaders and candidates’ 𝚒𝚍 have not been reset to 1. Specifically, when different search virus meets (lines 60–61, 65–66, 69–70), and when candidates’ 𝚒𝚍 have not been reset (lines 27–28).

  4. iv)

    Generate Leader (lines 13, and 25–40) aims to generate a new leader when there are no leaders. For i{0,1}, if ai.𝚝𝚒𝚖𝚎𝚛𝙺𝙻>0 holds, each agent sets ai.𝙻𝙵 to 𝚝BC to prevent starting Leader Generation during the Global Reset phase (lines 25–26). Firstly, for i{0,1}, if ai.𝙻𝙵 becomes 0, ai determines that there are no leaders, and becomes a candidate for leaders (𝙱) and sets ai.𝚝𝚒𝚖𝚎𝚛𝙻𝙵 to 2𝚝BC (lines 27–29). At this time, if ai.𝚒𝚍 is not 1 (i.e., , it has not been reset), ai sets ai.𝚝𝚒𝚖𝚎𝚛𝙺𝙻 to 𝚝BC and moves to the Global Reset phase (line 29). Secondly, candidates (𝙱) generate random numbers as their own identifiers (𝚒𝚍). For each interaction, if the candidate u is an initiator, u.𝚒𝚍 is updated to 2u.𝚒𝚍; otherwise, u.𝚒𝚍 is updated to 2u.𝚒𝚍+1 until u.𝚒𝚍 becomes no less than 2logN2 (lines 32–33). For the independence of random numbers, if both agents are candidates and generating random numbers, the responder becomes a follower (𝙵) by resetting 𝚒𝚍 to 1 (lines 30–31). Thirdly, if a candidate’s 𝚒𝚍 becomes no less than 2logN2, the candidate starts to broadcast its own 𝚒𝚍 to other agents (lines 34–35). This broadcast allows all agents to know the maximum 𝚒𝚍 of candidates. For i{0,1}, if ai is a candidate and ai.𝚒𝚍<a1i.𝚒𝚍 holds, ai becomes a follower (𝙵) and sets ai.𝚒𝚍 to a1i.𝚒𝚍. For i{0,1}, if ai is a follower and ai.𝚒𝚍>a1i.𝚒𝚍 holds, a1i sets a1i.𝚒𝚍 to ai.𝚒𝚍. To avoid generating new candidates when there are candidates in the population, for i{0,1}, if ai is a follower and a1i is a candidate, ai sets ai.𝚝𝚒𝚖𝚎𝚛𝙻𝙵 to 𝚝BC1 (lines 36–37). That is, we consider a1i has 𝚝𝚒𝚖𝚎𝚛𝙻𝙵=𝚝BC virtually. Eventually, all agents’ 𝚒𝚍s become the same, and most candidates become followers (and some candidates remain). The candidates measure until all candidates finish generating the 𝚒𝚍 and 𝚒𝚍s are broadcast for a sufficiently long time using 𝚝𝚒𝚖𝚎𝚛𝙻𝙵. A candidate decreases 𝚝𝚒𝚖𝚎𝚛𝙻𝙵 by 1 if the agent’s 𝚛𝚌 is 1 (lines 39). Finally, when a candidate’s 𝚝𝚒𝚖𝚎𝚛𝙻𝙵 becomes 0, the candidate becomes a new leader (𝙻0) and sets 𝚝𝚒𝚖𝚎𝚛𝙻𝙵 to 𝚝BC (lines 40). The range of generated identifiers (𝚒𝚍) is [2logN2,2logN2+1), so there exists a unique leader with high probability.

  5. v)

    Detect (lines 41–66) aims to determine whether there are multiple leaders or not. Leaders generate search viruses every time their 𝚝𝚒𝚖𝚎𝚛E becomes 0. If a0 or a1 is a candidate (𝙱), agents set their 𝚝𝚒𝚖𝚎𝚛E to 2𝚝BC to prevent generating a search virus (lines 41–42). Firstly, for i{0,1}, if ai is a leader (𝙻0 or 𝙻1) whose 𝚝𝚒𝚖𝚎𝚛E becomes 0, ai becomes 𝙻1 and starts generating random numbers to get the type of search virus (lines 44–45). At the beginning of generating random numbers, ai sets ai.𝚝𝚢𝚙𝚎 to 1. The way of generating random numbers is the same as 𝚒𝚍 generation. While generating random numbers, a leader sets own 𝚝𝚒𝚖𝚎𝚛E to 2𝚝BC to inform that there exist agents generating random numbers (lines 46–47). When a leader finished generating random numbers, the leader sets own 𝚝𝚒𝚖𝚎𝚛V to 2𝚝BC (lines 48–49). Secondly, agents detect multiple leaders if there are multiple leaders. 𝙻1 broadcasts the generated search virus to all agents via some agents until 𝚝𝚒𝚖𝚎𝚛V becomes 0 (lines 50–59). If a follower having search virus and a leader not having search virus interact except the cases their types are same, they set 𝚝𝚒𝚖𝚎𝚛𝙺𝙻 to 𝚝BC and the phase moves to Global Reset (lines 51–52). If a follower not having search virus and a leader having search virus interact, the follower set own 𝚝𝚒𝚖𝚎𝚛V to the leader’s 𝚝𝚒𝚖𝚎𝚛V1 and set own 𝚝𝚢𝚙𝚎 to the leader’s 𝚝𝚢𝚙𝚎 (lines 53–54). If a0 and a1 are followers and they have different types of search viruses, they set 𝚝𝚒𝚖𝚎𝚛𝙺𝙻 to 𝚝BC and move to Global Reset phase (lines 56–57). If a0 and a1 are followers and there exists ai,a1i agents satisfying ai.𝚝𝚒𝚖𝚎𝚛V=0 and a1i.𝚝𝚒𝚖𝚎𝚛V>0 for i{0,1}, ai.𝚝𝚒𝚖𝚎𝚛V is set to a1i.𝚝𝚒𝚖𝚎𝚛V1 and ai.𝚝𝚢𝚙𝚎 is set to a1i.𝚝𝚢𝚙𝚎 (lines 58–59). If a0 and a1 are leaders, they set 𝚝𝚒𝚖𝚎𝚛𝙺𝙻 to 𝚝BC and move to Global Reset phase (lines 60–61). Finally, both agents’ 𝚝𝚒𝚖𝚎𝚛V run Larger Time Propagation and decrease by 1 if ai.𝚛𝚌=1 holds (lines 62–63). For i{0,1}, if ai.𝚝𝚒𝚖𝚎𝚛V>0 holds, ai.𝚝𝚒𝚖𝚎𝚛E is set to 2𝚝BC to prevent generating a new search virus when there is a search virus in the population (line 65). For i{0,1}, if ai is a leader and ai.𝚝𝚒𝚖𝚎𝚛E becomes less than 𝚝BC/2, ai becomes 𝙻0 (line 66). The range of generating random numbers of types is [2logN,2logN+1), so when there are multiple leaders in the population, the types generated by leaders are not the same with high probability.

Lemma 6.

For any execution, all candidates’ 𝚒𝚍 no less than 2logN2are independent and uniform if they are started to be generated during the execution. All leaders’ 𝚝𝚢𝚙𝚎 no less than 2logN are independent and uniform if they are generated from the beginning of this execution.

4.3 Analysis

In this subsection, we analyze the expected convergence time and the expected holding time of 𝒫BC. We assume τmax(2d,logN/2,15+3logn), and 𝚝BC=16τ. We will prove the following equations under these assumptions:

maxC𝒮colorECT𝒫BC(C,𝒮LE)=O(mτlogn).

minC𝒮LEEHT𝒫BC(C,LE)=Ω(τeτ).

Here, 𝒮color and 𝒮LE are the sets of configurations described later.

We define the sets of configurations to prove the above equations:

𝒮color is the safe configurations of the self-stabilizing two-hop coloring.

𝒮color𝒮color is the set of configurations where each agent’s 𝚙𝚌𝚘𝚕 is the same as the last interacted agent’s color.

𝒦zero={C𝒮colorvV:C(v).𝚝𝚒𝚖𝚎𝚛𝙺𝙻=0}.

no={C𝒮colorvV:C(v).𝙻𝙵𝙱}.

one={C𝒮color|{vVC(v).𝙻𝙵{𝙻0,𝙻1}}|=1}.

qua={C𝒮colorvV:C(v).𝙻𝙵𝙱C(v).𝚝𝚒𝚖𝚎𝚛𝙻𝙵𝚝BC/2}.

v1={C𝒮colorvV:C(v).𝙻𝙵=𝙻1}.

𝒱clean={C𝒮colorvV:C(v).𝚝𝚒𝚖𝚎𝚛V=0}.

𝒱make={C𝒮colorvV:(C(v).𝙻𝙵=𝙻1C(v).𝚝𝚢𝚙𝚎<2logN)(C(v).𝙻𝙵𝙻1C(v).𝚝𝚒𝚖𝚎𝚛V=0)}.

𝒱only={C𝒮colorv,uV:C(v).𝚝𝚒𝚖𝚎𝚛V>0C(u).𝚝𝚒𝚖𝚎𝚛V>0C(v).𝚝𝚢𝚙𝚎=C(u).𝚝𝚢𝚙𝚎}{C𝒮colorvV:C(v).𝙻𝙵=𝙻1C(v).𝚝𝚢𝚙𝚎2logN.

half={C𝒮colorvV:C(v).𝙻𝙵{𝙻0,𝙻1}C(v).𝚝𝚒𝚖𝚎𝚛E𝚝BC}.

𝒮LE=noonequa𝒦zero(𝒱clean(v1(𝒱make𝒱only)half)).

4.3.1 Expected Holding Time

Lemma 7.

Let C0𝒮LE and Ξ𝒫BC(C0)=C0,C1,. If Pr(i[0,2mτ]:CiLEC2mτ𝒮LE)=1O(neτ) holds, then minC𝒮LEEHT𝒫BC(C,LE)=Ω(τeτ) holds.

Proof.

Let A=minC0𝒮LEEHT𝒫BC(C0,LE). We assume that C0,,C2mτLEC2mτ𝒮LE holds with probability at least p=1O(neτ). Then, We have Ap(2mτ+A). Solving this inequality gives A2mτ/(1p)=Ω(τeτ).

We say that an agent u encounters a counting interaction when u interacts with an agent v such that u.𝚌𝚘𝚕𝚘𝚛=v.𝚙𝚌𝚘𝚕 holds.

Lemma 8.

Let C0𝒮color and Ξ𝒫BC(C0)=C0,C1,. The probability that every agent encounters less than 𝚝BC/2 counting interactions while Γ0,,Γ2mτ1 is at least 1neτ.

Lemma 9.

Let C0𝒮color and Ξ𝒫BC(C0)=C0,C1,. For any x{𝙻𝙵,𝙺𝙻,E,V}, and for any y𝚝BC/2 such that y is no more than the maximum value of the domain of 𝚝𝚒𝚖𝚎𝚛x, when vV:C0(v).𝚝𝚒𝚖𝚎𝚛xy holds, the probability that uV:C2mτ(u).𝚝𝚒𝚖𝚎𝚛x>y𝚝BC/2 holds is at least 12neτ.

Lemma 10.

Let C0𝒮color and Ξ𝒫BC(C0)=C0,C1,. For any integer λ>0, and any integer x satisfying 𝚝BCx2𝚝BC, if vV:C0(v).𝚝𝚒𝚖𝚎𝚛𝙻𝙵xi[0,λ1],vV:C2miτ(v).𝚝𝚒𝚖𝚎𝚛𝙻𝙵x holds, then Pr(j[0,2mλτ],vV:Cj(v).𝚝𝚒𝚖𝚎𝚛𝙻𝙵>x𝚝BCC2mλτ(v).𝚝𝚒𝚖𝚎𝚛𝙻𝙵x𝚝BC/2)13λneτ holds.

Proof.

Since there exists an agent u satisfying u.𝚝𝚒𝚖𝚎𝚛𝙻𝙵x in C0, the probability that every agent’s 𝚝𝚒𝚖𝚎𝚛𝙻𝙵x𝚝BC/2 holds in C2mτ is at least 12neτ from Lemma 9. Since there is every agent u satisfying u.𝚝𝚒𝚖𝚎𝚛𝙻𝙵x𝚝BC/2 in C0, Pr(j[0,2mτ],vV:Cj(v).𝚝𝚒𝚖𝚎𝚛𝙻𝙵>x𝚝BC)1neτ holds from Lemma 8. Thus, Pr(j[0,2mτ],vV:Cj(v).𝚝𝚒𝚖𝚎𝚛𝙻𝙵>x𝚝BCC2mτ(v).𝚝𝚒𝚖𝚎𝚛𝙻𝙵x𝚝BC/2)13neτ holds by the union bound. Repeating this λ times, we get Pr(j[0,2mλτ],vV:Cj(v)>x𝚝BCC2mλτ(v).𝚝𝚒𝚖𝚎𝚛𝙻𝙵x𝚝BC/2)13λneτ by the union bound.

We can prove Lemma 11 by the same way of Lemma 10, and Lemma 12 by assigning λ=1 to Lemma 10. Lemma 13,  14, and 15 analyzes the probability that configuration keep some condition for some interval.

Lemma 11.

Let C0𝒮color and Ξ𝒫BC(C0)=C0,C1,. For any integer λ>0, and any integer x satisfying 𝚝BCx2𝚝BC, if vV:C0(v).𝚝𝚒𝚖𝚎𝚛Exi[0,λ1],vV:C2miτ(v).𝚝𝚒𝚖𝚎𝚛Ex holds, then Pr(i[0,2mλτ],vV:Ci(v).𝚝𝚒𝚖𝚎𝚛E>x𝚝BCC2mλτ(v).𝚝𝚒𝚖𝚎𝚛Ex𝚝BC/2)13λneτ holds.

Lemma 12.

Let C0𝒮LE and Ξ𝒫BC(C0)=C0,C1,. Pr(i[0,2mτ]:CinoC2mτqua)13neτ holds.

Lemma 13.

Let C0𝒮LE𝒱clean and Ξ𝒫BC(C0)=C0,C1,. Pr(i[0,2mτ]:CioneC2mτ𝒮LE(𝒱cleanv1(𝒱make𝒱only)half)15neτ holds.

Lemma 14.

Let C0𝒮LEv1𝒱makehalf and Ξ𝒫BC(C0)=C0,C1,. Pr(i[0,2mτ]:CioneC2mτ𝒮LEv1(𝒱make𝒱only)half)13neτ holds.

Lemma 15.

Let C0𝒮LEv1𝒱onlyhalf and Ξ𝒫BC(C0)=C0,C1,. Pr(i[0,2mτ]:CioneC2mτ𝒮LE(𝒱cleanv1𝒱onlyhalf)15neτ holds.

Lemma 16.

minC𝒮LEEHT𝒫BC(C,LE)=Ω(τeτ).

Proof.

Let C0𝒮LE. Pr(C0,,C2mτLEC2mτ𝒮LE)15neτ=1O(neτ) from Lemma 13, Lemma 14, and Lemma 15. Thus, this lemma follows from Lemma 7.

4.3.2 Expected Convergence Time

We first analyze the number of interactions until all timers converge to 0 with high probability. Let λ𝚝BC be the maximum value of the domain of timers, that is, λ=1 for 𝚝𝚒𝚖𝚎𝚛𝙺𝙻 and λ=2 for 𝚝𝚒𝚖𝚎𝚛𝙻𝙵, 𝚝𝚒𝚖𝚎𝚛V, and 𝚝𝚒𝚖𝚎𝚛E.

Lemma 17.

Let C0𝒮color and Ξ𝒫BC(C0)=C0,C1,. For any x{𝙻𝙵,𝙺𝙻,V,E}, if every agent’s 𝚝𝚒𝚖𝚎𝚛x increases only by Larger Time Propagation (not including setting to a specific value like 𝚝BC by leaders etc.), the number of interactions until every agent’s 𝚝𝚒𝚖𝚎𝚛x becomes 0 is less than 2340λmτlogn with probability at least 1eλτ.

Proof.

Let z=maxvV(Ci(v).𝚝𝚒𝚖𝚎𝚛x)(i>0). From the mechanism of Larger Time Propagation, for every agent v, Ci(v).𝚝𝚒𝚖𝚎𝚛x does not become z if Ci1(v).𝚝𝚒𝚖𝚎𝚛x<z. Thus, when every agent decreases its timer by at least 1 from Cj,,Ci(0j<i), maxvV(Ci(v).𝚝𝚒𝚖𝚎𝚛x)maxvV(Cj(v).𝚝𝚒𝚖𝚎𝚛x)1 holds (i.e., , the maximum value of 𝚝𝚒𝚖𝚎𝚛x decreases by at least 1). Let XBi(2m,δv/m) be a binomial random variable that represents the number of interactions of an agent v interacts during 2m interactions. From Chernoff Bound (Eq. 4.5 in [14]), Pr(Xδv)Pr(X>δv)=1Pr(Xδv)=1Pr(X(11/2)E[X])1eδv/81e1/4>1/5. Thus, the probability that an agent v interacts no less than δv times during 2m interactions is at least 1/5. Let YBi(δv,2/δv) be a binomial random variable that represents the number of counting interactions that an agent v encounters during δv interactions in which an agent v interacts. The probability that Y=0 is Pr(Y=0)=(12δv)δve2<1/5. Thus, the probability that an agent v encounters at least one counting interaction is at least 4/5. Let Ev denote the number of interactions until an agent v decreases its 𝚝𝚒𝚖𝚎𝚛x by at least 1. Since Ev2m+(14/25)Ev holds, Ev13m holds. By Markov’s inequality, the probability that an agent v does not decrease 𝚝𝚒𝚖𝚎𝚛x during 2Ev interactions is no more than 1/2. Thus, the probability that an agent v does not decrease 𝚝𝚒𝚖𝚎𝚛x during 4lognEv interactions is no more than n2. By the union bound, the probability that every agent v does not decrease 𝚝𝚒𝚖𝚎𝚛x during 4lognEv interactions is no more than n1. Let A be an event that every agent v decreases 𝚝𝚒𝚖𝚎𝚛x by at least 1 during 4lognEv interactions. We consider the expected number of times until A succeeds 16λτ(=λ𝚝BC) times using geometric distributions. In other words, for k[1,16λτ], let ZkGeom(pk) be the independent geometric random variable such that pk=11/n1/2. Considering the sum of independent random variables Z=k=116λτZk. Note that E[Z]32λτ holds. From Janson’s inequality (Theorem 2.1 in [13]), Pr(Z45λτ)Pr(Z1.432λτ)Pr(Z1.4E[Z])epiE[Z](1.41loge1.4)e16λτ(1.41loge1.4)eλτ. Thus, the expected number of times that A succeeds 16λτ times is less than 45λτ with probability at least 1eλτ. Therefore, the number of interactions until all agents’ 𝚝𝚒𝚖𝚎𝚛x becomes 0 is 45λτ4lognEv2340λmτlogn with probability at least 1eλτ.

Lemma 18 shows a convergence time.

Lemma 18.

Let C0𝒮color and Ξ𝒫BC(C0)=C0,C1,. The number of interactions until the configuration reaches 𝒮LE is O(mτlogn) with probability 1o(1).

Theorem 19.

Protocol 𝒫BC is a randomized (O(m(n+τlogn)),Ω(τeτ))-loosely-stabilizing leader election protocol for arbitrary graphs when τmax(2d,logN/2,15+3logn)  if 𝒫LRU is used for two-hop coloring.

Theorem 20.

Protocol 𝒫BC is a deterministic (O(m(n+ΔlogN+τlogn)),Ω(τeτ))-loosely-stabilizing leader election protocol for arbitrary graphs when τmax(2d,logN/2,15+3logn)  if 𝒫LRU is used for two-hop coloring.

5 Conclusion

New loosely-stabilizing leader election population protocols on arbitrary graphs without identifiers are proposed. One is randomized, and the other is deterministic. The randomized one converges within O(mNlogn) steps, while the deterministic one converges O(mNlogN) steps both in expectations and with high probability. Both protocols hold a unique leader with Ω(Ne2N) expected steps and utilizes O(ΔlogN) bits of memory. The convergence time is close to the known lower bound of Ω(mN).

References

  • [1] Dan Alistarh, Rati Gelashvili, and Joel Rybicki. Fast Graphical Population Protocols. In 25th International Conference on Principles of Distributed Systems (OPODIS 2021), volume 217, pages 14:1–14:18, 2022. doi:10.4230/LIPICS.OPODIS.2021.14.
  • [2] Dan Alistarh, Joel Rybicki, and Sasha Voitovych. Near-optimal leader election in population protocols on graphs. In Proceedings of the 2022 ACM Symposium on Principles of Distributed Computing, pages 246–256, 2022. doi:10.1145/3519270.3538435.
  • [3] Dana Angluin, James Aspnes, Zoë Diamadi, Michael J. Fischer, and René Peralta. Computation in networks of passively mobile finite-state sensors. Distributed Computing, 18(4):235–253, 2006. doi:10.1007/S00446-005-0138-3.
  • [4] Dana Angluin, James Aspnes, Michael J. Fischer, and Hong Jiang. Self-stabilizing population protocols. ACM Trans. Auton. Adapt. Syst., 3(4), 2008. doi:10.1145/1452001.1452003.
  • [5] Joffroy Beauquier, Peva Blanchard, and Janna Burman. Self-stabilizing leader election in population protocols over arbitrary communication graphs. In Principles of Distributed Systems, pages 38–52, 2013. doi:10.1007/978-3-319-03850-6_4.
  • [6] Petra Berenbrink, George Giakkoupis, and Peter Kling. Optimal time and space leader election in population protocols. In Proceedings of the 52nd Annual ACM SIGACT Symposium on Theory of Computing, pages 119–129, 2020. doi:10.1145/3357713.3384312.
  • [7] Janna Burman, Ho-Lin Chen, Hsueh-Ping Chen, David Doty, Thomas Nowak, Eric Severson, and Chuan Xu. Time-optimal self-stabilizing leader election in population protocols. In Proceedings of the 2021 ACM Symposium on Principles of Distributed Computing, pages 33–44, 2021. doi:10.1145/3465084.3467898.
  • [8] Shukai Cai, Taisuke Izumi, and Koichi Wada. How to prove impossibility under global fairness: On space complexity of self-stabilizing leader election on a population protocol model. Theory of Computing Systems, 50(3):433–445, 2012. doi:10.1007/S00224-011-9313-Z.
  • [9] Davide Canepa and Maria Gradinariu Potop-Butucaru. Stabilizing leader election in population protocols. Research Report RR-6269, INRIA, 2007.
  • [10] Michael Fischer and Hong Jiang. Self-stabilizing leader election in networks of finite-state anonymous agents. In Principles of Distributed Systems, pages 395–409, 2006. doi:10.1007/11945529_28.
  • [11] Leszek Gąsieniec, Grzegorz Stachowiak, and Przemyslaw Uznanski. Almost logarithmic-time space optimal leader election in population protocols. In The 31st ACM Symposium on Parallelism in Algorithms and Architectures, pages 93–102, 2019. doi:10.1145/3323165.3323178.
  • [12] Taisuke Izumi. On space and time complexity of loosely-stabilizing leader election. In Structural Information and Communication Complexity, pages 299–312, 2015. doi:10.1007/978-3-319-25258-2_21.
  • [13] Svante Janson. Tail bounds for sums of geometric and exponential variables. Statistics & Probability Letters, 135:1–6, 2018.
  • [14] Michael Mitzenmacher and Eli Upfal. Probability and Computing: Randomized Algorithms and Probabilistic Analysis. Cambridge University Press, 2005. doi:10.1017/CBO9780511813603.
  • [15] Yuichi Sudo, Ryota Eguchi, Taisuke Izumi, and Toshimitsu Masuzawa. Time-Optimal Loosely-Stabilizing Leader Election in Population Protocols. In 35th International Symposium on Distributed Computing (DISC 2021), volume 209, pages 40:1–40:17, 2021. doi:10.4230/LIPICS.DISC.2021.40.
  • [16] Yuichi Sudo, Junya Nakamura, Yukiko Yamauchi, Fukuhito Ooshita, Hirotsugu Kakugawa, and Toshimitsu Masuzawa. Loosely-stabilizing leader election in a population protocol model. Theoretical Computer Science, 444:100–112, 2012. doi:10.1016/J.TCS.2012.01.007.
  • [17] Yuichi Sudo, Fukuhito Ooshita, Taisuke Izumi, Hirotsugu Kakugawa, and Toshimitsu Masuzawa. Time-optimal leader election in population protocols. IEEE Transactions on Parallel and Distributed Systems, 31(11):2620–2632, 2020. doi:10.1109/TPDS.2020.2991771.
  • [18] Yuichi Sudo, Fukuhito Ooshita, Hirotsugu Kakugawa, and Toshimitsu Masuzawa. Loosely-stabilizing leader election on arbitrary graphs in population protocols. In Principles of Distributed Systems, pages 339–354, 2014. doi:10.1007/978-3-319-14472-6_23.
  • [19] Yuichi Sudo, Fukuhito Ooshita, Hirotsugu Kakugawa, and Toshimitsu Masuzawa. Loosely stabilizing leader election on arbitrary graphs in population protocols without identifiers or random numbers. IEICE Transactions on Information and Systems, E103.D(3):489–499, 2020. doi:10.1587/TRANSINF.2019FCP0003.
  • [20] Yuichi Sudo, Fukuhito Ooshita, Hirotsugu Kakugawa, Toshimitsu Masuzawa, Ajoy K. Datta, and Lawrence L. Larmore. Loosely-stabilizing leader election for arbitrary graphs in population protocol model. IEEE Transactions on Parallel and Distributed Systems, 30(6), 2019. doi:10.1109/TPDS.2018.2881125.
  • [21] Yuichi Sudo, Fukuhito Ooshita, Hirotsugu Kakugawa, Toshimitsu Masuzawa, Ajoy K. Datta, and Lawrence L. Larmore. Loosely-stabilizing leader election with polylogarithmic convergence time. Theoretical Computer Science, 806:617–631, 2020. doi:10.1016/J.TCS.2019.09.034.
  • [22] Yuichi Sudo, Masahiro Shibata, Junya Nakamura, Yonghwan Kim, and Toshimitsu Masuzawa. Self-stabilizing population protocols with global knowledge. IEEE Transactions on Parallel and Distributed Systems, 32(12):3011–3023, 2021. doi:10.1109/TPDS.2021.3076769.