selecting leader in a clique in o (n log n) by pierre a.humblet

142
1 Selecting leader in a clique in O (n log n) By Pierre A.Humblet Presented by: Anat Berkman, 236357 Distributed Algorithms , Technion

Upload: yestin

Post on 24-Feb-2016

31 views

Category:

Documents


0 download

DESCRIPTION

Selecting leader in a clique in O (n log n) By Pierre A.Humblet Presented by: Anat Berkman, 236357 Distributed Algorithms , Technion. Problem background. Arbitrary non empty subset wake up spontaneously ans start executing common asynchronous distributed algorithm. 5. 17. 4. 3. 1. 2. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

1

Selecting leader in a clique inO (n log n)

By Pierre A.Humblet

Presented by: Anat Berkman, 236357 Distributed Algorithms , Technion

Page 2: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

2

Problem background

Arbitrary non empty subset wake up spontaneously ans start executing common asynchronous distributed algorithm

5 17

19 2

67

1 2

3

4

4

32

1

Page 3: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

3

Assumption

● Messages arrive without error after an arbitrary but finite delay

Page 4: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

4

The algorithm

● Main idea : as long as a node did not surrender he tries to capture other nodes according to the edges. First he tries to capture the node at the end point of edge #1, then #2 and so on.

5 17

19 2

67

1 2

3

4

4

32

1

Page 5: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

5

5 wants to capture 17

5 172. Let me ask my master

3. Master, 5 want to have a fight1. TEST: I want to capture you!

174. Lets have a fight: 5 vs 17

Page 6: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

6

5 wants to capture 17

5 172. Let me ask my master

3. Master, 5 want to have a fight1. TEST: I want to capture you!

174. Lets have a fight: 5 vs 17

5. Answer to the fight6. If 5 won- tell him

Page 7: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

7

Wake up call

WINNER(A)

A: B:

Page 8: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

8

Wake up call

WINNER(A)

A:STATE:active

SIZE:0MASTER:A

B:STATE:active

SIZE:0MASTER:B

STATE is active\stopped. Active means he was not captured yetSIZE is the size of my kingdom MASTER is the identity of my master

Page 9: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

9

A process the message of type “WINNER”

A:STATE:active

SIZE:0MASTER:A

WINNER(A)

If ID=id (yes)if state='active' then SIZE=SIZE+1If SIZE=N stopif STATE='active' then

send TEST(SIZE,ID) on edge SIZE

B:STATE:active

SIZE:0MASTER:B

Page 10: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

10

A process the message of type “WINNER”

A:STATE:active

SIZE:1MASTER:A

WINNER(A)

If ID=id (yes)if state='active' then SIZE=SIZE+1if SIZE=N stop!if STATE='active' then

send TEST(SIZE,ID) on edge SIZE

B:STATE:active

SIZE:0MASTER:B

Page 11: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

11

A process the message of type “WINNER”

A:STATE:active

SIZE:1MASTER:A

WINNER(A)

If ID=id (yes)if state='active' then SIZE=SIZE+1if SIZE=N stop!if STATE='active' then

send TEST(SIZE,ID) on edge SIZE

B:STATE:active

SIZE:0MASTER:B

Page 12: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

12

A process the message of type “WINNER”

A:STATE:active

SIZE:1MASTER:A

WINNER(A)

If ID=id (yes)If STATE='active' then SIZE=SIZE+1If SIZE=N stopif STATE='active' then

Send TEST(SIZE,ID) on edge SIZE

B:STATE:active

SIZE:0MASTER:B

TEST(1,A)

Page 13: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

13

B process the message of type “TEST” on edge 1

A:STATE:active

SIZE:1MASTER:A

WINNER(A)

If e >= SIZE then: \\{not in our domain, tell the master}EDGE_TO(id)=ePENDING=PENDING+1IF PENDING=1 then send TEST(size,id) on EDGE_TO(MASTER)

else put TEST(size,if) in PENDING_SET

B:STATE:active

SIZE:0MASTER:B

TEST(1,A)EDGE_TO(MASTER)= -1

Page 14: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

14

B process the message of type “TEST” on edge 1

A:STATE:active

SIZE:1MASTER:A

WINNER(A)

If e >= SIZE then: \\{not in our domain, tell the master}EDGE_TO(id)=e \\{not in our domain, tell the master}PENDING=PENDING+1IF PENDING=1 then send TEST(size,id) on EDGE_TO(MASTER)

else put TEST(size,if) in PENDING_SET

B:STATE:active

SIZE:0MASTER:B

TEST(1,A)EDGE_TO(MASTER)=-1EDGE_TO(A)=1

Page 15: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

15

B process the message of type “TEST” on edge 1

A:STATE:active

SIZE:1MASTER:A

WINNER(A)

If e >= SIZE then: \\{not in our domain, tell the master}EDGE_TO(id)=ePENDING=PENDING+1IF PENDING=1 then send TEST(size,id) on EDGE_TO(MASTER)

else put TEST(size,if) in PENDING_SET

B:STATE:active

SIZE:0MASTER:B

TEST(1,A)EDGE_TO(MASTER)=-1EDGE_TO(A)=1PENDING=0+1=1

PENDING is the number of messages I received but did not finished responding

Page 16: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

16

B process the message of type “TEST” on edge 1

A:STATE:active

SIZE:1MASTER:A

WINNER(A)

If e >= SIZE then: \\{not in our domain, tell the master}EDGE_TO(id)=ePENDING=PENDING+1IF PENDING=1 then send TEST(size,id) on EDGE_TO(MASTER)

else put TEST(size,if) in PENDING_SET

B:STATE:active

SIZE:0MASTER:B

TEST(1,A)

EDGE_TO(MASTER)=-1EDGE_TO(A)=1PENDING=0+1=1

TEST(1,A)

Page 17: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

17

B process the message of type “TEST” on edge -1

A:STATE:active

SIZE:1MASTER:A

WINNER(A)

If e >= SIZE then: \\{not in our domain, tell the master}EDGE_TO(id)=ePENDING=PENDING+1IF PENDING=1 then send TEST(size,id) on EDGE_TO(MASTER)

else put TEST(size,if) in PENDING_SET

B:STATE:active

SIZE:0MASTER:B

TEST(1,A)

EDGE_TO(MASTER)=-1EDGE_TO(A)=1PENDING=0+1=1

TEST(1,A)

Page 18: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

18

B process the message of type “TEST” on edge -1

A:STATE:active

SIZE:1MASTER:A

WINNER(A)

