Election in the Complete Graph 3 6 8 2 1 5 7 4 Paola Flocchini Trivial Algorithm. Ask neighbours one at a time 3 2 I am 1 You win 1 5 7 Paola Flocchini 6 Trivial Algorithm. Ask neighbours one at a time 3 2 1 5 7 Paola Flocchini 6 Message Complexity O(n2) Paola Flocchini Better Algorithm Ideas: - In stages - Territory acquisition (capture neighbours) ensuring that a node is captured by at most one candidate in the same stage - Disjoint territories Paola Flocchini A node attacks another node, if successful it captures the node increasing the size of its territory (= stage number) Defeated nodes become captured (belonging to a owner) and stop attacking CANDIDATE: still playing trying to increase the territory PASSIVE: transitional phase, will not attack anymore, will eventually become captured CAPTURED: belong to a territory, owned by a candidate An attack could reach candidate passive captured Paola Flocchini 4 territories Paola Flocchini 8 3 The Attack Bigger territories win over smaller ones (i.e. higher stages) In case of tie, smaller Ids win 8 8 Paola Flocchini 4 3 The Attack Bigger territories win over smaller ones (i.e. higher stages) In case of tie, smaller Ids win 8 8 Paola Flocchini 4 3 Attacking a candidate Send capture message to one neighbour (stage,Id:3) captured 8 3 8 3 Increase territory and stage (+1) (stage,Id:3) reject 8 3 Paola Flocchini 3 If still candidate, 3 becomes passive 8 Attacking a passive 3 8 Paola Flocchini Attacking a passive captured 3 8 Increase territory and stage (+1) Paola Flocchini Attacking a captured 8 3 3 If I know I belong to a bigger territory 8 3 becomes passive, if still candidate Not sure, ask my owner 8 3 Paola Flocchini 3 8 Attacking a captured 8 3 3 If I know I belong to a bigger territory 8 Not sure, ask my owner 8 3 Paola Flocchini 3 8 Increase territory and stage (+1) Attacking a captured 8 3 3 If I know I belong to a bigger territory 8 Not sure, ask my owner 8 3 Paola Flocchini 3 8 3 becomes passive, if still candidate passive candidate captured Paola Flocchini When to terminate ? When does a candidate become a leader ? When it captures more than n/2 nodes If a candidate has captured more than n/2 nodes nobody else can become leader Paola Flocchini Important The territories of any two candidates are disjoint Because at any time, any node has only ONE owner. 3 Each territory is rooted in its owner 6 8 2 1 Paola Flocchini 5 7 4 Paola Flocchini We need: number of stages and messages per stage Paola Flocchini Messages per attack candidate --- candidate 2 msgs candidate --- passive 2 msgs candidate --- captured 4 msgs At most 4 messages per attack Paola Flocchini Number of stages A candidate with n/2 +1 captured nodes becomes leader and notify n/2 +1 stages Paola Flocchini How many candidates in each stage ? Stage i ---> territory of size i With disjoint territories There cannot be more than n/i candidates in stage i ni n/i Paola Flocchini i i i i i Message Complexity At most 4 messages per attack ni n/i Messages in stage i 4 n/i Harmonic number Hn/2 n/2 O( 1 4 n/i) = O( n/2 4n 1/i ) 1 M(completeElect) = O(n log n) Paola Flocchini = O(log n) Election in a Complete Graph with Chordal Sense of Direction 1 5 1 2 5 4 3 1 2 3 5 4 4 3 2 3 4 2 5 4 3 1 3 2 4 2 1 5 1 5 Any ring algorithm IDEA: Put information in messages. At the next step, use a smaller Paola Flocchini ring. (Id:3, originLink: 1) 6 1 8 7 6 1 2 1 7 2 5 4 3 2 6 4 3 5 8-1=7. the message was originated from my neighbour 7 6 5 3 1 4 2 3 6 5 4 4 3 5 6 1 2 3 4 5 6 5 3 7 2 1 Paola Flocchini 1 3 7 3 4 4 5 4 2 1 6 7 5 6 7 7 2 7 2 1 (Id:3, originLink: 1) 3 7 6 1 8 1 7 2 7 6 5 5 (Id:3, originLink: 2) 6 4 3 1 2 4 3 6 5 4 4 3 5 6 1 2 3 4 5 6 5 3 7 2 1 Paola Flocchini 3 3 6 2 2 5 4 7 1 1 3 4 4 5 4 2 1 6 7 5 6 7 7 2 7 2 1 Modulo 8 3 7 6 1 8 1 7 2 7 6 5 5 (Id:3, originLink: 2) 6 4 3 1 2 4 3 6 5 4 4 3 5 6 1 2 3 4 5 6 5 3 7 2 1 Paola Flocchini 3 3 6 2 2 5 4 7 1 1 3 4 4 5 4 2 1 6 7 5 6 7 7 2 Which means my link 8-2=6 7 2 1 Similarly for the other candidates Modulo 8 3 7 6 1 8 1 7 2 7 6 5 5 6 4 3 1 2 4 (Id:2, originLink: 6) 3 6 5 4 4 3 5 6 1 2 3 4 5 6 5 3 7 2 1 Paola Flocchini 3 3 6 2 2 5 4 7 1 1 3 4 4 5 4 2 1 6 7 5 6 7 7 2 7 2 1 Similarly for the other candidates Modulo 8 (Id:2, originLink: 6+6=4) 3 7 6 1 8 1 7 2 7 6 5 5 6 4 3 1 2 4 (Id:2, originLink: 6) 3 6 5 4 4 3 5 6 1 2 3 4 5 6 5 3 7 2 1 Paola Flocchini 3 3 6 2 2 5 4 7 1 1 3 4 4 5 4 2 1 6 7 5 6 7 7 2 7 2 1 Similarly for the other candidates Modulo 8 3 7 6 1 8 Which means my 8-4=4 1 7 2 7 6 5 5 6 4 3 1 2 4 3 6 5 4 4 3 5 6 1 2 3 4 5 6 5 3 7 2 1 Paola Flocchini 3 3 6 2 2 5 4 7 1 1 3 4 4 5 4 2 1 6 7 5 6 7 7 2 7 2 1 Similarly for the other candidates Modulo 8 3 7 6 1 8 1 7 2 7 6 5 5 6 4 3 1 2 4 3 6 5 4 4 3 5 6 1 2 3 4 5 6 5 3 7 2 1 Paola Flocchini 3 3 6 2 2 5 4 7 1 1 3 4 4 5 4 2 1 6 7 5 6 7 7 2 7 2 1 Message Complexity Planar graph - 2 messages per edge O(n) [because a planar graph has O(n) edges] Paola Flocchini
© Copyright 2026 Paperzz