SLIDE 1 Streaming Model of Computation
A streaming algorithm processes a data stream ๐:
- Input is presented as a sequence of items and can be examined in only
a few passes (typically just one).
- The algorithm has limited memory and cannot store the whole input
sequence.
- The algorithm can spend limited processing time per item.
- In some problems we are satisfied with an approximate answer.
- Approximation algorithms can be based on sketches (summaries) of the
data stream in memory.
SLIDE 2 Streaming Graph Algorithms
In many applications we deal with massive graphs. E.g. (vertices โ edges):
- Web-pages โ hyperlinks
- Neurons โ synapses
- IP addresses โ network flows
- People โ friendships
Processing such graphs with a classic graph algorithm may be infeasible! But it may be possible to use an algorithm developed for the data stream model.
SLIDE 3 Streaming Graph Algorithms
In many applications we deal with massive graphs. E.g. (vertices โ edges):
- Web-pages โ hyperlinks
- Neurons โ synapses
- IP addresses โ network flows
- People โ friendships
Processing such graphs with a classic graph algorithm may be infeasible! But it may be possible to use an algorithm developed for the data stream model. Presentation based on:
- A. McGregor โGraph Stream Algorithms: A Surveyโ [ACM SIGMOD Record 2014]
SLIDE 4
Streaming Graph Algorithms
SLIDE 5 Streaming Graph Algorithms
Data stream model
- The input is given by a stream of data. E.g., the stream could be the graph
edges.
- The algorithm can use a limited amount of memory to process the stream.
- The input stream must be processed in the order it arrives.
Related goals:
- Real-time systems.
- I/O efficiency.
- Trade-off size and accuracy.
SLIDE 6 Streaming Graph Algorithms
Data stream model How much memory should our model allow in order to be able to process a graph with ๐ vertices?
- Most problems are intractable if space is < ๐.
- We will work in the semi-streaming model that allows O(๐ log๐๐) memory, for
some constant ๐.
- Some algorithms will be randomized. We will say that an event ๐น occurs with
high probability if Pr ๐น โฅ 1 โ 1/๐.
SLIDE 7
Streaming Graph Algorithms
Graph connectivity Data stream ๐: Edges of a graph ๐ป = (๐, ๐น) with ๐ = ๐ 1 2 3 4 ๐ป E.g., data stream ๐ = (1,2), (2,3), (1,3), (3,4)
SLIDE 8
Streaming Graph Algorithms
Graph connectivity Data stream ๐: Edges of a graph ๐ป = (๐, ๐น) with ๐ = ๐ The goal is to test if ๐ป is connected, i.e., for any two vertices there is a path that connects them. ๐ฆ ๐ง ๐ป
SLIDE 9
Streaming Graph Algorithms
Graph connectivity Data stream ๐: Edges of a graph ๐ป = (๐, ๐น) with ๐ = ๐ The goal is to test if ๐ป is connected, i.e., for any two vertices there is a path that connects them. ๐ฆ ๐ง ๐ป Simple algorithm: Maintain a set of edges ๐ผ. When we read the next edge (๐ฃ, ๐ค) from the stream, we add it to ๐ผ if there is currently no path between ๐ฃ and ๐ค.
SLIDE 10
Streaming Graph Algorithms
Spanners ๐-spanner ๐ผ of a graph ๐ป = (๐, ๐น): subgraph of ๐ป such that for all pairs ๐ฃ, ๐ค โ ๐,
๐๐ป(๐ฃ, ๐ค) โค ๐๐ผ(๐ฃ, ๐ค) โค ๐ โ ๐๐ป(๐ฃ, ๐ค)
๐๐ป ๐ฃ, ๐ค = length of the shortest path between ๐ฃ and ๐ค in ๐ป ๐๐ผ ๐ฃ, ๐ค = length of the shortest path between ๐ฃ and ๐ค in ๐ผ 1 2 3 4 ๐ป
SLIDE 11
Streaming Graph Algorithms
Spanners ๐-spanner ๐ผ of a graph ๐ป = (๐, ๐น): subgraph of ๐ป such that for all pairs ๐ฃ, ๐ค โ ๐,
๐๐ป(๐ฃ, ๐ค) โค ๐๐ผ(๐ฃ, ๐ค) โค ๐ โ ๐๐ป(๐ฃ, ๐ค)
๐๐ป ๐ฃ, ๐ค = length of the shortest path between ๐ฃ and ๐ค in ๐ป ๐๐ผ ๐ฃ, ๐ค = length of the shortest path between ๐ฃ and ๐ค in ๐ผ 1 2 3 4 1 2 3 4 ๐ป ๐ผ 2-spanner
SLIDE 12 Streaming Graph Algorithms
Spanners Construction of an ๐-spanner ๐ผ: add next edge (๐ฃ, ๐ค) if it does not create a short cycle in ๐ผ Greedy Spanner Algorithm 1. ๐ผ โ โ
2. for
- r each edge (๐ฃ, ๐ค) โ ๐ do
do 3. if if ๐๐ผ ๐ฃ, ๐ค > ๐ the then add (๐ฃ, ๐ค) to ๐ผ 4. ret eturn ๐ผ
- Does this work?
- What is the size (#edges) of the spanner?
SLIDE 13 Streaming Graph Algorithms
Spanners Proof that the Greedy Spanner Algorithm works: For any edge (๐ฆ, ๐ง) of ๐ป we have ๐๐ผ ๐ฆ, ๐ง โค ๐. Length of ๐ in ๐ป = ๐ = ๐๐ป ๐ค0, ๐ค1 + ๐๐ป ๐ค1, ๐ค2 + โฏ + ๐๐ป ๐ค๐โ1, ๐ค๐ ๐ค0 ๐ค1
๐ค๐โ1
๐ค๐ ๐ ๐๐ผ ๐ค0, ๐ค1 โค ๐ ๐๐ผ ๐ค๐โ1, ๐ค๐ โค ๐ Consider a path ๐ = ๐ค0, ๐ค1, . . , ๐ค๐โ1, ๐ค๐ in ๐ป
SLIDE 14 Streaming Graph Algorithms
Spanners Proof that the Greedy Spanner Algorithm works: For any edge (๐ฆ, ๐ง) of ๐ป we have ๐๐ผ ๐ฆ, ๐ง โค ๐. Length of ๐ in ๐ป = ๐ = ๐๐ป ๐ค0, ๐ค1 + ๐๐ป ๐ค1, ๐ค2 + โฏ + ๐๐ป ๐ค๐โ1, ๐ค๐ ๐ค0 ๐ค1
๐ค๐โ1
๐ค๐ ๐ ๐๐ผ ๐ค0, ๐ค1 โค ๐ ๐๐ผ ๐ค๐โ1, ๐ค๐ โค ๐ Length in ๐ผ โค ๐๐ผ ๐ค0, ๐ค1 + ๐๐ผ ๐ค1, ๐ค2 + โฏ + ๐๐ผ ๐ค๐โ1, ๐ค๐ Consider a path ๐ = ๐ค0, ๐ค1, . . , ๐ค๐โ1, ๐ค๐ in ๐ป โค ๐ โ ๐๐ป ๐ค0, ๐ค1 + ๐ โ ๐๐ป ๐ค1, ๐ค2 + โฏ + ๐ โ ๐๐ป ๐ค๐โ1, ๐ค๐ = ๐ โ ๐
SLIDE 15 Streaming Graph Algorithms
Spanners How many edges are inserted into ๐ผ?
- By a known result in Graph Theory, any such graph has at most
O ๐1+ ฮค
1 ๐ข
- Let ๐ = 2๐ข โ 1, for some integer ๐ข.
- Then ๐ผ does not contain cycles of length < 2๐ข.
edges.
SLIDE 16 Streaming Graph Algorithms
Minimum Spanning Tree Data stream ๐: Edges of a weighted graph ๐ป = (๐, ๐น, ๐ฅ) with ๐ = ๐ Greedy MST Algorithm 1. ๐ผ โ โ
2. for
- r each edge ๐ = (๐ฃ, ๐ค) โ ๐ do
do 3. if if ๐ creates a cycle ๐ท in ๐ผ th then 4. find the maximum weight edge ๐ โ ๐ท 5. add ๐ to ๐ผ 6. delete ๐ from ๐ผ 7. ret eturn ๐ผ Construction: if next edge (๐ฃ, ๐ค) creates a cycle ๐ท in ๐ผ, delete from ๐ผ the maximum weight edge of ๐ท.
SLIDE 17 Streaming Graph Algorithms
Graph Sparsification Given a graph ๐ป = (๐, ๐น) we want to construct a weighted subgraph ๐ผ = (๐, ๐น๐ผ, ๐ฅ) of ๐ป that estimates various (connectivity) properties of ๐ป E.g.:
- Cut sparsification [Benczur-Karger]
- Spectral sparsification [Spielman-Teng]
SLIDE 18
Streaming Graph Algorithms
Picture from https://simons.berkeley.edu/sites/default/files/docs/1768/slidessrivastava1.pdf
SLIDE 19
Streaming Graph Algorithms
Cuts in Graphs Weighted graph ๐ป = (๐, ๐น, ๐ฅ). Edge weights ๐ฅ โถ ๐น โ ๐ ๐ต-cut: partition of ๐ into two sets ๐ต and ๐\๐ต ๐๐ป ๐ฃ = set of edges in ๐ป crossing the ๐ต-cut. ๐๐ป ๐ฃ =
๐ฃ, ๐ค โ ๐น โถ ๐ฃ โ ๐ต, ๐ค โ ๐\A
Size of ๐ต-cut in ๐ป: ๐๐ต ๐ป = ฯ๐โ๐๐ป(๐ฃ) ๐ฅ(๐)
SLIDE 20
Streaming Graph Algorithms
Cuts in Graphs 26 17 12 14 7 9 20 4 10 ๐ ๐ ๐ ๐ ๐ ๐ Weighted graph ๐ป = (๐, ๐น, ๐ฅ). Edge weights ๐ฅ โถ ๐น โ ๐ ๐ต-cut: partition of ๐ into two sets ๐ต and ๐\๐ต ๐๐ป ๐ฃ = set of edges in ๐ป crossing the ๐ต-cut. ๐๐ป ๐ฃ =
๐ฃ, ๐ค โ ๐น โถ ๐ฃ โ ๐ต, ๐ค โ ๐\A
Size of ๐ต-cut in ๐ป: ๐๐ต ๐ป = ฯ๐โ๐๐ป(๐ฃ) ๐ฅ(๐)
SLIDE 21
Streaming Graph Algorithms
Cuts in Graphs 26 17 12 14 7 9 20 4 10 ๐ ๐ ๐ ๐ ๐ ๐ Weighted graph ๐ป = (๐, ๐น, ๐ฅ). Edge weights ๐ฅ โถ ๐น โ ๐ ๐ต-cut: partition of ๐ into two sets ๐ต and ๐\๐ต ๐๐ป ๐ฃ = set of edges in ๐ป crossing the ๐ต-cut. ๐๐ป ๐ฃ =
๐ฃ, ๐ค โ ๐น โถ ๐ฃ โ ๐ต, ๐ค โ ๐\A
Size of ๐ต-cut in ๐ป: ๐๐ต ๐ป = ฯ๐โ๐๐ป(๐ฃ) ๐ฅ(๐) ๐๐ต ๐ป = ๐ฅ ๐, ๐ + ๐ฅ ๐, ๐ + ๐ฅ ๐, ๐ + ๐ฅ ๐, ๐ + ๐ฅ ๐, ๐ = 17 + 10 + 9 + 7 + 20 = 63 ๐ต ๐\๐ต
SLIDE 22
Streaming Graph Algorithms
Cuts in Graphs 26 17 12 14 7 9 20 4 10 ๐ ๐ ๐ ๐ ๐ ๐ Weighted graph ๐ป = (๐, ๐น, ๐ฅ). Edge weights ๐ฅ โถ ๐น โ ๐ ๐ต-cut: partition of ๐ into two sets ๐ต and ๐\๐ต ๐๐ป ๐ฃ = set of edges in ๐ป crossing the ๐ต-cut. ๐๐ป ๐ฃ =
๐ฃ, ๐ค โ ๐น โถ ๐ฃ โ ๐ต, ๐ค โ ๐\A
Size of ๐ต-cut in ๐ป: ๐๐ต ๐ป = ฯ๐โ๐๐ป(๐ฃ) ๐ฅ(๐) ๐๐ต ๐ป = ๐ฅ ๐, ๐ + ๐ฅ ๐, ๐ + ๐ฅ ๐, ๐ = 12 + 9 + 14 = 35 ๐ต ๐\๐ต
SLIDE 23
Streaming Graph Algorithms
Cut Sparsification Given a graph ๐ป = (๐, ๐น) we want to construct a weighted subgraph ๐ผ = (๐, ๐น๐ผ, ๐ฅ) of ๐ป that estimates the size of each cut of ๐ป (1 + ๐) cut sparsification
1 โ ๐ โ ๐๐ต ๐ป โค ๐๐ต ๐ผ โค (1 + ๐) โ ๐๐ต ๐ป
for all vertex subsets ๐ต โ ๐
SLIDE 24
Streaming Graph Algorithms
Graph Laplacian Weighted graph ๐ป = (๐, ๐น, ๐ฅ). Edge weights ๐ฅ โถ ๐น โ ๐ Laplacian of ๐ป: ๐ ร ๐ real matrix ๐๐ป, ๐ = |๐|
๐๐ป ๐, ๐ = เท
๐,๐ โ๐น
๐ฅ ๐, ๐ , ๐ = ๐ โ๐ฅ ๐, ๐ , ๐ โ ๐
where ๐ฅ(๐, ๐) = 0 if (๐, ๐) โ ๐น
SLIDE 25
Streaming Graph Algorithms
Graph Laplacian 1 2 4 3 1 2 8 9 3 Weighted graph ๐ป = (๐, ๐น, ๐ฅ). Edge weights ๐ฅ โถ ๐น โ ๐ Laplacian of ๐ป: ๐ ร ๐ real matrix ๐๐ป, ๐ = |๐|
๐๐ป ๐, ๐ = เท
๐,๐ โ๐น
๐ฅ ๐, ๐ , ๐ = ๐ โ๐ฅ ๐, ๐ , ๐ โ ๐
where ๐ฅ(๐, ๐) = 0 if (๐, ๐) โ ๐น ๐๐ป = 14 โ3 โ9 โ2 โ3 4 โ1 โ9 โ1 18 โ8 โ2 โ8 10
SLIDE 26
Streaming Graph Algorithms
Graph Laplacian Weighted graph ๐ป = (๐, ๐น, ๐ฅ). Edge weights ๐ฅ โถ ๐น โ ๐ Laplacian of ๐ป: ๐ ร ๐ real matrix ๐๐ป, ๐ = |๐|
๐๐ป ๐, ๐ = เท
๐,๐ โ๐น
๐ฅ ๐, ๐ , ๐ = ๐ โ๐ฅ ๐, ๐ , ๐ โ ๐
where ๐ฅ(๐, ๐) = 0 if (๐, ๐) โ ๐น Let ๐ฆ = ๐ฆ1 โฎ ๐ฆ๐ be a real vector in โ๐. Recall that ๐ฆ๐ = ๐ฆ1 โฏ ๐ฆ๐
SLIDE 27
Streaming Graph Algorithms
Graph Laplacian Weighted graph ๐ป = (๐, ๐น, ๐ฅ). Edge weights ๐ฅ โถ ๐น โ ๐ Laplacian of ๐ป: ๐ ร ๐ real matrix ๐๐ป, ๐ = |๐|
๐๐ป ๐, ๐ = เท
๐,๐ โ๐น
๐ฅ ๐, ๐ , ๐ = ๐ โ๐ฅ ๐, ๐ , ๐ โ ๐
where ๐ฅ(๐, ๐) = 0 if (๐, ๐) โ ๐น Let ๐ฆ = ๐ฆ1 โฎ ๐ฆ๐ be a real vector in โ๐. Recall that ๐ฆ๐ = ๐ฆ1 โฏ ๐ฆ๐ Then
๐ฆ๐๐๐ป๐ฆ = เท
(๐,๐)โ๐น
๐ฅ(๐, ๐) ๐ฆ๐ โ ๐ฆ๐
2
SLIDE 28
Streaming Graph Algorithms
Spectral Sparsification Graph ๐ป = (๐, ๐น) A weighted subgraph ๐ผ = (๐, ๐น๐ผ, ๐ฅ) of ๐ป is a (1 + ๐) spectral sparsifier of ๐ป if
1 โ ๐ โ ๐ฆ๐๐๐ป๐ฆ โค ๐ฆ๐๐๐ผ๐ฆ โค (1 + ๐) โ ๐ฆ๐๐๐ป๐ฆ
for all real vectors ๐ฆ โ โ๐
SLIDE 29 Streaming Graph Algorithms
Spectral Sparsification Graph ๐ป = (๐, ๐น) A weighted subgraph ๐ผ = (๐, ๐น๐ผ, ๐ฅ) of ๐ป is a (1 + ๐) spectral sparsifier of ๐ป if
1 โ ๐ โ ๐ฆ๐๐๐ป๐ฆ โค ๐ฆ๐๐๐ผ๐ฆ โค (1 + ๐) โ ๐ฆ๐๐๐ป๐ฆ
for all real vectors ๐ฆ โ โ๐ A spectral sparsifier of ๐ป can approximate:
- Size of all cuts
- Eigenvalues
- Effective resistances (in the corresponding electrical network)
- Properties of random walks
SLIDE 30
Streaming Graph Algorithms
Spectral Sparsification Graph ๐ป = (๐, ๐น) A weighted subgraph ๐ผ = (๐, ๐น๐ผ, ๐ฅ) of ๐ป is a (1 + ๐) spectral sparsifier of ๐ป if
1 โ ๐ โ ๐ฆ๐๐๐ป๐ฆ โค ๐ฆ๐๐๐ผ๐ฆ โค (1 + ๐) โ ๐ฆ๐๐๐ป๐ฆ
for all real vectors ๐ฆ โ โ๐ Theorem [Spielman and Teng] A (1 + ๐) spectral sparsifier with O(๐ log ๐ /๐2) edges can be constructed in O(๐ polylog(๐)/๐2), where ๐ is the number of vertices and ๐ is the number of edges of the input graph.
SLIDE 31
Streaming Graph Algorithms
Spectral Sparsification Graph ๐ป = (๐, ๐น) A weighted subgraph ๐ผ = (๐, ๐น๐ผ, ๐ฅ) of ๐ป is a (1 + ๐) spectral sparsifier of ๐ป if
1 โ ๐ โ ๐ฆ๐๐๐ป๐ฆ โค ๐ฆ๐๐๐ผ๐ฆ โค (1 + ๐) โ ๐ฆ๐๐๐ป๐ฆ
for all real vectors ๐ฆ โ โ๐ Theorem [Spielman and Teng] A (1 + ๐) spectral sparsifier with O(๐ log ๐ /๐2) edges can be constructed in O(๐ polylog(๐)/๐2), where ๐ is the number of vertices and ๐ is the number of edges of the input graph. Theorem [Batson, Spielman and Srivastava] A graph with ๐ vertices has a (1 + ๐) spectral sparsifier with O(๐/๐2) edges.
SLIDE 32 Streaming Graph Algorithms
Spectral Sparsification โ Construction in the semi-streaming model
- Use as a black box any existing algorithm ALG that returns a (1 + ๐ฟ)
spectral sparsifier.
- ALG returns a spectral sparsifier with ๐ก๐๐จ๐(๐ฟ) = O(๐/๐ฟ2) number of edges.
SLIDE 33 Streaming Graph Algorithms
Spectral Sparsification โ Construction in the semi-streaming model
- Use as a black box any existing algorithm ALG that returns a (1 + ๐ฟ)
spectral sparsifier.
- ALG returns a spectral sparsifier with ๐ก๐๐จ๐(๐ฟ) = O(๐/๐ฟ2) number of edges.
We use the following properties of spectral sparsification
- Mergeable: Suppose ๐ผ1 and ๐ผ2 are ๐พ spectral sparsifiers of two graphs
๐ป1 and ๐ป2 on the same set of vertices. Then ๐ผ1 โช ๐ผ2 is a ๐พ spectral sparsifier of ๐ป1 โช ๐ป2.
- Composable: If ๐ผ3 is a ๐พ spectral sparsifier for ๐ผ2 and ๐ผ2 is a ๐ spectral
sparsifier for ๐ผ1 then ๐ผ3 is a ๐พ๐ spectral sparsifier for ๐ผ1.
SLIDE 34 Streaming Graph Algorithms
Spectral Sparsification โ Construction in the semi-streaming model Let ๐ป = (๐, ๐น) be the input graph with ๐ = |๐| and ๐ = ๐น Data stream ๐ = the ๐ edges of ๐ป Set ๐ข = ๐/๐ก๐๐จ๐(๐ฟ). For simplicity assume that ๐ข is a power of 2 We divide ๐ into ๐ข segments of ๐ก๐๐จ๐(๐ฟ) edges ๐ป๐
0 = graph that consists of the edges in the ๐-th segment
โฆ ๐ก๐๐จ๐(๐ฟ) ๐ก๐๐จ๐(๐ฟ) ๐ก๐๐จ๐(๐ฟ) ๐ป1 ๐ป2 ๐ป๐ข ๐
SLIDE 35 Streaming Graph Algorithms
Spectral Sparsification โ Construction in the semi-streaming model Set ๐ข = ๐/๐ก๐๐จ๐(๐ฟ). For simplicity assume that ๐ข is a power of 2 (๐ข = 2๐, ๐ = lg ๐ข) We divide ๐ into ๐ข segments of ๐ก๐๐จ๐(๐ฟ) edges ๐ป๐
0 = graph that consists of the edges in the ๐-th segment
For ๐ = 1,2, โฆ , lg ๐ข and ๐ = 1,2, โฆ , ๐ข/2๐ define ๐ป๐
๐ = ๐ป2๐โ1 ๐โ1 โช ๐ป2๐ ๐โ1
E.g., for ๐ข = 4 ๐ป1
1 = ๐ป1 0 โช ๐ป2
๐ป2
1 = ๐ป3 0 โช ๐ป4
๐ป1 ๐ป2 ๐ป3 ๐ป4 ๐ป1
2 = ๐ป1 1 โช ๐ป2 1 = ๐ป
SLIDE 36 Streaming Graph Algorithms
Spectral Sparsification โ Construction in the semi-streaming model Set ๐ข = ๐/๐ก๐๐จ๐(๐ฟ). For simplicity assume that ๐ข is a power of 2 (๐ข = 2๐, ๐ = lg ๐ข) We divide ๐ into ๐ข segments of ๐ก๐๐จ๐(๐ฟ) edges ๐ป๐
0 = graph that consists of the edges in the ๐-th segment
For ๐ = 1,2, โฆ , lg ๐ข and ๐ = 1,2, โฆ , ๐ข/2๐ define ๐ป๐
๐ = ๐ป2๐โ1 ๐โ1 โช ๐ป2๐ ๐โ1
For each ๐ป๐
๐ define a weighted subgraph ๐ผ๐ ๐ :
0 = ๐ป๐
๐ = ALG(๐ผ2๐โ1 ๐โ1 โช ๐ผ2๐ ๐โ1), ๐ > 0
SLIDE 37 Streaming Graph Algorithms
Spectral Sparsification โ Construction in the semi-streaming model Set ๐ข = ๐/๐ก๐๐จ๐(๐ฟ). For simplicity assume that ๐ข is a power of 2 (๐ข = 2๐, ๐ = lg ๐ข) We divide ๐ into ๐ข segments of ๐ก๐๐จ๐(๐ฟ) edges ๐ป๐
0 = graph that consists of the edges in the ๐-th segment
For ๐ = 1,2, โฆ , lg ๐ข and ๐ = 1,2, โฆ , ๐ข/2๐ define ๐ป๐
๐ = ๐ป2๐โ1 ๐โ1 โช ๐ป2๐ ๐โ1
For each ๐ป๐
๐ define a weighted subgraph ๐ผ๐ ๐ :
0 = ๐ป๐
๐ = ALG(๐ผ2๐โ1 ๐โ1 โช ๐ผ2๐ ๐โ1), ๐ > 0
By the mergeable and composable properties ๐ผ1
lg ๐ข is a (1 + ๐ฟ)lg ๐ข sparsifier of ๐ป
SLIDE 38 Streaming Graph Algorithms
Spectral Sparsification โ Construction in the semi-streaming model By the mergeable and composable properties ๐ผ1
lg ๐ข is a (1 + ๐ฟ)lg ๐ข sparsifier of ๐ป
Set ๐ฟ = ๐/(2 lg ๐ข) โ (1 + ๐ฟ)lg ๐ข ~ (1 + ๐) Then ๐ผ1
lg ๐ข is a (1 + ๐) sparsifier of ๐ป
SLIDE 39 Streaming Graph Algorithms
Spectral Sparsification โ Construction in the semi-streaming model By the mergeable and composable properties ๐ผ1
lg ๐ข is a (1 + ๐ฟ)lg ๐ข sparsifier of ๐ป
Set ๐ฟ = ๐/(2 lg ๐ข) โ (1 + ๐ฟ)lg ๐ข ~ (1 + ๐) Then ๐ผ1
lg ๐ข is a (1 + ๐) sparsifier of ๐ป
Space required ๐ผ๐
๐ = ALG ๐ผ2๐โ1 ๐โ1 โช ๐ผ2๐ ๐โ1
๐ผ2๐โ1
๐โ1
๐ผ2๐
๐โ1
Delete ๐ผ2๐โ1
๐โ1 and ๐ผ2๐ ๐โ1
as soon as ๐ผ๐
๐ is computed
โ For each ๐ we need to store ๐ผ๐
๐
- nly for two values of ๐
SLIDE 40 Streaming Graph Algorithms
Spectral Sparsification โ Construction in the semi-streaming model By the mergeable and composable properties ๐ผ1
lg ๐ข is a (1 + ๐ฟ)lg ๐ข sparsifier of ๐ป
Set ๐ฟ = ๐/(2 lg ๐ข) โ (1 + ๐ฟ)lg ๐ข ~ (1 + ๐) Then ๐ผ1
lg ๐ข is a (1 + ๐) sparsifier of ๐ป
Space required ๐ผ๐
๐ = ALG ๐ผ2๐โ1 ๐โ1 โช ๐ผ2๐ ๐โ1
๐ผ2๐โ1
๐โ1
๐ผ2๐
๐โ1
Delete ๐ผ2๐โ1
๐โ1 and ๐ผ2๐ ๐โ1
as soon as ๐ผ๐
๐ is computed
โ For each ๐ we need to store ๐ผ๐
๐
- nly for two values of ๐
So at any given time we need to store โค 2 โ ๐ก๐๐จ๐ ๐ฟ โ lg ๐ข = O(๐ lg3๐/๐2)
SLIDE 41
Streaming Graph Algorithms
Matchings Graph ๐ป = (๐, ๐น) Goal: Find a maximum cardinality matching ๐โ Matching: Subset of edges ๐ โ ๐น such that each vertex is adjacent to at most one edge in ๐
SLIDE 42
Streaming Graph Algorithms
Matchings Graph ๐ป = (๐, ๐น) Goal: Find a maximum cardinality matching ๐โ Matching: Subset of edges ๐ โ ๐น such that each vertex is adjacent to at most one edge in ๐
SLIDE 43 Streaming Graph Algorithms
Matchings Graph ๐ป = (๐, ๐น) Goal: Find a maximum cardinality matching ๐โ Greedy Matching Algorithm 1. ๐ โ โ
2. for
- r each edge ๐ โ ๐ do
do 3. if if ๐ โช {๐} is a matching the then add ๐ to ๐ 4. ret eturn ๐ Matching: Subset of edges ๐ โ ๐น such that each vertex is adjacent to at most one edge in ๐
SLIDE 44
Streaming Graph Algorithms
Matchings Graph ๐ป = (๐, ๐น) Goal: Find a maximum cardinality matching ๐โ The Greedy Matching Algorithm computes a matching ๐ with cardinality ๐ โฅ ๐โ /2 Matching: Subset of edges ๐ โ ๐น such that each vertex is adjacent to at most one edge in ๐
SLIDE 45
Streaming Graph Algorithms
Matchings Graph ๐ป = (๐, ๐น) Matching: Subset of edges ๐ โ ๐น such that each vertex is adjacent to at most one edge in ๐ Goal: Find a maximum cardinality matching ๐โ The Greedy Matching Algorithm computes a matching ๐ with cardinality ๐ โฅ ๐โ /2 ๐ฃ ๐ค โ ๐โ Consider an edge (๐ฃ, ๐ค) โ ๐โ If (๐ฃ, ๐ค) โ ๐ then ๐ must contain at least one edge ๐ adjacent to ๐ฃ or to ๐ค ๐ is adjacent to at most 2 edges of ๐โ ๐ฃโฒ ๐คโฒ โ ๐โ โ ๐ ๐
SLIDE 46
Streaming Graph Algorithms
Weighted Matchings Weighted graph ๐ป = (๐, ๐น, ๐ฅ). Edge weights ๐ฅ โถ ๐น โ โ+ (๐ฅ(๐) > 0, โ๐ โ ๐น) Goal: Find a maximum weight matching ๐โ As before, we process the edges of the stream ๐ as they arrive and try to augment the current matching ๐
SLIDE 47
Streaming Graph Algorithms
Weighted Matchings Weighted graph ๐ป = (๐, ๐น, ๐ฅ). Edge weights ๐ฅ โถ ๐น โ โ+ (๐ฅ(๐) > 0, โ๐ โ ๐น) Goal: Find a maximum weight matching ๐โ As before, we process the edges of the stream ๐ as they arrive and try to augment the current matching ๐ Let ๐ be the next edge read from ๐. Let ๐ท be the edges of ๐ that are in conflict with ๐ : and edge in ๐ท and ๐ are adjacent to a common vertex.
SLIDE 48
Streaming Graph Algorithms
Weighted Matchings Weighted graph ๐ป = (๐, ๐น, ๐ฅ). Edge weights ๐ฅ โถ ๐น โ โ+ (๐ฅ(๐) > 0, โ๐ โ ๐น) Goal: Find a maximum weight matching ๐โ As before, we process the edges of the stream ๐ as they arrive and try to augment the current matching ๐ Let ๐ be the next edge read from ๐. Let ๐ท be the edges of ๐ that are in conflict with ๐ : and edge in ๐ท and ๐ are adjacent to a common vertex. โ ๐ โ ๐ ๐ ๐ท has at most two edges. Let ๐ฅ(๐ท) be the total weight of the edges in ๐ท. If ๐ฅ(๐) > ๐ฅ(๐ท) then we increase the weight of ๐ by including ๐ and deleting the edges of ๐ท.
SLIDE 49 Streaming Graph Algorithms
Weighted Matchings Let ๐ be the next edge read from ๐. Let ๐ท be the edges of ๐ that are in conflict with ๐ : and edge in ๐ท and ๐ are adjacent to a common vertex. โ ๐ โ ๐ ๐ If ๐ฅ(๐) > ๐ฅ(๐ท) then we increase the weight of ๐ by including ๐ and deleting the edges of ๐ท. ๐ฅ(๐ท) = total weight of the edges in ๐ท. Greedy Weighted Matching Algorithm 1. ๐ โ โ
2. for
- r each edge ๐ โ ๐ do
do 3. let ๐ท be the set of edges that are in conflict with ๐ 4. if if ๐ฅ ๐ > ๐ฅ(๐ท) th then add ๐ to ๐ and delete ๐ท from ๐ 5. ret eturn ๐
SLIDE 50
Streaming Graph Algorithms
Weighted Matchings Consider the following scenario ๐ = (1,2), (2,3), (3,4), โฆ , (๐, ๐ โ 1) Edge ๐๐ = (๐, ๐ + 1) has weight ๐ฅ(๐๐) = 1 + ๐๐, for a small ๐ > 0 1 + ๐
2 1 4 3 5 6
1 + 2๐ 1 + 3๐ 1 + 4๐ 1 + 5๐ ๐ = {}
SLIDE 51
Streaming Graph Algorithms
Weighted Matchings Consider the following scenario ๐ = (1,2), (2,3), (3,4), โฆ , (๐, ๐ โ 1) Edge ๐๐ = (๐, ๐ + 1) has weight ๐ฅ(๐๐) = 1 + ๐๐, for a small ๐ > 0 ๐ = {(1,2)} 1 + ๐
2 1 4 3 5 6
1 + 2๐ 1 + 3๐ 1 + 4๐ 1 + 5๐
SLIDE 52
Streaming Graph Algorithms
Weighted Matchings Consider the following scenario ๐ = (1,2), (2,3), (3,4), โฆ , (๐, ๐ โ 1) Edge ๐๐ = (๐, ๐ + 1) has weight ๐ฅ(๐๐) = 1 + ๐๐, for a small ๐ > 0 ๐ = {(1,2)} 1 + ๐
2 1 4 3 5 6
1 + 2๐ 1 + 3๐ 1 + 4๐ 1 + 5๐
SLIDE 53
Streaming Graph Algorithms
Weighted Matchings Consider the following scenario ๐ = (1,2), (2,3), (3,4), โฆ , (๐, ๐ โ 1) Edge ๐๐ = (๐, ๐ + 1) has weight ๐ฅ(๐๐) = 1 + ๐๐, for a small ๐ > 0 ๐ = {(2,3)} 1 + ๐
2 1 4 3 5 6
1 + 2๐ 1 + 3๐ 1 + 4๐ 1 + 5๐
SLIDE 54
Streaming Graph Algorithms
Weighted Matchings Consider the following scenario ๐ = (1,2), (2,3), (3,4), โฆ , (๐, ๐ โ 1) Edge ๐๐ = (๐, ๐ + 1) has weight ๐ฅ(๐๐) = 1 + ๐๐, for a small ๐ > 0 ๐ = {(2,3)} 1 + ๐
2 1 4 3 5 6
1 + 2๐ 1 + 3๐ 1 + 4๐ 1 + 5๐
SLIDE 55
Streaming Graph Algorithms
Weighted Matchings Consider the following scenario ๐ = (1,2), (2,3), (3,4), โฆ , (๐, ๐ โ 1) Edge ๐๐ = (๐, ๐ + 1) has weight ๐ฅ(๐๐) = 1 + ๐๐, for a small ๐ > 0 ๐ = {(3,4)} 1 + ๐
2 1 4 3 5 6
1 + 2๐ 1 + 3๐ 1 + 4๐ 1 + 5๐
SLIDE 56
Streaming Graph Algorithms
Weighted Matchings Consider the following scenario ๐ = (1,2), (2,3), (3,4), โฆ , (๐, ๐ โ 1) Edge ๐๐ = (๐, ๐ + 1) has weight ๐ฅ(๐๐) = 1 + ๐๐, for a small ๐ > 0 ๐ = {(3,4)} 1 + ๐
2 1 4 3 5 6
1 + 2๐ 1 + 3๐ 1 + 4๐ 1 + 5๐
SLIDE 57
Streaming Graph Algorithms
Weighted Matchings Consider the following scenario ๐ = (1,2), (2,3), (3,4), โฆ , (๐, ๐ โ 1) Edge ๐๐ = (๐, ๐ + 1) has weight ๐ฅ(๐๐) = 1 + ๐๐, for a small ๐ > 0 ๐ = {(3,4)} 1 + ๐
2 1 4 3 5 6
1 + 2๐ 1 + 3๐ 1 + 4๐ 1 + 5๐
SLIDE 58
Streaming Graph Algorithms
Weighted Matchings Consider the following scenario ๐ = (1,2), (2,3), (3,4), โฆ , (๐, ๐ โ 1) Edge ๐๐ = (๐, ๐ + 1) has weight ๐ฅ(๐๐) = 1 + ๐๐, for a small ๐ > 0 ๐ = {(4,5)} 1 + ๐
2 1 4 3 5 6
1 + 2๐ 1 + 3๐ 1 + 4๐ 1 + 5๐
SLIDE 59
Streaming Graph Algorithms
Weighted Matchings Consider the following scenario ๐ = (1,2), (2,3), (3,4), โฆ , (๐, ๐ โ 1) Edge ๐๐ = (๐, ๐ + 1) has weight ๐ฅ(๐๐) = 1 + ๐๐, for a small ๐ > 0 ๐ = {(4,5)} 1 + ๐
2 1 4 3 5 6
1 + 2๐ 1 + 3๐ 1 + 4๐ 1 + 5๐
SLIDE 60
Streaming Graph Algorithms
Weighted Matchings Consider the following scenario ๐ = (1,2), (2,3), (3,4), โฆ , (๐, ๐ โ 1) Edge ๐๐ = (๐, ๐ + 1) has weight ๐ฅ(๐๐) = 1 + ๐๐, for a small ๐ > 0 ๐ = {(5,6)} 1 + ๐
2 1 4 3 5 6
1 + 2๐ 1 + 3๐ 1 + 4๐ 1 + 5๐ ๐ฅ(๐) = 1 + 5๐
SLIDE 61
Streaming Graph Algorithms
Weighted Matchings Consider the following scenario ๐ = (1,2), (2,3), (3,4), โฆ , (๐, ๐ โ 1) Edge ๐๐ = (๐, ๐ + 1) has weight ๐ฅ(๐๐) = 1 + ๐๐, for a small ๐ > 0 ๐ = {(5,6)} 1 + ๐
2 1 4 3 5 6
1 + 2๐ 1 + 3๐ 1 + 4๐ 1 + 5๐ ๐ฅ(๐) = 1 + 5๐ ๐โ = { 1,2 , 3,4 , (5,6)} 1 + ๐
2 1 4 3 5 6
1 + 2๐ 1 + 3๐ 1 + 4๐ 1 + 5๐ ๐ฅ(๐โ) = 3 + 9๐
SLIDE 62
Streaming Graph Algorithms
Weighted Matchings Consider the following scenario ๐ = (1,2), (2,3), (3,4), โฆ , (๐, ๐ โ 1) Edge ๐๐ = (๐, ๐ + 1) has weight ๐ฅ(๐๐) = 1 + ๐๐, for a small ๐ > 0 The computed matching ๐ has weight ๐ฅ(๐) = 1 + (๐ โ 1)๐ The optimal matching ๐ has weight ๐ฅ(๐โ) = ฯ๐ 1 + 2๐ โ 1 ๐ > (๐ โ 1)/2 Hence, the approximation ratio is ๐ฅ(๐โ) ๐ฅ(๐) > (๐ โ 1)/2 1 + ๐ โ 1 ๐ ~ ๐ 2
SLIDE 63
Streaming Graph Algorithms
Weighted Matchings The problem is that the trailing edges of ๐ that were once inserted into ๐ but removed later may have much larger total weight than the edges added later. ๐ = {(5,6)} 1 + ๐
2 1 4 3 5 6
1 + 2๐ 1 + 3๐ 1 + 4๐ 1 + 5๐ ๐ฅ(๐) = 1 + 5๐ trailing edges
SLIDE 64 Streaming Graph Algorithms
Weighted Matchings โ ๐ โ ๐ ๐ We include ๐ in ๐ If ๐ฅ ๐ > ๐พ๐ฅ(๐ท) for some constant ๐พ = 1 + ๐ฟ > 1. Modified algorithm Greedy Weighted Matching Algorithm 1. ๐ โ โ
2. for
- r each edge ๐ โ ๐ do
do 3. let ๐ท be the set of edges that are in conflict with ๐ 4. if if ๐ฅ ๐ > (1 + ๐ฟ) โ ๐ฅ(๐ท) th then add ๐ to ๐ and delete ๐ท from ๐ 5. ret eturn ๐
SLIDE 65 Streaming Graph Algorithms
Weighted Matchings The problem is that the trailing edges of ๐ that were once inserted into ๐ but removed later may have much larger total weight than the edges added later. ๐ = {(5,6)} 1 + ๐
2 1 4 3 5 6
1 + 2๐ 1 + 3๐ 1 + 4๐ 1 + 5๐ ๐ฅ(๐) = 1 + 5๐ trailing edges We include ๐ in ๐ If ๐ฅ ๐ > ๐พ๐ฅ(๐ท) for some constant ๐พ = 1 + ๐ฟ > 1. For an edge ๐ define
- ๐ท0 = {๐}
- ๐ท๐ = edges removed when an edge in ๐ท๐โ1 was added to ๐
- ๐
๐ = ๐ท1 โช ๐ท2 โช โฏ
Then ๐ฅ(๐
๐) โค ๐ฅ(๐)/๐ฟ
SLIDE 66 Streaming Graph Algorithms
Weighted Matchings It can be shown that ๐ฅ(๐โ) โค (1 + ๐ฟ) โ เท
๐โ๐
(๐ฅ ๐
๐ + 2๐ฅ(๐))
By applying a careful charging scheme we get ๐ฅ(๐โ) ๐ฅ(๐) < 5.828
SLIDE 67
Streaming Graph Algorithms
Weighted Matchings Multi-pass Algorithm Greedy Weighted Matching Algorithm ๐ ๐ = โ
๐ We can get a (2 + ๐)-approximation with O(๐โ3) passes over ๐, where ๐ฟ = O(๐)
SLIDE 68
Streaming Graph Algorithms
Graph Sketches Random linear projection ๐ โถ โ๐ โ โ๐, where ๐ โช ๐ ๐ ๐ = ๐๐ โ โ๐ โ โ๐ For any vector ๐ โ โ๐, the projection ๐๐ โ โ๐ preserves properties of ๐ with high probability Many applications: estimating entropy, heavy hitters, estimating norms, fitting polynomials,โฆ Rich theory: dimensionality reduction, sparse recovery, metric embeddings,โฆ โ โ๐ร๐
SLIDE 69 Streaming Graph Algorithms
Graph Sketches Can we use this approach for graphs? That is, can we project the adjacency matrix ๐ต๐ป of a graph ๐ป to a smaller matrix ๐๐ต๐ป, so that we can use ๐๐ต๐ป to compute properties of ๐ป?
- For a graph ๐ป with n vertices, ๐ต๐ป has O ๐2 dimensions.
- To work in the semi-streaming model we want ๐๐ต๐ป to have O(๐ polylog(๐))
dimensions.
SLIDE 70
Streaming Graph Algorithms
Graph Sketches
Picture from https://people.cs.umass.edu/~mcgregor/711S12/lec-2-2.pdf
SLIDE 71 Streaming Graph Algorithms
Graph Sketches Dynamic graph stream ๐ = ๐1, ๐2, โฆ where ๐๐ = (๐๐, ฮ๐
) ๐๐ = an edge of the graph ฮ๐ = แ +1, ๐๐ is inserted โ1, ๐๐ is deleted Multiplicity of edge ๐ :
๐
๐ = เท ๐โถ ๐๐=๐
ฮ๐
For simplicity we will assume that ๐
๐ โ 0,1 , for all edges e.
SLIDE 72 Streaming Graph Algorithms
Graph Sketches Vector of edge multiplicities ๐ โ 0,1
๐ 2
Each entry of ๐ is a multiplicity ๐
๐ of a (potential) edge ๐ of ๐ป (a simple graph with
๐ vertices has up to ๐
2 edges).
1 2 3 ๐12 ๐13 ๐23
๐ = ๐
๐12
๐
๐13
๐
๐23
= 1 1
SLIDE 73 Streaming Graph Algorithms
Graph Sketches Vector of edge multiplicities ๐ โ 0,1
๐ 2
Each entry of ๐ is a multiplicity ๐
๐ of a (potential) edge ๐ of ๐ป (a simple graph with
๐ vertices has up to ๐
2 edges).
Index vector of edge ๐ : ๐๐ โ 0,1
๐ 2 . The only nonzero entry of ๐๐ is the one that
corresponds to edge ๐. 1 2 3 ๐12 ๐13 ๐23
๐๐๐๐ = ๐๐12 ๐๐13 ๐๐23 = 1
SLIDE 74 Streaming Graph Algorithms
Graph Sketches Vector of edge multiplicities ๐ โ 0,1
๐ 2
Each entry of ๐ is a multiplicity ๐
๐ of a (potential) edge ๐ of ๐ป (a simple graph with
๐ vertices has up to ๐
2 edges).
Sketch of ๐ : ๐ต(๐) โ โ๐, ๐ =dimensionality of the sketch When we read the next item ๐, ฮ from the stream, we can update the sketch as follows:
๐ต ๐ = ๐ต ๐ + ฮ โ ๐ต(๐๐)
Index vector of edge ๐ : ๐๐ โ 0,1
๐ 2 . The only nonzero entry of ๐๐ is the one that
corresponds to edge ๐.
SLIDE 75 Streaming Graph Algorithms
Homomorphic Sketches Vector of edge multiplicities ๐ โ 0,1
๐ 2
Each entry of ๐ is a multiplicity ๐
๐ of a (potential) edge ๐ of ๐ป (a simple graph with
๐ vertices has up to ๐
2 edges).
For a vertex ๐ค let ๐๐ โ 0,1 ๐โ1 be the restriction of ๐ to the coordinates that involve ๐ค (i.e., the ๐ โ 1 edges that can be adjacent to ๐ค in ๐ป) 1 2 3 ๐12 ๐13 ๐23
๐ = ๐
๐12
๐
๐13
๐
๐23
= 1 1 ๐๐ = ๐
๐12
๐
๐13
= 1
SLIDE 76 Streaming Graph Algorithms
Homomorphic Sketches Vector of edge multiplicities ๐ โ 0,1
๐ 2
Each entry of ๐ is a multiplicity ๐
๐ of a (potential) edge ๐ of ๐ป (a simple graph with
๐ vertices has up to ๐
2 edges).
For a vertex ๐ค let ๐๐ โ 0,1 ๐โ1 be the restriction of ๐ to the coordinates that involve ๐ค (i.e., the ๐ โ 1 edges that can be adjacent to ๐ค in ๐ป)
๐ต ๐ = ๐ต1 ๐๐๐ โ ๐ต2 ๐๐๐ โ โฏ โ ๐ต๐ ๐๐๐
The sketches of ๐ are formed by concatenation (โ) of the sketches of each ๐๐ Homomorphic sketches: For each operation on ๐ป there is a corresponding
SLIDE 77
Streaming Graph Algorithms
Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) 1 2 3 4 6 7 5
SLIDE 78
Streaming Graph Algorithms
Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) Connectivity Algorithm 1. rep epeat 2. for each vertex ๐ค of the current graph do do 3. select an edge incident to ๐ค 4. contract all selected edges 5. un until the current graph has no edges Letโs begin with a simple (non-sketch) algorithm
SLIDE 79
Streaming Graph Algorithms
Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) 1 2 3 4 6 7 5
SLIDE 80
Streaming Graph Algorithms
Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) 1 2 3 4 6 7 5 12 34
567
SLIDE 81
Streaming Graph Algorithms
Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) 1 2 3 4 6 7 5 12 34
567
super-vertices
SLIDE 82 Streaming Graph Algorithms
Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) 1 2 3 4 6 7 5 12 34
567
12 34
567
SLIDE 83 Streaming Graph Algorithms
Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) 1 2 3 4 6 7 5 12 34
567
12 34
567
new super-vertices
SLIDE 84
Streaming Graph Algorithms
Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) Connectivity Algorithm 1. rep epeat 2. for each vertex ๐ค of the current graph do do 3. select an edge incident to ๐ค 4. contract all selected edges 5. un until the current graph has no edges Letโs begin with a simple (non-sketch) algorithm Finds the connected components of ๐ป, and a spanning forest, in O(log ๐) rounds
SLIDE 85 Streaming Graph Algorithms
Connectivity via Sketches To design an algorithm that uses sketches we have to:
- 1. Define an appropriate graph representation
- 2. Apply โ0-sampling via linear sketches
SLIDE 86 Streaming Graph Algorithms
Connectivity via Sketches To design an algorithm that uses sketches we have to:
- 1. Define an appropriate graph representation
- 2. Apply โ๐-sampling via linear sketches
Let ๐ฟ = polylog(๐). There is a distribution over matrices ๐ โ โ๐ฟร๐ such that for any ๐ โ โ๐, a random non-zero element of ๐ can be reconstructed from ๐๐ with high probability. โ๐-sampling
SLIDE 87 Streaming Graph Algorithms
Connectivity via Sketches To design an algorithm that uses sketches we have to:
- 1. Define an appropriate graph representation
๐(๐,๐)
๐
= แ +1, โ1, 0,
if ๐ = ๐ < ๐ and (๐ค๐, ๐ค๐) โ ๐น if ๐ < ๐ = ๐ and (๐ค๐, ๐ค๐) โ ๐น
For each vertex ๐ค๐ we define a vector ๐๐ โ โ1,0,1
๐ 2
with entries
SLIDE 88 Streaming Graph Algorithms
Connectivity via Sketches To design an algorithm that uses sketches we have to:
- 1. Define an appropriate graph representation
1 2 3 4 ๐๐ = ๐ 1,2
๐
๐ 1,3
๐
๐(1,4)
๐
๐ 2,3
๐
๐ 2,4
๐
๐ 3,4
๐ ๐
Vector of vertex ๐ :
SLIDE 89 Streaming Graph Algorithms
Connectivity via Sketches To design an algorithm that uses sketches we have to:
- 1. Define an appropriate graph representation
1 2 3 4 ๐๐ = ๐ 1,2
๐
๐ 1,3
๐
๐(1,4)
๐
๐ 2,3
๐
๐ 2,4
๐
๐ 3,4
๐ ๐
Vector of vertex ๐ : ๐๐ = 1 1 0 ๐ ๐๐ = โ1 1 0 ๐ ๐๐ = 0 โ1 โ1 1 ๐ ๐๐ = 0 โ1 ๐
SLIDE 90 Streaming Graph Algorithms
Connectivity via Sketches To design an algorithm that uses sketches we have to:
- 1. Define an appropriate graph representation
1 2 3 4 ๐๐ = ๐ 1,2
๐
๐ 1,3
๐
๐(1,4)
๐
๐ 2,3
๐
๐ 2,4
๐
๐ 3,4
๐ ๐
Vector of vertex ๐ : ๐๐ = 1 1 0 ๐ ๐๐ = โ1 1 0 ๐ ๐๐ = 0 โ1 โ1 1 ๐ ๐๐ = 0 โ1 ๐ ๐๐ + ๐๐ = 1 1 0 ๐
SLIDE 91 Streaming Graph Algorithms
Connectivity via Sketches To design an algorithm that uses sketches we have to:
- 1. Define an appropriate graph representation
1 2 3 4 ๐๐ = ๐ 1,2
๐
๐ 1,3
๐
๐(1,4)
๐
๐ 2,3
๐
๐ 2,4
๐
๐ 3,4
๐ ๐
Vector of vertex ๐ : ๐๐ = 1 1 0 ๐ ๐๐ = โ1 1 0 ๐ ๐๐ = 0 โ1 โ1 1 ๐ ๐๐ = 0 โ1 ๐ ๐๐ + ๐๐ = ๐ ๐ 0 ๐
SLIDE 92 Streaming Graph Algorithms
Connectivity via Sketches To design an algorithm that uses sketches we have to:
- 1. Define an appropriate graph representation
๐(๐,๐)
๐
= แ +1, โ1, 0,
if ๐ = ๐ < ๐ and (๐ค๐, ๐ค๐) โ ๐น if ๐ < ๐ = ๐ and (๐ค๐, ๐ค๐) โ ๐น
For each vertex ๐ค๐ we define a vector ๐๐ โ โ1,0,1
๐ 2
with entries For any subset of vertices ๐ โ ๐, let ๐ ๐ = เท
๐ค๐โ๐
๐๐
SLIDE 93 Streaming Graph Algorithms
Connectivity via Sketches To design an algorithm that uses sketches we have to:
- 1. Define an appropriate graph representation
๐(๐,๐)
๐
= แ +1, โ1, 0,
if ๐ = ๐ < ๐ and (๐ค๐, ๐ค๐) โ ๐น if ๐ < ๐ = ๐ and (๐ค๐, ๐ค๐) โ ๐น
For each vertex ๐ค๐ we define a vector ๐๐ โ โ1,0,1
๐ 2
with entries For any subset of vertices ๐ โ ๐, let ๐ ๐ = เท
๐ค๐โ๐
๐๐
The non-zero entries of ๐(๐) correspond to ๐๐ป ๐ = the set of edges of ๐ป that cross the cut (๐, ๐\U)
SLIDE 94 Streaming Graph Algorithms
Connectivity via Sketches To design an algorithm that uses sketches we have to:
- 1. Define an appropriate graph representation
For any subset of vertices ๐ โ ๐, let ๐ ๐ = เท
๐ค๐โ๐
๐๐
The non-zero entries of ๐(๐) correspond to ๐๐ป ๐ = the set of edges of ๐ป that cross the cut (๐, ๐\U)
SLIDE 95 Streaming Graph Algorithms
Connectivity via Sketches To design an algorithm that uses sketches we have to:
- 1. Define an appropriate graph representation
For any subset of vertices ๐ โ ๐, let ๐ ๐ = เท
๐ค๐โ๐
๐๐
The non-zero entries of ๐(๐) correspond to ๐๐ป ๐ = the set of edges of ๐ป that cross the cut (๐, ๐\U) Thus ฯ๐ค๐โ๐ ๐๐๐ = ๐ ฯ๐ค๐โ๐ ๐๐ gives a random edge in ๐๐ป ๐
SLIDE 96 Streaming Graph Algorithms
Connectivity via Sketches Connectivity via Sketches Algorithm I: Compute the Sketches in a Single Pass 1. Choose ๐ข = O(log ๐) 2. for
- r ๐ = 1,2, โฆ , ๐ and ๐ = 1,2, โฆ , ๐ข do
do 3. Construct the random projection ๐
๐๐๐
4. for
- r ๐ = 1,2, โฆ , ๐ do
do 5. Compute ๐ต๐ ๐๐๐ = (๐1๐๐) โ (๐2๐๐) โ โฏ โ (๐๐ข๐๐)
SLIDE 97 Streaming Graph Algorithms
Connectivity via Sketches Connectivity via Sketches Algorithm I: Compute the Sketches in a Single Pass 1. Choose ๐ข = O(log ๐) 2. for
- r ๐ = 1,2, โฆ , ๐ and ๐ = 1,2, โฆ , ๐ข do
do 3. Construct the random projection ๐
๐๐๐
4. for
- r ๐ = 1,2, โฆ , ๐ do
do 5. Compute ๐ต๐ ๐๐๐ = (๐1๐๐) โ (๐2๐๐) โ โฏ โ (๐๐ข๐๐)
- Each sketch ๐ต๐ has dimension O(polylog๐)
- Since there are n sketches, the required space is O(๐ polylog๐)
SLIDE 98 Streaming Graph Algorithms
Connectivity via Sketches Connectivity via Sketches Algorithm II: Emulate Connectivity Algorithm 1. Let เท ๐ = ๐ be the initial set of super-vertices 2. for
- r ๐ = 1,2, โฆ , ๐ข do
do 3. for
- r each super-vertex ๐ โ เท
๐ do do 4. use ฯ๐ค๐โ๐ ๐๐๐ to sample an edge between ๐ and another super-vertex ๐ 5. collapse ๐ and ๐ to form a new super-vertex
SLIDE 99 Streaming Graph Algorithms
Connectivity via Sketches Connectivity via Sketches Algorithm II: Emulate Connectivity Algorithm 1. Let เท ๐ = ๐ be the initial set of super-vertices 2. for
- r ๐ = 1,2, โฆ , ๐ข do
do 3. for
- r each super-vertex ๐ โ เท
๐ do do 4. use ฯ๐ค๐โ๐ ๐๐๐ to sample an edge between ๐ and another super-vertex ๐ 5. collapse ๐ and ๐ to form a new super-vertex The update time (to process the next edge in ๐) is O(polylog๐)
SLIDE 100 Streaming Graph Algorithms
Concluding remarks
- Many graph algorithms in the data stream model are known for
basic problems. E.g., estimating connectivity, approximating distances, finding approximate matchings, counting subgraphs,โฆ
- But limited work on directed graphs!
- Space constraints: semi-stream model not suited for sparse
graphs (๐ = O(๐ polylog๐))
SLIDE 101
Streaming Architectures
Picture from https://databricks.com/blog/2015/07/30/diving-into-spark-streamings-execution-model.html
SLIDE 102
Streaming Architectures
Google Cloud Platform
https://cloud.google.com/solutions/architecture/streamprocessing