If e >= SIZE then: \\{not in our domain, tell the master}EDGE_TO(id)=ePENDING=PENDING+1IF PENDING=1 then send TEST(size,id) on EDGE_TO(MASTER)

else put TEST(size,if) in PENDING_SETelse \\(e<SIZE)

If (size,id) > (SIZE,ID) thenSTATE='stopped'send WINNER(id) on edge e

B:STATE:stopped

SIZE:0MASTER:B

TEST(1,A)

EDGE_TO(MASTER)=-1EDGE_TO(A)=1PENDING=0+1=1

TEST(1,A)

Page 19: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

19

B process the message of type “TEST” on edge -1

A:STATE:active

SIZE:1MASTER:A

WINNER(A)

If e >= SIZE then: \\{not in our domain, tell the master}EDGE_TO(id)=ePENDING=PENDING+1IF PENDING=1 then send TEST(size,id) on EDGE_TO(MASTER)

else put TEST(size,if) in PENDING_SETelse \\(e<SIZE)

If (size,id) > (SIZE,ID) then \\if (1,A) > (0,B) YES!!!! lexicographic orderSTATE='stopped'send WINNER(id) on edge e

B:STATE:stopped

SIZE:0MASTER:B

TEST(1,A)

EDGE_TO(MASTER)=-1EDGE_TO(A)=1PENDING=0+1=1

TEST(1,A)WINNER(A)

Page 20: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

20

B process the message of type “WINNER(A)” on edge -1

A:STATE:active

SIZE:1MASTER:A

WINNER(A)B:

STATE:stoppedSIZE:0

MASTER:A

TEST(1,A)

EDGE_TO(MASTER)=-1EDGE_TO(A)=1PENDING=0+1=1

TEST(1,A)WINNER(A)If ID=id

ElseIf MASTER <> id //if B<>A

MASTER=idsend WINNER(id) on EDGE_TO(A)

PENDING=PENDING-1If PENDING > 0 then ..

Page 21: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

21

B process the message of type “WINNER(A)” on edge -1

A:STATE:active

SIZE:1MASTER:A

WINNER(A)B:

STATE:stoppedSIZE:0

MASTER:A

TEST(1,A)

EDGE_TO(MASTER)=-1EDGE_TO(A)=1PENDING=0+1=1

TEST(1,A)WINNER(A)If ID=id

ElseIf MASTER <> id //if B<>A

MASTER=idsend WINNER(id) on EDGE_TO(A)

PENDING=PENDING-1If PENDING > 0 then ..

WINNER(A)

Page 22: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

22

B process the message of type “WINNER(A)” on edge -1

A:STATE:active

SIZE:1MASTER:A

WINNER(A)B:

STATE:stoppedSIZE:0

MASTER:A

TEST(1,A)

EDGE_TO(MASTER)=-1EDGE_TO(A)=1PENDING=1-1=0

TEST(1,A)WINNER(A)If ID=id

ElseIf MASTER <> id //if B<>A

send WINNER(id) on EDGE_TO(A)PENDING=PENDING-1If PENDING > 0 then ..

WINNER(A)

Page 23: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

23

A process the message of type “WINNER(A)” on edge 1

A:STATE:active

SIZE:1MASTER:A

WINNER(A)B:

STATE:stoppedSIZE:0

MASTER:A

TEST(1,A)

EDGE_TO(MASTER)=-1EDGE_TO(A)=1PENDING=1-1=0

TEST(1,A)WINNER(A)If ID=id

ElseIf MASTER <> id //if B<>A

send WINNER(id) on EDGE_TO(A)PENDING=PENDING-1If PENDING > 0 then ..

WINNER(A)

Page 24: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

24

A process the message of type “WINNER(A)” on edge 1

A:STATE:active

SIZE:2MASTER:A

WINNER(A)B:

STATE:stoppedSIZE:0

MASTER:A

TEST(1,A)

EDGE_TO(MASTER)=-1EDGE_TO(A)=1PENDING=1-1=0

TEST(1,A)WINNER(A)If ID=id \\ if A=A

if STATE='active then SIZE=SIZE+1 if SIZE=N then STOP

ElseIf MASTER <> id //if B<>A

send WINNER(id) on EDGE_TO(A)PENDING=PENDING-1If PENDING > 0 then ..

WINNER(A)

Page 25: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

25

A process the message of type “WINNER(A)” on edge 1

A:STATE:active

SIZE:1MASTER:A

WINNER(A)B:

STATE:stoppedSIZE:0

MASTER:A

TEST(1,A)

EDGE_TO(MASTER)=-1EDGE_TO(A)=1PENDING=1-1=0

TEST(1,A)WINNER(A)If ID=id \\ if A=A

if STATE='active then SIZE=SIZE+1 if SIZE=N then STOP – you are the leader!!!!!!!!!!

ElseIf MASTER <> id //if B<>A

send WINNER(id) on EDGE_TO(A)PENDING=PENDING-1If PENDING > 0 then ..

WINNER(A)

Page 26: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

26

The algorithm

● When node ID receive WINNER(id) :if ID=id then

if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been

lost send TEST(SIZE,ID) on

edge SIZE● else if MASTER <>id then

MASTER=id send WINNER(id) on EDGE_TO(id)

PENDING=PENDING-1● if PENDING > 0 then send a message

from

PENDING_SET on edge EDGE_TO(MASTER)

Page 27: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

27

The algorithm

● When node ID receive TEST(size,id) on edge e:● if e < SIZE then//message comes from our

domainif (size,id) > (SIZE,ID) then //lexicographic

STATE='stopped' send WINNER(id) on edge e

else send WINNER(ID) on edge e

else //message from outsize the domainEDGE_TO(id) = ePENDING = PENDING +1if PENDING =1 then

send TEST(size,id) on EDGE_TO(MASTER)

else put TEST(size,id) in

PENDING_SET

Page 28: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

28

STATE active

SIZE 0

MASTER B

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER C

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

ExampleSTATE active

SIZE 0

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

WINNER(A)

A:

WINNER(C)

C:

D:

B:

E:

WINNER(D)

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

Page 29: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

29

STATE active

SIZE 0

MASTER B

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER C

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

A<B<C<D<...STATE active

SIZE 0

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

WINNER(A)

A:

WINNER(C)

C:

D:

B:

E:

WINNER(D)

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

Page 30: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

30

if ID=id then if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE active

SIZE 0

MASTER B

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER C

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

ASTATE active

SIZE 1

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

WINNER(A)

A:

WINNER(C)

C:

D:

B:

E:

WINNER(D)

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

