Escolar Documentos
Profissional Documentos
Cultura Documentos
GRAPH
James Aspnes
Gauri Shah
Many slides have been taken from the original presentation
by the authors
Skip List
(Idea due to Pugh 90, CACM paper)
Dictionary based on a probabilistic data structure.
Allows efficient search, insert, and delete operations.
Each element in the dictionary typically stores
additional
useful information beside its search key. Example:
<student id. Transcripts>
[for University of Iowa]
<date, news>
[for Daily Iowan]
Probabilistic alternative to a balanced tree.
Skip List
TAIL
Level 0
Level 1
Level 2
HEAD
Another example
L2
L1
L0
31
23
12
23
26
31
34
31
34
64
44
56
64
78
L2
L1
L0
31
23
12
23
26
31
34
31
34
64
44
56
64
78
Insertion
The insert algorithm uses randomization to
decide in how many levels the new item
<k> should be added to the skip list.
After inserting the new item at the bottom
level flip a coin.
If it returns tail, insertion is complete.
Otherwise, move to next higher level and
insert <k> in this level at the appropriate
position, and repeat the coin flip.
Insertion Example
1) Suppose we want to insert 15
2) Do a search, and find the spot between 10 and 23
3) Suppose the coin come up head three times
p2
L2
p1
L1
L0
L3
p0
10
23
23
36
L2
15
L1
15
23
L0
15
23
10
36
Deletion
Search for the given key <k>. If a position with
key <k> is not found, then no such key exists.
Otherwise, if a position with key <k> is found
(it will be definitely found on the bottom level),
then we remove all occurrences of <k> from
every level.
If the uppermost level is empty, remove it.
10
11
Deletion Example
1) Suppose we want to delete 34
2) Do a search, find the spot between 23 and 45
3) Remove all occurrences of the key
p2
L2
34
L1
L0
12
23
34
23
34
p1
p0
45
L2
L1
L0
23
12
23
45
12
13
Number of levels
The number of levels = O(log n) w.h.p
Pr[a given element x is above level c log n]
= 1/nc
= 1/2c lo
14
Search time
Consider a skiplist with two levels L0 and L1. To search
a key, first search L1 and then search L0.
Cost (i.e. search time) = length (L1) + n / length (L1)
Minimum when length (L1) = n / length (L1).
Thus length(L1) = (n) 1/2, and cost = 2. (n) 1/2
(Three lists) minimum cost = 3. (n)1/3
(Log n lists) minimum cost = log n. (n) 1/log n = 2.log n
15
16
Level 2
A Skip Graph
A
100
Level 1
000
Level 0
100
001
011
110
001
001
011
101
110
101
Membership vectors
001
100
001
011
110
101
17
18
Level 0
Level 1
Level 2
W
J
G
A
A
R
R
19
Level 2
Node Insertion 1
buddy
G
A
100
Level 0
Level 1
000
011
110
G
A
100
001
new node
J
101
001
110
101
011
001
100
011
110
W
101
20
Node Insertion - 2
Level 2
100
Level 1
000
001
011
110
G
A
100
001
Level 0
001
100
001
011
001
011
101
110
101
110
101
21
Independent of system
size
Level 1
Level 0
insert
J
Level 2
Level 1
00
01
E
1
Level 0
22
23
Applications of locality
Version Control
e.g. find latest news from yesterday.
find largest key < news: 02/13.
Level 0 news:02/09
news:02/10
news:02/11
news:02/12
news:02/13
Data Replication
e.g. find any copy of some Britney Spears song.
Level 0
britney01
britney02
britney03
britney04
britney05
24
So far...
Decentralization.
Locality properties.
O(log n) space per node.
delete time.
Coming up...
Load balancing.
Tolerance to faults.
Random faults.
Adversarial faults.
Self-stabilization.
Independent
of
system
size.
25
Load balancing
Interested in average load on a node u.
i.e. the number of searches from source
s to destination t that use node u.
26
Observation
Level 2
Level 1
Nodes u
Level 0
27
Tallest nodes
s
u is not on path.
u is on path.
Pr [u T]=
k=1
28
Load on node u
Start with n nodes. Each node goes to next set with prob. 1/2.
We want expected size of T = last non-empty set.
29
Experimental result
1.1
1.0
Load on node
0.9
Expected load
Actual load
Destination = 76542
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.0
76400
76450
76500
76550
Node location
76600
76650
30
Fault tolerance
How do node failures affect skip graph performance?
Random failures: Randomly chosen nodes fail.
Experimental results.
Adversarial failures: Adversary carefully chooses
nodes that fail.
Bound on expansion ratio.
31
Random faults
Size of largest connected component
as fraction of live nodes
1.20
131072 nodes
1.00
0.60
0.40
0.20
0.95
0.90
0.85
0.80
0.75
0.70
0.65
0.60
0.55
0.50
0.45
0.40
0.35
0.30
0.25
0.20
0.15
0.10
0.05
0.00
0.00
Size
0.80
32
131072 nodes
10000 messages
0.20
0.15
0.10
0.6
0.5
0.4
0.3
0.2
0.00
0.1
0.05
0.0
Failed searches
0.25
33
Adversarial faults
A
dA
34
Level 0
Level 1
Level 2
G
G
35
k
xLi = xLi-1.
k
xRi = xRi-1.
Level i
Level i-1
x
..00..
Successor
constraints
xRi
xR i-1
..01..
xR i-1
..00..
36
Basic repair
If a node detects a missing neighbor, it tries
to patch the link using other levels.
1
1
3
2
37
Constraint violation
Neighbor at level i not present at level (i-1).
Level i
x
x
..00.. ..01.. ..01.. ..01..
x
x
Level i-1
..00.. ..01.. ..01.. ..01..
x
x
Level i-1
..00..
..01..
zipper
Level i
..01..
..01.. ..00.. ..01..
38
Conclusions
Similarities with DHTs
Decentralization.
O(log n) space at each node.
O(log n) search time.
Load balancing properties.
Tolerant of random faults.
39
Differences
Property
DHTs
Skip Graphs
O(log2n)
O(log n)
No
Yes
Repair mechanism
Partial
Tolerance of
Yes
Reqd.
Not reqd.
Insert/Delete
time
Locality
adversarial faults
Keyspace size
40
Open Problems
Design efficient repair mechanism.
Incorporate geographical proximity.
Study multi-dimensional skip graphs.
Evaluate performance in practice.
Study effect of byzantine failures.
?