You are on page 1of 56

Lecture 5: Graph Streams &

Lower Bounds

1
Graph Streams
• Fixed vertices

2
Graph Streams
• Turnstile model
• where
-,
-
• Graph: where

3
Semi-Streaming Algorithms
• Universe size:
• Streaming: space
• Semi-streaming: space

4
Graph Problems – Today :
Insert-only streams:
• Unweighted maximum matching
• Weighted maximum matching
Turnstile streams:
• Connectivity

5
Maximum Matching

6
Unweighted Maximum Matching

7
Unweighted Maximum Matching

8
Unweighted Maximum Matching

9
Immediate Lower Bound
• Unweighted maximum matching requires at least

?
bits of memory

10
Greedy Algorithm
• Set
• Process :
If both are unmatched in ,
add to .

• Claim: (1/2)-approximation

If but :
or have an edge in .
11
Analysis
• Let be a maximum matching
• For any :
either or are matched in .
• For every edge that is not in there is an edge in
• … so ???

12
Analysis
• Each : “one unit of blame”
• Who to blame?
• Edges in
• Want: each “not blamed too much”

If each blamed
times:

𝑀

𝑀
Analysis
• Each : “one unit of blame”
or (or both) are matched in .
If is matched: charge 1 to ’s edge
Otherwise, charge 1 to ’s edge.
• Total blame
• Each edge charged at most ?
total blame
Can we Do Better Than -Approximation?

15
Can we Do Better Than -Approximation?
• Better than requires space
• Much better algorithms known for pass

16
Weighted Maximum Matching

7
1 2

• Notation: = weight of ,

17
Somewhat-Greedy Algorithm
• // Edges+weights
• Process :
Let edges touching or
If :

Else do nothing.

18
Analysis
Life cycle of an edge :
• is born when it enters
• is killed by if was removed from because of
• is a survivor if it is born and never killed

Output = set of survivors.

19
Example
• is born
• is born
7 𝑒2 • is born; are killed by
1 2
𝑒1 𝑒3

20
Example
20 𝑒 • is born
5
• is born
10 𝑒2
7 • is born; are killed by
𝑒4 2 • is born; is killed by
1
𝑒1 𝑒3

21
“Trail of the Dead”
20 𝑒
5
For a survivor : 10
7 𝑒2
, where
𝑒4 2
• edges killed by , 1
𝑒1 𝑒3
• edges killed by edges in ,
•…

Observation:
Proof: set . For each we have .

22
Charging Scheme
Charge each to the survivors and their trails of dead: 4
1 2
• Say is accountable to if
• , or
• was not born because was in when arrived. At most 2 such edges
• Who gets blamed for ?
• If one edge is accountable to : charge to
• If are accountable to : charge
to
to

23
Charging Scheme
Charge each to the survivors and their trails of dead: 4
1 2
• Say is accountable to if
• , or
• was not born because was in when arrived. At most 2 such edges
• Who gets blamed for ?
• If one edge is accountable to : charge to
• If are accountable to : charge
to
Observation:
Charge by to . to

𝑤 ( 𝑜 ) ≤2 ( 𝑤 ( 𝑒1) +𝑤 ( 𝑒2 ) ) 24
So Far:
• Each charges to each 4
1 2
• Each charged by at most 2 edges
• Total charge to

• vs. ?
• Recall:
• Charge to

25
Conclusion: Maximum Matching
• (1/2)-approximation for unweighted
• Huge open problem
• (1/8)-approximation for weighted
• Actually 1/6 (HW)

• Next: for exact unweighted maximum matching

26
Step 1: - Connectivity
• Given and directed graph ,
is there a directed path from to ?
• Claim: requires space

𝑠 𝑡
𝐿 𝑅
|𝐿|=|𝑅|=𝑛 27
Step 1: - Connectivity
• Given and directed graph , Must store exactly
is there a directed path from to ?
• Claim: requires space
Stream:
1. Edges
How much
memory?

𝑠 𝑡 2. ???

𝐿 𝑅
|𝐿|=|𝑅|=𝑛 28
29
30
Connectivity in Turnstile Graph
Streams