Page 31: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

31

if ID=id then if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE active

SIZE 0

MASTER B

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER C

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

ASTATE active

SIZE 1

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

WINNER(A)

A:

WINNER(C)

C:

D:

B:

E:

WINNER(D)

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

Page 32: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

32

if ID=id then if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE active

SIZE 0

MASTER B

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER C

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

ASTATE active

SIZE 1

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

WINNER(A)

A:

WINNER(C)

C:

D:

B:

E:

WINNER(D)

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

TEST(1,A)

F GF

H

I J

Page 33: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

33

if ID=id then if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE active

SIZE 0

MASTER B

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 1

MASTER C

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

CSTATE active

SIZE 1

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

WINNER(A)

A:

WINNER(C)

C:

D:

B:

E:

WINNER(D)

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

TEST(1,C)

F GF

H

I J

Page 34: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

34

If e < SIZE //message comes from our Else //message from outsize the domain

EDGE_TO(id) = ePENDING = PENDING +1If PENDING =1 then send TEST(size,id) on EDGE_TO(MASTER)

else put TEST(size,id) in PENDING_SET

STATE active

SIZE 0

MASTER B

PENDING

1

EDGE_TO

A-1

INPUT_SET

PENDING_SET

STATE active

SIZE 1

MASTER C

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

B-process A's messageSTATE active

SIZE 1

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

WINNER(A)

A:

WINNER(C)

C:

D:

B:

E:

WINNER(D)

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

TEST(1,A)

F GF

H

I J

Page 35: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

35

If e < SIZE //message comes from our Else //message from outsize the domain

EDGE_TO(id) = ePENDING = PENDING +1If PENDING =1 then send TEST(size,id) on EDGE_TO(MASTER)

else put TEST(size,id) in PENDING_SET

STATE active

SIZE 0

MASTER B

PENDING

2

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

TEST(1,C)

STATE active

SIZE 1

MASTER C

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 1

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

WINNER(A)

A:

WINNER(C)

C:

D:

B:

E:

WINNER(D)

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

B-process C's message(1,C)

Page 36: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

36

If e < SIZE //message comes from our Else //message from outsize the domain

EDGE_TO(id) = ePENDING = PENDING +1If PENDING =1 then

send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET

STATE active

SIZE 0

MASTER B

PENDING

2

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

TEST(1,C)

STATE active

SIZE 1

MASTER C

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 1

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

B-process B's message (test(1,A))

WINNER(A)

A:

WINNER(C)

C:

D:

B:

E:

WINNER(D)

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

Page 37: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

37

If e < SIZE //message comes from our If (size,id) > (SIZE,ID) then //lexicographic

STATE='stopped'Send WINNER(id) on edge e

ElseSend WINNER(ID) on edge e

STATE STOPPED

SIZE 0

MASTER B

PENDING

2

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

TEST(1,C)

STATE active

SIZE 1

MASTER C

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 1

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

B-process B's message (test(1,A))

WINNER(A)

A:

WINNER(C)

C:

D:

B:

E:

WINNER(D)

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

WINNER(A)

F GF

H

I J

Page 38: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

38

●if ID=id then

●ELSE if MASTER <>id then MASTER=id

send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1

● if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER)

STATE STOPPED

SIZE 0

MASTER A

PENDING

1

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE active

SIZE 1

MASTER C

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 1

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

B-process B's message WINNER(A)

WINNER(A)

A:

WINNER(C)

C:

D:

B:

E:

WINNER(D)

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

WINNER(A)

TEST(1,C)

F GF

H

I J

Page 39: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

39

●if ID=id then

●if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE STOPPED

SIZE 0

MASTER A

PENDING

1

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE active

SIZE 1

MASTER C

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 2

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

A-process B's message WINNER(A)

A:

C:

D:

B:

E:

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

TEST(2,A)

F GF

H

I J

Page 40: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

40

If e < SIZE //message comes from our domainIf (size,id) > (SIZE,ID) then //lexicographic

STATE='stopped'Send WINNER(id) on edge e

ElseSend WINNER(ID) on edge e

STATE STOPPED

SIZE 0

MASTER A

PENDING

1

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE active

SIZE 1

MASTER C

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 2

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

A-process B's message TEST(1,C)

A:

C:

D:

B:

E:

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

WINNER(A)

F GF

H

I J

Page 41: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

41

●if ID=id then●else if MASTER <>id then MASTER=id

send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1● if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER)

STATE STOPPED

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE active

SIZE 1

MASTER C

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 2

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

B-process A's message WINNER(A)

A:

C:

D:

B:

E:

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

Page 42: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

42

If e < SIZEElse //message from outsize the domain

EDGE_TO(id) = ePENDING = PENDING +1If PENDING =1 then

send TEST(size,id) on EDGE_TO(MASTER)Else put TEST(size,id) in PENDING_SET

STATE STOPPED

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE active

SIZE 1

MASTER C

PENDING

1

EDGE_TO

A-2

INPUT_SET

PENDING_SET

STATE active

SIZE 2

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

C-process A's message TEST(2,A)

A:

C:

D:

B:

E:

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

TEST(2,A) F GF

H

I J

Page 43: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

43

If e < SIZE //message comes from our domainIf (size,id) > (SIZE,ID) then //lexicographic

STATE='stopped'Send WINNER(id) on edge e

ElseSend WINNER(ID) on edge e

STATE STOPPED

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER C

PENDING

1

EDGE_TO

A-2

INPUT_SET

PENDING_SET

STATE active

SIZE 2

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

C-process C's message TEST(2,A)

A:

C:

D:

B:

E:

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

WINNER(A) F GF

H

I J

Page 44: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

44

if ID=id then else if MASTER <>id then

MASTER=id send WINNER(id) on EDGE_TO(id)

PENDING=PENDING-1 if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER)

STATE STOPPED

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-2

INPUT_SET

PENDING_SET

STATE active

SIZE 2

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

C-process C's message WINNER(A)

A:

C:

D:

B:

E:

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

WINNER(A)

F GF

H

I J

Page 45: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

45

●if ID=id then if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE STOPPED

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-2

INPUT_SET

PENDING_SET

STATE active

SIZE 3

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

A-process C's message WINNER(A)

A:

C:

D:

B:

E:

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 0

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

TEST(3,A)

F GF

H

I J

Page 46: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

46

●if ID=id then if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE STOPPED

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-2

INPUT_SET

PENDING_SET

STATE active

SIZE 3

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

D-process awake WINNER(D)

A:

C:

D:

B:

E:

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 1

