EECS 495: Randomized Algorithms Lecture 7
Reading: Text: Chapter 4; Balanced Allo- Oblivious Routing
cations by Azar, Broder, Karlin, and Upfal
• hypercube network
Balls and Bins
• permutation destinations
Problem: n balls, place obliviously into n Output:
• set of oblivious routes with min # steps
Claim: W/prob. (1 − n−c ), fullest bin has Algorithm: (deterministic): Bit ﬁxing (left
ln n to right)
(1 + o(1)) ln ln n balls.
Proof: Let Ejk be event that bin j has more Question: Randomized alg.?
than k balls Recall load-balancing: m jobs, n = m
machines; to distribute load oblivioiusly,
n i n−i
n 1 1 we randomly routed jobs to machines.
Pr[Ejk ] = 1−
i n n Idea: Load-balance paths!
ne i 1
i n First try: random destination,
∞ • T (el ) = # paths using el
e k e i
k k • By symmetry, all T (el ) equal
e k 1 • Expected path length n/2
k 1 − e/k
e k • LOE, total expected path length N n/2
k • N n edges in hypercube
n2 So E[T (el )] = 1/2, so delay at most n/2.
for k = O(log n/ log log n). Result follows by Claim: Delay ≤ 6n with high prob.
union bound. Proof: Chernoﬀ: Delay X ≤ l T (el ), so
• Pr[X > (1 + δ)µ] ≤ exp(−(1 + δ)µ) Intuition:
• Pr[X > 6n] ≤ exp(−6n)
• At most n/4 bins have 4 balls → prob.
WRONG! get bin with 5 balls at most (1/4)(1/4) =
Proof: Chernoﬀ: Fix packet i, let Hij indi-
cate if routes for i and j share an edge. Inde- • Expect n/16 bins have 5 balls → prob.
pendent and j Hij ≤ i T (el ). get bin with 6 balls at most 1/162
• delay of ﬁxed packet i ≥ 6n with prob. • Expect n/22 bins have k balls
≤ exp(−6n) ≤ 2−6n
• Whp, no bin has more than log log n
• prob. any N = 2n packets gets delay balls
more than 2−6n at most 2−5n (union
Problem: Assume system behaves as ex-
• time to route any packet at most length pects to analyze next layer, must cope with
plus delay, at most 7n conditioning.
Claim: Bound binomial: Pr[B(n, p) >
→ w/prob. ≥ 1 − 2−5n , every packet reaches 2np] < 2−np/3
random dest. in 7n or fewer steps.
Proof: B(n, p) = n Xi where
But wanted to reach d(i)!
Idea: Route to random intermediate desti- 1 : w/prob. p
nation. 0 : otherwise
• doubles path length • Chernoﬀ:
• destroys bad perms. eδ
Pr[X > (1 + δ)µ] <
(1 + δ)(1+δ)
Run backwards, same time bound, so packets
fail to reach ﬁnal dest. in at most 14n steps
with prob. at most 2−5n+1 ≤ 1/N . • µ = np, δ = 1, implies claim
Claim: With prob. ≥ 1 − 1/N , every packet
Note: Let Yi depend on X1 , . . . , Xi−1 . If
reaches dest. in at most 14n steps.
Pr[Yi |X1 , . . . , Xi−1 ] < p for all i, then X sto-
Note: Didn’t allow phase 2 to delay phase 1; castichally dominates Y , so can use above
must have packets wait at intermediate dest. bound.
for 7n steps.
• vi (t) = # bins of height ≥ i at time t
Power of Two Choices
• ht = height of t’th ball
Algorithm: For each ball, pick two bins ran-
domly, place in less-loaded bin. • bounds β4 = 1/4, βi = 2βi−1 = 2−2
Claim: Let Qi be event that vi ≤ βi n. Then • but then bins no longer grow because
Qi happens whp.
– prob. ball is tall for any i ≥ i∗ at
Proof: By induction. most ((log n)/n)2
• Let Yt = 1 if ht ≥ i+1 and vi (t−1) ≤ βi n – prob. two particular balls both tall
at most ((log n)/n)4 (events nega-
Yt indicates t’th ball placed in a bad bin
even though there were enough good bins.
– union bound, prob. two distinct tall
• Then Pr[Yi = 1] ≤ βi2 balls o(1)
• Then t Yt stochastically dominated by and bins don’t grown beyond i∗ + 1 if
X with p = βi2 only see one tall ball
• By Chernoﬀ, • βi∗ n = 2−2 ≥ log n → i∗ = log log n −
log log log n
Pr[ Yt ≥ 2nβi2 = βi+1 n] < 2−βi+1 n/6
t • so max load is O(log log n)
which is O(1/n ) so long as βi+1 n ≥
Relationship to random graphs: bins are
c log n
nodes, two choices are edges. Bound
comes from low expected degree and
When Qi holds, then t Yt is # tall balls:
“small” giant component.
• # tall bins ≤ # tall balls Note: Extensions:
• so • Pick more bins: O(logd log n)
Pr[¬Qi+1 |Qi ] ≤ Pr[ Yt > βi+1 n|Qi ] • Pick more bins and consistent tie-
t breaking: O(log log n/d)
≤ Pr[ Yt > βi+1 n]/ Pr[Qi ]
≤ 1/(n2 Pr[Qi ])
Deal with conditioning:
Pr[¬Qi+1 ] = Pr[¬Qi+1 |Qi ] Pr[Qi ] + Pr[¬Qi+1 |¬Qi ] Pr[¬Qi ]
≤ + Pr[¬Qi ]
Deal with large i:
• ok until that i∗ s.t. bound on # tall bins
dips below log n