31
Connectivity
• In space?
• Seems hard:

edges edges

“Need to know all edges”


32
Reminder: -Sampling
Linear sketch:

random matrix stream sketch

“Uniformly random”*

¿ distinct element

*error:

33
Reminder: -Sampling
Works in the turnstile model:
• Elements “arrive” and “leave”
• = (#times arrived) – (#times left)
• Sample from
Reminder: -Sampling
Additivity:
sketch of sketch of sketch of

𝜎1 𝜎2 𝜎1 𝜎2
𝑀 𝑀 𝑀

× +¿ ¿ × +¿ ×

35
Boruvka’s MST Algorithm
Grow forest:
1. Each component chooses
lightest outgoing edge

36
Boruvka’s MST Algorithm
Grow forest:
1. Each component chooses
lightest outgoing edge
2. Unify components

37
Boruvka’s MST Algorithm
Grow forest:
1. Each component chooses
lightest outgoing edge
2. Unify components

38
Boruvka’s MST Algorithm
Grow forest:
1. Each component chooses
lightest outgoing edge
2. Unify components
3. Repeat

39
Boruvka’s MST Algorithm
Grow forest:
1. Each component chooses
lightest outgoing edge
2. Unify components
3. Repeat

40
Boruvka’s MST Algorithm
#components #components/2
Grow forest:
1. Each component chooses
any lightest outgoing edge
2. Unify components
3. Repeat

iterations

41
Implementing Boruvka Using Linear
Sketches
• Define :

𝑁𝑏𝑟 ( 𝑣 )𝑢 =1⇔ { 𝑢,𝑣 } ∈ 𝐸 2

()
0 1 5
1 2
0 3
0 4 6
1 5
1 6

42
Implementing Boruvka Using Linear
Sketches
• For each : -sketch()
• Sample neighbor

43
Implementing Boruvka Using Linear
Sketches
• For each : -sketch()
• Sample neighbor

44
Implementing Boruvka Using Linear
Sketches
• For each : -sketch()
• Sample neighbor
• Unify along every edge sampled

What now?

45
Idea: Use Additivity
Redefine :

if

• -sampling from returns ???

46
{
1 , { 𝑣 ,𝑤 } ∈ 𝐸∧𝑣 >𝑤
Idea: Use Additivity 𝑁𝑏𝑟 ( 𝑣 ){𝑣 , 𝑤 }= −1 , { 𝑣 ,𝑤 } ∈ 𝐸∧𝑣 <𝑤
0 otherwise

+1 4

1
-1 2
+1 -1 3
+1
5

𝑵𝒃𝒓 ( 𝟐) 𝑵𝒃𝒓 ( 𝟑)

47
Implementing Boruvka Using Linear
Sketches
• For each : -sketch() Using same randomness!

• Sample neighbor
• Unify along every edge sampled:

+1 +1
-1
+1 -1
+1
-1
-1

48
Implementing Boruvka Using Linear
Sketches
• For each : -sketch() Using same randomness!

• Sample neighbor
• Unify along every edge sampled:

+1 +1
-1

-1

49
The Algorithm
• Generate random Post-processing:
• Initialize
• Process : • While :
• If set •
• If set • Let be the connected components
of

• For each : set

50
Things to Worry About
• Success probability = ?

51
Things to Worry About
• Up to components Instead: set
• All components must “succeed” Constant fraction of nodes succeed…
iterations
pay extra

52
More Things to Worry About
• After unifying , does “still work”?
• No!
• Queried , to decide what to unify
• Randomness in no longer independent of input!!

Instead:
• Let = #iterations
• Prepare for each
• Use the -th copy for iteration

53
The Algorithm
• Generate random Post-processing:
• Initialize •,
• Process : • While :
• If set •
• If set • Let be the connected components
For each : of

• For each , : set

54
Connectivity: Summary
• For each : need copies of -sketch
space
• Better than ….

55
Next Class: Lower Bounds
Using one-way communication complexity:
• “One problem to rule them all” (Index)
• Reductions from Connectivity, matching, …

56

You might also like