MASTER D

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

TEST(1,D)

F GF

H

I J

Page 47: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

47

If e < SIZEElse //message from outsize the domain

EDGE_TO(id) = ePENDING = PENDING +1If PENDING =1 then

send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET

STATE STOPPED

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-2

INPUT_SET

PENDING_SET

STATE active

SIZE 3

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

D-process A message TEST(3,A)

A:

C:

D:

B:

E:

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE active

SIZE 1

MASTER D

PENDING

1

EDGE_TO

A-1

INPUT_SET

PENDING_SET

TEST(3,A)

F GF

H

I J

Page 48: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

48

If e < SIZE //message comes from our domainIf (size,id) > (SIZE,ID) then //lexicographic

STATE='stopped'Send WINNER(id) on edge e

ElseSend WINNER(ID) on edge e

STATE STOPPED

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-2

INPUT_SET

PENDING_SET

STATE active

SIZE 3

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

D-process D message TEST(3,A)

A:

C:

D:

B:

E:

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER D

PENDING

1

EDGE_TO

A-1

INPUT_SET

PENDING_SET

WINNER(A)

F GF

H

I J

Page 49: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

49

if ID=id then else if MASTER <>id then

MASTER=id send WINNER(id) on EDGE_TO(id)

PENDING=PENDING-1 if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER)

STATE STOPPED

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-2

INPUT_SET

PENDING_SET

STATE active

SIZE 3

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

D-process D message WINNER(A)

A:

C:

D:

B:

E:

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-1

INPUT_SET

PENDING_SET

WINNER(A)

F GF

H

I J

Page 50: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

50

●if ID=id then if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE STOPPED

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-2

INPUT_SET

PENDING_SET

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

A-process D message WINNER(A)

A:

C:

D:

B:

E:

STATE active

SIZE 0

MASTER E

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-1

INPUT_SET

PENDING_SET

TEST(4,A)

F GF

H

I J

Page 51: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

51

If e < SIZEElse //message from outsize the domain

EDGE_TO(id) = ePENDING = PENDING +1If PENDING =1 then

send TEST(size,id) on EDGE_TO(MASTER) Else put TEST(size,id) in PENDING_SET

STATE STOPPED

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-2

INPUT_SET

PENDING_SET

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

E-process A message TEST(4,A)

A:

C:

D:

B:

E:

STATE active

SIZE 0

MASTER E

PENDING

1

EDGE_TO

A-1

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-1

INPUT_SET

PENDING_SET

TEST(4,A)

F GF

H

I J

Page 52: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

52

If e < SIZE //message comes from our domainIf (size,id) > (SIZE,ID) then //lexicographic

STATE='stopped'Send WINNER(id) on edge e

ElseSend WINNER(ID) on edge e

STATE STOPPED

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-2

INPUT_SET

PENDING_SET

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

E-process E message TEST(4,A)

A:

C:

D:

B:

E:

STATE stopped

SIZE 0

MASTER E

PENDING

1

EDGE_TO

A-1

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-1

INPUT_SET

PENDING_SET

WINNER(A)

F GF

H

I J

Page 53: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

53

if ID=id then else if MASTER <>id then

MASTER=id send WINNER(id) on EDGE_TO(id)

PENDING=PENDING-1 if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER)

STATE STOPPED

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-2

INPUT_SET

PENDING_SET

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

E-process E message WINNER(A)

A:

C:

D:

B:

E:

STATE stopped

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-1

INPUT_SET

PENDING_SET

WINNER(A)

F GF

H

I J

Page 54: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

54

●if ID=id then if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

F woke up

A:

C:

D:

B:

E:STATE active

SIZE 1

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

Page 55: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

55

●if ID=id then if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

F woke up

A:

C:

D:

B:

E:STATE active

SIZE 1

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

TEST(1,F)

Page 56: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

56

If e < SIZE //message comes from our Else //message from outsize the domain

EDGE_TO(id) = ePENDING = PENDING +1If PENDING =1 then

send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

G process the message TEST from F

A:

C:

D:

B:

E:STATE active

SIZE 1

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

STATE active

SIZE 0

MASTER E

PENDING

1

EDGE_TO

F-1

INPUT_SET

PENDING_SET

TEST(1,F)

Page 57: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

57

If e < SIZE //message comes from our If (size,id) > (SIZE,ID) then //lexicographic

STATE='stopped'Send WINNER(id) on edge e

ElseSend WINNER(ID) on edge e

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

G process the message TEST from G

A:

C:

D:

B:

E:STATE active

SIZE 1

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

STATE stopped

SIZE 0

MASTER E

PENDING

1

EDGE_TO

F-1

INPUT_SET

PENDING_SET

WINNER(F)

Page 58: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

58

●if ID=id then

●ELSE if MASTER <>id then MASTER=id

send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1

● if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER)

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

G process message WINNER from G

A:

C:

D:

B:

E:STATE active

SIZE 1

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

STATE stopped

SIZE 0

MASTER F

PENDING

0

EDGE_TO

F-1

INPUT_SET

PENDING_SET

WINNER(F)

Page 59: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

59

●if ID=id then

●if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

F process message WINNER(F) from G

A:

C:

D:

B:

E:STATE active

SIZE 2

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

TEST(2,F)

Page 60: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

60

If e < SIZE //message comes from our Else //message from outsize the domain

EDGE_TO(id) = ePENDING = PENDING +1If PENDING =1 then

send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

H process message TEST from F

A:

C:

D:

B:

E:STATE active

SIZE 2

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

TEST(2,F)

STATE active

SIZE 0

MASTER H

PENDING

1

EDGE_TO

F-1

INPUT_SET

PENDING_SET

Page 61: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

61

If e < SIZE //message comes from our If (size,id) > (SIZE,ID) then //lexicographic

STATE='stopped'Send WINNER(id) on edge e

ElseSend WINNER(ID) on edge e

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

H process message TEST from H

A:

C:

D:

B:

E:STATE active

SIZE 2

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

WINNER(F)

STATE stopped

SIZE 0

MASTER H

PENDING

1

EDGE_TO

F-1

INPUT_SET

PENDING_SET

Page 62: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

62

●if ID=id then

●ELSE if MASTER <>id then MASTER=id

send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1

● if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER)

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

H process message WINNER(F) from H

A:

C:

D:

B:

E:STATE active

SIZE 2

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

WINNER(F)

STATE stopped

SIZE 0

MASTER F

PENDING

0

EDGE_TO

F-1

INPUT_SET

PENDING_SET

Page 63: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

63

●if ID=id then

●if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

F process message WINNER(F) from H

A:

C:

D:

B:

E:STATE active

SIZE 3

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

TEST(3,F)

Page 64: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

64

If e < SIZE //message comes from our Else //message from outsize the domain

EDGE_TO(id) = ePENDING = PENDING +1If PENDING =1 then

send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

I process message TEST from F

A:

C:

D:

B:

E:STATE active

SIZE 3

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

TEST(3,F)

STATE active

SIZE 0

MASTER I

PENDING

1

EDGE_TO

F-1

INPUT_SET

PENDING_SET

Page 65: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

65

If e < SIZE //message comes from our If (size,id) > (SIZE,ID) then //lexicographic

STATE='stopped'Send WINNER(id) on edge e

ElseSend WINNER(ID) on edge e

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

I process message TEST from I

A:

C:

D:

B:

E:STATE active

SIZE 3

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

WINNER(F)

STATE stopped

SIZE 0

MASTER I

PENDING

1

EDGE_TO

F-1

INPUT_SET

PENDING_SET

Page 66: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

66

●if ID=id then

●ELSE if MASTER <>id then MASTER=id

send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1

● if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER)

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

I process message WINNER(F) from I

A:

C:

D:

B:

E:STATE active

SIZE 3

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

WINNER(F)

STATE stopped

SIZE 0

MASTER F

PENDING

0

EDGE_TO

F-1

INPUT_SET

PENDING_SET

Page 67: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

67

●if ID=id then

●if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

F process message WINNER(F) from H

A:

C:

D:

B:

E:STATE active

SIZE 4

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

TEST(4,F)

Page 68: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

68

If e < SIZE //message comes from our Else //message from outsize the domain

EDGE_TO(id) = ePENDING = PENDING +1If PENDING =1 then

send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

J process message TEST from F

A:

C:

D:

B:

E:STATE active

SIZE 4

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

STATE active

SIZE 0

MASTER J

PENDING

1

EDGE_TO

F-1

INPUT_SET

PENDING_SET

TEST(4,F)

Page 69: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

69

If e < SIZE //message comes from our If (size,id) > (SIZE,ID) then //lexicographic

STATE='stopped'Send WINNER(id) on edge e

ElseSend WINNER(ID) on edge e

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

J process message TEST from J

A:

C:

D:

B:

E:STATE active

SIZE 4

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

STATE stopped

SIZE 0

MASTER J

PENDING

1

EDGE_TO

F-1

INPUT_SET

PENDING_SET

WINNER(F)

Page 70: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

70

If e < SIZE //message comes from our If (size,id) > (SIZE,ID) then //lexicographic

STATE='stopped'Send WINNER(id) on edge e

ElseSend WINNER(ID) on edge e

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

J process message WINNER(F) from J

A:

C:

D:

B:

E:STATE active

SIZE 4

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

STATE stopped

SIZE 0

MASTER F

PENDING

0

EDGE_TO

F-1

INPUT_SET

PENDING_SET

WINNER(F)

Page 71: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

71

if ID=id then

if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

F process message WINNER(F) from J

A:

C:

D:

B:

E:STATE active

SIZE 5

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

TEST(5,F)

Page 72: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

72

If e < SIZE //message comes from our Else //message from outsize the domain

EDGE_TO(id) = ePENDING = PENDING +1If PENDING =1 then

send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET

STATE active

SIZE 4

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

C process message TEST(5,F) from F

A:

C:

D:

B:

E:STATE active

SIZE 5

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F GF

H

I J

TEST(5,F)

STATE stopped

SIZE 1

MASTER A

PENDING

1

EDGE_TO

A-2F-5

INPUT_SET

PENDING_SET

Page 73: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

73

●if ID=id then

●if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE STRPPED

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

STATE stopped

SIZE 1

MASTER A

PENDING

0

EDGE_TO

A-2

INPUT_SET

PENDING_SET

STATE active

SIZE 5

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

A-process E message WINNER(A)

A:

C:

D:

B:

E:

STATE stopped

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1

INPUT_SET

PENDING_SET

STATE stopped

SIZE 5

MASTER A

PENDING

0

EDGE_TO

A-1

INPUT_SET

PENDING_SET

TEST(1,C)

TEST(5,A)

F GF

H

I J

Page 74: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

74

If e < SIZE //message comes from our domainIf (size,id) > (SIZE,ID) then //lexicographic

STATE='stopped'Send WINNER(id) on edge e

STATE stopped

SIZE 5

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

A process message TEST(5,F) from C

A:

C:STATE active

SIZE 5

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F

STATE stopped

SIZE 1

MASTER A

PENDING

1

EDGE_TO

A-2F-5

INPUT_SET

PENDING_SET

if (5,F) > (5,A)WINNER(F)

Page 75: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

75

●if ID=id then●else if MASTER <>id then MASTER=id

send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1● if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER)

STATE stopped

SIZE 5

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

C process message WINNER(F) from A

A:

C:

STATE active

SIZE 5

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F

STATE stopped

SIZE 1

MASTER F

PENDING

0

EDGE_TO

A-2F-5

INPUT_SET

PENDING_SET

WINNER(F)

Page 76: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

76

●if ID=id then if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE stopped

SIZE 5

MASTER A

PENDING

EDGE_TO

INPUT_SET

PENDING_SET

F process message WINNER(F) from C

A:

C:

STATE active

SIZE 6

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F

STATE stopped

SIZE 1

MASTER F

PENDING

0

EDGE_TO

A-2F-5

INPUT_SET

PENDING_SET

TEST(6,F)

Page 77: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

77

If e < SIZEElse //message from outsize the domain

EDGE_TO(id) = ePENDING = PENDING +1If PENDING =1 then

send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET

STATE stopped

SIZE 5

MASTER A

PENDING

1

EDGE_TO

F-5INPUT_SET

PENDING_SET

A process message TEST(6,F) from F

A:

C:

STATE active

SIZE 6

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F

STATE stopped

SIZE 1

MASTER F

PENDING

0

EDGE_TO

A-2F-5

INPUT_SET

PENDING_SET

TEST(6,F)

Page 78: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

78

If e < SIZE //message comes from our domainIf (size,id) > (SIZE,ID) then //lexicographic

STATE='stopped'Send WINNER(id) on edge e

ElseSend WINNER(ID) on edge e

STATE stopped

SIZE 5

MASTER A

PENDING

1

EDGE_TO

F-5INPUT_SET

PENDING_SET

A process message TEST(6,F) from A

A:

C:

STATE active

SIZE 6

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F

STATE stopped

SIZE 1

MASTER F

PENDING

0

EDGE_TO

A-2F-5

INPUT_SET

PENDING_SET

WINNER(F)

Page 79: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

79

if ID=id then

else if MASTER <>id then MASTER=id

send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1

if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER)

STATE stopped

SIZE 5

MASTER F

PENDING

0

EDGE_TO

F-5INPUT_SET

PENDING_SET

A process message WINNER(F) from A

A:

C:

STATE active

SIZE 6

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F

STATE stopped

SIZE 1

MASTER F

PENDING

0

EDGE_TO

A-2F-5

INPUT_SET

PENDING_SET

WINNER(F)

Page 80: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

80

if ID=id then

if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!If STATE='active' then \\no fight has been lost

send TEST(SIZE,ID) on edge SIZE

STATE stopped

SIZE 5

MASTER F

PENDING

0

EDGE_TO

F-5INPUT_SET

PENDING_SET

F process message WINNER(F) from A

A:

STATE active

SIZE 7

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

F

B:

TEST(7,F)

STATE STOPPED

SIZE 0

MASTER A

PENDING

0

EDGE_TO

A-1C-2

INPUT_SET

PENDING_SET

Page 81: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

81

B process message TEST(F)

A:

STATE active

SIZE 7

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

B:A:

C:

D:

B:

E:

F GF

H

I J

TEST(7,F)

Page 82: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

82

A:

STATE active

SIZE 7

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

B:A:

C:

D:

B:

E:

F GF

H

I J

WINNER(F)

Page 83: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

83

A:

STATE active

SIZE 7

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

B:A:

C:

D:

B:

E:

F GF

H

I J

WINNER(F)

Page 84: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

84

A:

STATE active

SIZE 8

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

B:A:

C:

D:

B:

E:

F GF

H

I J

TEST(8,F)

Page 85: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

85

A:

STATE active

SIZE 8

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

B:A:

C:

D:

B:

E:

F GF

H

I J

TEST(8,F)

Page 86: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

86

A:

STATE active

SIZE 8

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

B:A:

C:

D:

B:

E:

F GF

H

I J

WINNER(F)

Page 87: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

87

A:

STATE active

SIZE 8

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

B:A:

C:

D:

B:

E:

F GF

H

I J

WINNER(F)

Page 88: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

88

A:

STATE active

SIZE 9

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

B:A:

C:

D:

B:

E:

F GF

H

I J

TEST(9,F)

Page 89: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

89

A:

STATE active

SIZE 9

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

B:A:

C:

D:

B:

E:

F GF

H

I J

TEST(9,F)

Page 90: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

90

A:

STATE active

SIZE 10

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

B:A:

C:

D:

B:

E:

F GF

H

I J

WINNER(F)

if ID=id then if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!

Page 91: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

91

A:

STATE active

SIZE 10

MASTER F

PENDING

0

EDGE_TO

INPUT_SET

PENDING_SET

B:A:

C:

D:

B:

E:

F GF

H

I J

if ID=id then if STATE='active' then SIZE=SIZE+1if SIZE=N then stop!

WE HAVE A LEADER!!!!!!!!!!!

Page 92: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

92

Correctness

● We would like to show :● 1. Termination● 2. One leader is elected and only one

Page 93: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

93

Termination

● We will show:1. The number of messages is bounded2. There is no deadlocktherefore the algorithm stop after a finite number of messages.

Page 94: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

94

Termination- proof

The number of messages is bounded:

Each processor can send at most N-1 TEST messages. TEST message can cause at most more 3 messages (to the master,from the master,to the origin node-only if won). So total there is at most messages.4 ⋅𝑛2

Page 95: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

95

Termination- proof

There is no deadlock:

Assume there is a deadlock. Now let's look at the processor with the highest (SIZE,ID). He waits for an answer for his TEST message. Assume node u received the TEST message. Node u will eventually deliver it to it's master. At the end of the battle one will win and continue (send more TEST messages or win)- no deadlock.

Bounded number of messages + no deadlock = termination

Page 96: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

96

One leader is elected● Define 'domain' of node ID at time t as the set

of nodes from which it has receive winner(ID), including itself and the node was active.

● The domain size can not decrease

● For each active node: the domain size equal to SIZE: (from the code upon receiving WINNER(ID))

This is the only line SIZE is changed

if ID=id then if STATE='active' then SIZE=SIZE+1

Page 97: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

97

● Let be the domain of node B at time tb● Lemma 1:● Proof: assume v in from time and in

v joins so

we will show by induction on j- the number of new masters v had after till (include)

𝐷𝐵𝑡 𝑏

𝐷𝐵𝑡 𝑏∩𝐷 𝐴

𝑡 𝑎≠∅→ ∣ 𝐷𝐵𝑡𝑏 ∣≠ ∣𝐷 𝐴

𝑡 𝑎 ∣𝑡𝑎𝐷 𝐴

𝑡𝑏𝐷𝐵 ∣𝐷𝐵

𝑡 𝑏∣> ∣ 𝐷𝐴𝑡 𝑎 ∣

𝑡𝑎 𝑡𝑏

Page 98: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

98

● Basis j=1:v belonged to domain A and then joined domain B (directly).

AB

V

B sent TEST to v, who gave it to A. At time t', A processed this message: TEST(Bsize,B) 𝑡 𝐴<𝑡 ′<𝑡𝐵

v joined B so : either or but B>A. After v join Domain B Domain A no longer increase .In both cases after v join B :

∣𝐷𝐵𝑡 𝑏∣> ∣ 𝐷𝐴

𝑡 ′ ∣

∣𝐷𝐵 ∣> ∣ 𝐷𝐴 ∣ ∣𝐷𝐵 ∣=∣𝐷 𝐴∣

Page 99: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

99

● Step: if the statement holds for some natural number j=x, then the statement holds for j=x+1.From the correctness for j=x we know that

as in the basis we can prove that so total we can have:

∣𝐷𝑥

𝑡𝑥 ∣> ∣𝐷 𝐴𝑡 ′ ∣

∣𝐷𝑥+1𝑡 𝑥+1 ∣> ∣𝐷𝑥

𝑡 𝑥 ∣

∣𝐷𝑥+1𝑡 𝑥+1 ∣> ∣𝐷𝑥

𝑡 𝑥 ∣> ∣𝐷 𝐴𝑡 ′ ∣

Page 100: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

100

● So we proved that

in other words:𝐷𝐵

𝑡 𝑏∩𝐷 𝐴𝑡 𝑎≠∅→ ∣ 𝐷𝐵

𝑡𝑏 ∣≠ ∣𝐷 𝐴𝑡 𝑎 ∣

∣𝐷𝐵𝑡 𝑏∣=∣𝐷 𝐴

𝑡𝑎 ∣→𝐷𝐵𝑡 𝑏∩𝐷 𝐴

𝑡 𝑎=∅

Page 101: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

101

● Rank the nodes in order of decreasing order of SIZE at termination, breaking ties arbitrarily and denote by Si the final SIZE of the i”th ranked node. Lemma 2:

Proof:

each once was in the same size of Si. By lemma1 we know they all disjoin. If we divide all nodes (N) equally we will get

𝑆 𝑖≤𝑁𝑖

𝑆1 ,𝑆2 , . ..𝑆𝑖− 1

𝑆 𝑖≤𝑁𝑖

∣ 𝑆1∣≥ ∣ 𝑆2∣ ≥ ∣ 𝑆3 ∣≥ ... ∣𝑆𝑛 ∣

Page 102: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

102

ONE LEADER

● The node with the largest (SIZE,ID) is S1, it is not possible it lost a fight (if it has there was Si with larger SIZE). So he won all the fights- at termination it's size is N. the size of S2 is smaller than S1 (lemma2 + S1 with SIZE=N) so S2 did not win. Same for all other nodes.

Page 103: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

103

Complexity

● Each domain can at most send TEST message as it's size so:assume k woke up arbitrary (each test message can cause at most three more messages)

So total we have O(N log(k)) messages

4 ⋅(𝑁1 +𝑁2

+𝑁3

+...+𝑁𝑘 )

Page 104: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

104

Lower bound

From the paper

“Optimal lower bounds for some distributed algorithms for a

complete network of predecessors “

Written by: E.Korach, S.Moran, S.Zaks

Page 105: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

105

Main Idea- lower bound

● The adversary will always choose the “longest algorithm”. So we look at all possible executions, then we drop messages which don't use “new” edges, and we show that even if we drop messages our best algorithm is still bounded byΩ (𝑛 log𝑛)

Page 106: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

106

Lower bound

● Let A be a distributed algorithm acting on graph G=(V,E). Execution of A may consist events: sending a message, receiving a message or doing local computation.

● We assume no two message are sent in exactly the same time, therefor in each execution we associate a sequence

● SEND = ⟨ 𝑠𝑒𝑛𝑑1 , 𝑠𝑒𝑛𝑑2 , . ..𝑠𝑒𝑛𝑑𝑘 ⟩

Page 107: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

107

● For every event where is the node sending the message and

is the edge used by it● Example 1

● Example 2

𝑠𝑒𝑛𝑑𝑖=(𝑣 (𝑠𝑒𝑛𝑑𝑖 ) ,𝑒 (𝑠𝑒𝑛𝑑𝑖 ))𝑣 (𝑠𝑒𝑛𝑑𝑖 )𝑒 (𝑠𝑒𝑛𝑑 𝑖 )

V1 V2 SEND= <(v1,(v1,v2))>

V1 V2 SEND= <>

Page 108: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

108

● Let SEND(t) be the prefix of length t of SEND,

● If t<t' then we say SEND(t') is an extension of SEND(t) and SEND(t)<SEND(t')

𝑆𝐸𝑁𝐷 (𝑡 )= ⟨𝑠𝑒𝑛𝑑1 , 𝑠𝑒𝑛𝑑2 , . ..𝑠𝑒𝑛𝑑𝑡 ⟩𝑆𝐸𝑁𝐷 (0 )=⟨⟩

Page 109: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

109

● Let NEW=NEW(SEND) be the subsequence of SEND that consist of all the events that use previously unused edges.

V1 V21

2

SEND= <(v1,(v1,v2)),(v2,(v1,v2)) >NEW = <(v1,(v1,v2)) >

Page 110: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

110

● G(NEW(t)) = (V,E(NEW(t)))where E(NEW(t)) is the set of edges used in NEW(t). NEW(t) - prefix of size t of NEW

● Example:

V1 V21

2

V3

G

V1 V2

G(NEW(1))

V3

Page 111: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

111

● If for every execution of the algorithm A the corresponding graph G(NEW) is connected then we term this algorithm global.

Page 112: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

112

● The edge complexity e(A) of an algorithm A acting on a graph G is the maximal length of a sequence NEW over all executions of A

● The message complexity m(A) of an algorithm A acting on a graph G is the maximal length of a sequence SEND over all executions of A.

● Clearly𝑚 (𝐴 )≥𝑒 (𝐴)

Page 113: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

113

● For each algorithm A and graph G we define the exhaustive set of A with respect to G, denoted by EX(A,G) (or E(A)) as the set of all the sequences NEW(t) corresponding to possible executions of A

Page 114: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

114

Axiom 1

● The empty sequence is in EX(A,G)

intuitive explanation: EX(A,G) is the set of all the sequences NEW(t) corresponding to possible executions of A, in particular EX(A,G) includes the sequence corresponding to NEW(0).

Page 115: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

115

Axiom 2

● If two sequences NEW1,NEW2 which do not interfere with each other are in EX(A,G) then so is also their concatenation NEW1 NEW2°

Other nodes

New1

New2

Page 116: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

116

Axiom 3

● If NEW(t) is a sequence in EX(A,G) with last element (v,e), and if e' is an unused edge adjacent to v, then the sequence obtained from NEW(t) by replacing e by e' is also in EX(A,G)Other nodes

(v,e)Other nodes

e

The adversaryOther nodes

(v,e')Other nodes

e'

Page 117: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

117

Axiom 4

● If NEW(t) is in EX(A,G) and C is a proper subgraph of G(NEW(t)) which is a union of some connected components, then there is an extension of NEW(t) in which the first new message (v,e) satisfies v in C. (A global)

Other nodes

C1C2C

It is impossible that it's the end of the algorithm (and the other nodes sleep)

Page 118: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

118

Lemma 1

● Lemma 1: Let A be a global algorithm acting on a complete graph G=(V,E) and let

● then there exists a sequence of messages NEW in EX(A,G) such that G(NEW) has one connected component whose set of vertexes is U and the vertexes in V-U are isolated

𝑈⊆𝑉

Page 119: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

119

Lemma 1

● Proof:By induction we will build:If there is nothing to prove.

If ( assume v1, v2) : we start with the empty sequence (axiom 1). Define C={v1},with axiom 4 we have extension which starts in v1. We have unused edged (v1,v2) so according to axiom 3 we can replace it.

∣𝑈 ∣≤1

∣𝑈 ∣=2

Page 120: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

120

Lemma 1

● Proof: the main idea is we can keep this process as long we have an unused edge:

Each iterate we pick a node from C(4). If it's connected to all it's neighbors in C- we done. Else- we can connect it to a neighbor it's not connected to (3), we can proceed until there is a node which is saturated (and then C is connected component)

Other nodes

Page 121: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

121

Theorem 1

● Theorem 1: let A be a global algorithm acting on a completed graph G with n nodes. Then the edge complexity e(A) of A is at least O(n log n).

● Proof: for a subset U of V we define e(U) to be the maximal length of a sequence NEW in EX(A,G), which induces a graph that has a connected component whose set of vertexes is U and isolated vertexes otherwise (Exist from lemma 1)

Page 122: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

122

Theorem 1- proof

● Definenote: e(n) is the edge complexity of A.

● Now we will prove that

Let U be a disjoint union of and {v} such that |U1|=|U2|=k so e(U)=e(2k+1).

𝑒 (𝑘)=𝑚𝑖𝑛 {𝑒 (𝑈 )∣𝑈⊆𝑉 ,∣𝑈 ∣=𝑘 }

𝑒 (2k+1 )≥2𝑒 (𝑘 )+𝑘+1(𝑘<𝑛2 )

𝐶=𝑈 1∪𝑈 2

𝑈 1 ,𝑈 2

Page 123: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

123

Other nodes

C

U2U1

v U

Page 124: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

124

NEW=NEW1 NEW2 (axiom 2)

Other nodes

C

U2U1

v U

°

NEW1 NEW2

Page 125: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

125

Axiom4: edge from C

Other nodes

C

U2U1

v U

NEW1 NEW2

Page 126: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

126

Axiom4: edge from C

Other nodes

C

U2U1

v U

NEW1 NEW2

Page 127: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

127

Axiom3: replace with unused edge

Other nodes

C

U2U1

v U

NEW1 NEW2

Unused edges between U1 and U2

Page 128: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

128

Axiom3: replace with unused edge

Other nodes

C

U2U1

v U

NEW1 NEW2

Unused edges between U1 and U2

Page 129: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

129

Axiom3: replace with unused edge

Other nodes

C

U2U1

v U

NEW1 NEW2

Unused edges between U1 and U2

Page 130: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

130

Axiom3: replace with unused edge-at least k times

Other nodes

C

U2U1

v U

NEW1 NEW2

Unused edges between U1 and U2

Page 131: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

131

Change C

Other nodes

C

U2U1

v

NEW1 NEW2

Page 132: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

132

Change C- axiom 4+3

Other nodes

C

U2U1

v

NEW1 NEW2

Page 133: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

133

Change C- axiom 4+3

Other nodes

C

U2U1

v

NEW1 NEW2

Unused edge

Page 134: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

134

Change C- axiom 4+3

Other nodes

C

U2U1

v

NEW1 NEW2

Page 135: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

135

Total at least: e(U1)+e(U2)+k+1

Other nodes

C

U2U1

v

NEW1 NEW2

Page 136: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

136

● Let U be a disjoint union of and {v} such that |U1|=|U2|=k so e(U)=e(2k+1). Define Let NEW1,NEW2 be sequences in EX(A,G) of lengths e(U1),e(U2) inducing subgraphs G1,G2 that have one connected component with vertex set U1,U2 respectively (all other isolated). These two sequences do not interfere with each other and by axiom2 their concatenation NEW=NEW1 NEW2 is also in EX(A,G).

𝐶=𝑈 1∪𝑈 2

𝑈 1 ,𝑈 2

°

Page 137: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

137

● C satisfies the assumptions of axiom 4 , each node in C has at least k unused edges, so there is an extension of NEW by a message (v',e) where v' in C. by axiom 3 we can change this with one of the unused edges. This process can be repeated until at least one vertex in C saturates all its edges to other vertexes in C. this requires at least k messages along previously unused edges.

● We change C to include now also {v} and from axiom 4+3 we will get an edge to v.

𝑒 (2k+1 )=𝑒 (𝑈 )≥𝑒 (𝑈 1 )+𝑒 (𝑈 2 )+𝑘+1≥2𝑒 (𝑘 )+𝑘+1

Page 138: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

138

● So we have:

By induction we will show that for

𝑒 (2k+1 )≥2𝑒 (𝑘 )+𝑘+1

𝑛=2𝑖−1 ,𝑒 (1 )=0

𝑒 (𝑛 )≥ 𝑛+12log(𝑛+1

2 )¿

Page 139: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

139

𝑏𝑎𝑠𝑖𝑠 : 𝑖=1 :𝑛=21−1=1

𝑒 (1 )=1≥ 22log (1 )=0

𝑎𝑠𝑠𝑢𝑚𝑒𝑡 h𝑒𝑐𝑜𝑟𝑟𝑒𝑡𝑛𝑒𝑠𝑠𝑜𝑓𝑛=2𝑖−1∧𝑠 h𝑜𝑤𝑓𝑜𝑟 2 (𝑖+1)−1

❑/2k+1=2𝑖+1−1𝑠𝑜𝑘=2𝑖−1𝑒 (2𝑖+1−1 )≥2𝑒 (2𝑖−1 )+2𝑖−1+1

≥2𝑒 (𝑛)+2𝑖≥2𝑛+12log 𝑛+1

2+2𝑖=¿2 ⋅ 2

𝑖

2log 2

𝑖

2+2𝑖=2𝑖 ⋅ log 2

𝑖

2+2𝑖=¿2𝑖 ⋅ log 2𝑖 −1+2𝑖=❑/2𝑖+1−1=𝑁

𝑁+12

log 𝑁 +14

+𝑁 +14

=𝑁+12⋅ log 𝑁+1

2+ log 1

2+𝑁+14

=¿𝑁 +12

log 𝑁+12

− 𝑁−14

≥ 𝑁+12

log 𝑁 +12

Page 140: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

140

Conclusion

Theorem 2: Let A be a global algorithm acting on a complete graph G with n nodes. Then the message complexity m(A) is

If k nodes woke up we get

As we seen Humblet algorithm was therefore it reaches the lower bound.

Ω (𝑛 log𝑛)

Ω (𝑛 log𝑘 )

𝑂 (𝑛 log𝑘 )

Page 141: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

141

Page 142: Selecting leader in a clique in O (n log n) By Pierre A.Humblet

142

T H A N K

Y O U