Streaming Graph Algorithms Graph Laplacian Weighted graph ๐ป = (๐, ๐น, ๐ฅ) . Edge weights ๐ฅ โถ ๐น โ ๐ Laplacian of ๐ป : ๐ ร ๐ real matrix ๐ ๐ป , ๐ = |๐| เท ๐ฅ ๐, ๐ , ๐ = ๐ ๐,๐ โ๐น where ๐ฅ(๐, ๐) = 0 if (๐, ๐) โ ๐น ๐ ๐ป ๐, ๐ = โ๐ฅ ๐, ๐ , ๐ โ ๐ 1 2 3 14 โ3 โ9 โ2 โ3 4 โ1 0 8 3 ๐ ๐ป = 9 โ9 โ1 18 โ8 โ2 0 โ8 10 1 4 2
Streaming Graph Algorithms Graph Laplacian Weighted graph ๐ป = (๐, ๐น, ๐ฅ) . Edge weights ๐ฅ โถ ๐น โ ๐ Laplacian of ๐ป : ๐ ร ๐ real matrix ๐ ๐ป , ๐ = |๐| เท ๐ฅ ๐, ๐ , ๐ = ๐ ๐,๐ โ๐น where ๐ฅ(๐, ๐) = 0 if (๐, ๐) โ ๐น ๐ ๐ป ๐, ๐ = โ๐ฅ ๐, ๐ , ๐ โ ๐ ๐ฆ 1 be a real vector in โ ๐ . Recall that ๐ฆ ๐ = ๐ฆ 1 Let ๐ฆ = โฏ ๐ฆ ๐ โฎ ๐ฆ ๐
Streaming Graph Algorithms Graph Laplacian Weighted graph ๐ป = (๐, ๐น, ๐ฅ) . Edge weights ๐ฅ โถ ๐น โ ๐ Laplacian of ๐ป : ๐ ร ๐ real matrix ๐ ๐ป , ๐ = |๐| เท ๐ฅ ๐, ๐ , ๐ = ๐ ๐,๐ โ๐น where ๐ฅ(๐, ๐) = 0 if (๐, ๐) โ ๐น ๐ ๐ป ๐, ๐ = โ๐ฅ ๐, ๐ , ๐ โ ๐ ๐ฆ 1 be a real vector in โ ๐ . Recall that ๐ฆ ๐ = ๐ฆ 1 Let ๐ฆ = โฏ ๐ฆ ๐ โฎ ๐ฆ ๐ Then 2 ๐ฆ ๐ ๐ ๐ป ๐ฆ = เท ๐ฅ(๐, ๐) ๐ฆ ๐ โ ๐ฆ ๐ (๐,๐)โ๐น
Streaming Graph Algorithms Spectral Sparsification Graph ๐ป = (๐, ๐น) A weighted subgraph ๐ผ = (๐, ๐น ๐ผ , ๐ฅ) of ๐ป is a (1 + ๐) spectral sparsifier of ๐ป if 1 โ ๐ โ ๐ฆ ๐ ๐ ๐ป ๐ฆ โค ๐ฆ ๐ ๐ ๐ผ ๐ฆ โค (1 + ๐) โ ๐ฆ ๐ ๐ ๐ป ๐ฆ for all real vectors ๐ฆ โ โ ๐
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
Streaming Graph Algorithms Spectral Sparsification Graph ๐ป = (๐, ๐น) A weighted subgraph ๐ผ = (๐, ๐น ๐ผ , ๐ฅ) of ๐ป is a (1 + ๐) spectral sparsifier of ๐ป if 1 โ ๐ โ ๐ฆ ๐ ๐ ๐ป ๐ฆ โค ๐ฆ ๐ ๐ ๐ผ ๐ฆ โค (1 + ๐) โ ๐ฆ ๐ ๐ ๐ป ๐ฆ for all real vectors ๐ฆ โ โ ๐ A (1 + ๐) spectral sparsifier with O(๐ log ๐ /๐ 2 ) Theorem [Spielman and Teng] edges can be constructed in O(๐ polylog(๐)/๐ 2 ) , where ๐ is the number of vertices and ๐ is the number of edges of the input graph.
Streaming Graph Algorithms Spectral Sparsification Graph ๐ป = (๐, ๐น) A weighted subgraph ๐ผ = (๐, ๐น ๐ผ , ๐ฅ) of ๐ป is a (1 + ๐) spectral sparsifier of ๐ป if 1 โ ๐ โ ๐ฆ ๐ ๐ ๐ป ๐ฆ โค ๐ฆ ๐ ๐ ๐ผ ๐ฆ โค (1 + ๐) โ ๐ฆ ๐ ๐ ๐ป ๐ฆ for all real vectors ๐ฆ โ โ ๐ A (1 + ๐) spectral sparsifier with O(๐ log ๐ /๐ 2 ) Theorem [Spielman and Teng] 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.
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.
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 .
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 ๐ป ๐ โฆ ๐ ๐ก๐๐จ๐(๐ฟ) ๐ก๐๐จ๐(๐ฟ) ๐ก๐๐จ๐(๐ฟ) 0 0 0 ๐ป ๐ข ๐ป 1 ๐ป 2
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 ๐ป ๐ ๐ = ๐ป 2๐โ1 ๐โ1 โช ๐ป 2๐ ๐โ1 For ๐ = 1,2, โฆ , lg ๐ข and ๐ = 1,2, โฆ , ๐ข/2 ๐ define ๐ป ๐ E.g., for ๐ข = 4 0 0 0 0 ๐ป 1 ๐ป 3 ๐ป 2 ๐ป 4 1 = ๐ป 1 0 โช ๐ป 2 1 = ๐ป 3 0 โช ๐ป 4 0 0 ๐ป 1 ๐ป 2 2 = ๐ป 1 1 โช ๐ป 2 1 = ๐ป ๐ป 1
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 ๐ป ๐ ๐ = ๐ป 2๐โ1 ๐โ1 โช ๐ป 2๐ ๐โ1 For ๐ = 1,2, โฆ , lg ๐ข and ๐ = 1,2, โฆ , ๐ข/2 ๐ define ๐ป ๐ ๐ define a weighted subgraph ๐ผ ๐ ๐ : For each ๐ป ๐ 0 = ๐ป ๐ 0 โข ๐ผ ๐ ๐ = ALG(๐ผ 2๐โ1 ๐โ1 โช ๐ผ 2๐ ๐โ1 ), ๐ > 0 โข ๐ผ ๐
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 ๐ป ๐ ๐ = ๐ป 2๐โ1 ๐โ1 โช ๐ป 2๐ ๐โ1 For ๐ = 1,2, โฆ , lg ๐ข and ๐ = 1,2, โฆ , ๐ข/2 ๐ define ๐ป ๐ ๐ define a weighted subgraph ๐ผ ๐ ๐ : For each ๐ป ๐ 0 = ๐ป ๐ 0 โข ๐ผ ๐ ๐ = ALG(๐ผ 2๐โ1 ๐โ1 โช ๐ผ 2๐ ๐โ1 ), ๐ > 0 โข ๐ผ ๐ lg ๐ข is a (1 + ๐ฟ) lg ๐ข sparsifier of ๐ป By the mergeable and composable properties ๐ผ 1
Streaming Graph Algorithms Spectral Sparsification โ Construction in the semi-streaming model lg ๐ข is a (1 + ๐ฟ) lg ๐ข sparsifier of ๐ป By the mergeable and composable properties ๐ผ 1 Set ๐ฟ = ๐/(2 lg ๐ข) โ (1 + ๐ฟ) lg ๐ข ~ (1 + ๐) lg ๐ข is a (1 + ๐) sparsifier of ๐ป Then ๐ผ 1
Streaming Graph Algorithms Spectral Sparsification โ Construction in the semi-streaming model lg ๐ข is a (1 + ๐ฟ) lg ๐ข sparsifier of ๐ป By the mergeable and composable properties ๐ผ 1 Set ๐ฟ = ๐/(2 lg ๐ข) โ (1 + ๐ฟ) lg ๐ข ~ (1 + ๐) lg ๐ข is a (1 + ๐) sparsifier of ๐ป Then ๐ผ 1 ๐โ1 and ๐ผ 2๐ ๐โ1 ๐โ1 ๐โ1 ๐ผ 2๐โ1 ๐ผ 2๐ Delete ๐ผ 2๐โ1 Space required ๐ is computed as soon as ๐ผ ๐ โ ๐ ๐ = ALG ๐ผ 2๐โ1 ๐โ1 โช ๐ผ 2๐ For each ๐ we need to store ๐ผ ๐ ๐โ1 ๐ผ ๐ only for two values of ๐
Streaming Graph Algorithms Spectral Sparsification โ Construction in the semi-streaming model lg ๐ข is a (1 + ๐ฟ) lg ๐ข sparsifier of ๐ป By the mergeable and composable properties ๐ผ 1 Set ๐ฟ = ๐/(2 lg ๐ข) โ (1 + ๐ฟ) lg ๐ข ~ (1 + ๐) lg ๐ข is a (1 + ๐) sparsifier of ๐ป Then ๐ผ 1 ๐โ1 and ๐ผ 2๐ ๐โ1 ๐โ1 ๐โ1 ๐ผ 2๐โ1 ๐ผ 2๐ Delete ๐ผ 2๐โ1 Space required ๐ is computed as soon as ๐ผ ๐ โ ๐ ๐ = ALG ๐ผ 2๐โ1 ๐โ1 โช ๐ผ 2๐ For each ๐ we need to store ๐ผ ๐ ๐โ1 ๐ผ ๐ only for two values of ๐ So at any given time we need to store โค 2 โ ๐ก๐๐จ๐ ๐ฟ โ lg ๐ข = O(๐ lg 3 ๐/๐ 2 )
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 ๐ โ
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 ๐ โ
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 ๐ โ Greedy Matching Algorithm 1. ๐ โ โ 2. for or each edge ๐ โ ๐ do do 3. if if ๐ โช {๐} is a matching the then add ๐ to ๐ 4. ret eturn ๐
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
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 ๐ โ
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 ๐
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.
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 ๐ท . โ ๐
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. โ ๐ ๐ฅ(๐ท) = total weight of the edges in ๐ท . ๐ If ๐ฅ(๐) > ๐ฅ(๐ท) then we increase the weight of ๐ by including ๐ and deleting the edges of ๐ท . โ ๐ Greedy Weighted Matching Algorithm 1. ๐ โ โ 2. for or 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 ๐
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 3 4 5 6 1 + 3๐ 1 + 4๐ 1 + ๐ 1 + 2๐ 1 + 5๐ ๐ = {}
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 3 4 5 6 1 + 3๐ 1 + 4๐ 1 + ๐ 1 + 2๐ 1 + 5๐ ๐ = {(1,2)}
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 3 4 5 6 1 + 3๐ 1 + 4๐ 1 + ๐ 1 + 2๐ 1 + 5๐ ๐ = {(1,2)}
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 3 4 5 6 1 + 3๐ 1 + 4๐ 1 + ๐ 1 + 2๐ 1 + 5๐ ๐ = {(2,3)}
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 3 4 5 6 1 + 3๐ 1 + 4๐ 1 + ๐ 1 + 2๐ 1 + 5๐ ๐ = {(2,3)}
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 3 4 5 6 1 + 3๐ 1 + 4๐ 1 + ๐ 1 + 2๐ 1 + 5๐ ๐ = {(3,4)}
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 3 4 5 6 1 + 3๐ 1 + 4๐ 1 + ๐ 1 + 2๐ 1 + 5๐ ๐ = {(3,4)}
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 3 4 5 6 1 + 3๐ 1 + 4๐ 1 + ๐ 1 + 2๐ 1 + 5๐ ๐ = {(3,4)}
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 3 4 5 6 1 + 3๐ 1 + 4๐ 1 + ๐ 1 + 2๐ 1 + 5๐ ๐ = {(4,5)}
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 3 4 5 6 1 + 3๐ 1 + 4๐ 1 + ๐ 1 + 2๐ 1 + 5๐ ๐ = {(4,5)}
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 3 4 5 6 1 + 3๐ 1 + 4๐ 1 + ๐ 1 + 2๐ 1 + 5๐ ๐ = {(5,6)} ๐ฅ(๐) = 1 + 5๐
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 3 4 5 6 1 + 3๐ 1 + 4๐ ๐ฅ(๐) = 1 + 5๐ 1 + ๐ 1 + 2๐ 1 + 5๐ ๐ โ = { 1,2 , 3,4 , (5,6)} 1 2 3 4 5 6 ๐ฅ(๐ โ ) = 3 + 9๐ 1 + 3๐ 1 + 4๐ 1 + ๐ 1 + 2๐ 1 + 5๐
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 ๐ฅ(๐ โ ) 1 + ๐ โ 1 ๐ ~ ๐ (๐ โ 1)/2 ๐ฅ(๐) > Hence, the approximation ratio is 2
Streaming Graph Algorithms Weighted Matchings trailing edges ๐ = {(5,6)} 1 2 3 4 5 6 1 + 3๐ 1 + 4๐ ๐ฅ(๐) = 1 + 5๐ 1 + ๐ 1 + 2๐ 1 + 5๐ 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.
Streaming Graph Algorithms Weighted Matchings โ ๐ Modified algorithm ๐ We include ๐ in ๐ If ๐ฅ ๐ > ๐พ๐ฅ(๐ท) for some constant ๐พ = 1 + ๐ฟ > 1 . โ ๐ Greedy Weighted Matching Algorithm 1. ๐ โ โ 2. for or 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 ๐
Streaming Graph Algorithms Weighted Matchings trailing edges ๐ = {(5,6)} 1 2 3 4 5 6 1 + 3๐ 1 + 4๐ ๐ฅ(๐) = 1 + 5๐ 1 + ๐ 1 + 2๐ 1 + 5๐ 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. 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 ๐ฅ(๐ ๐ ) โค ๐ฅ(๐)/๐ฟ
Streaming Graph Algorithms Weighted Matchings It can be shown that ๐ฅ(๐ โ ) โค (1 + ๐ฟ) โ เท (๐ฅ ๐ ๐ + 2๐ฅ(๐)) ๐โ๐ ๐ฅ(๐ โ ) ๐ฅ(๐) < 5.828 By applying a careful charging scheme we get
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(๐)
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 ,โฆ
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.
Streaming Graph Algorithms Graph Sketches Picture from https://people.cs.umass.edu/~mcgregor/711S12/lec-2-2.pdf
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.
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). ๐ ๐ 13 1 ๐ 12 1 3 ๐ ๐ = = 0 ๐ 13 ๐ 12 ๐ 23 2 1 ๐ ๐ 23
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 ๐ . ๐ ๐ 12 ๐ 13 0 1 3 ๐ ๐ ๐๐ = ๐ ๐ 13 = 0 ๐ 12 ๐ 23 ๐ ๐ 23 2 1
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 ๐ . Sketch of ๐ : ๐ต(๐) โ โ ๐ , ๐ = dimensionality of the sketch When we read the next item ๐, ฮ from the stream, we can update the sketch as follows: ๐ต ๐ = ๐ต ๐ + ฮ โ ๐ต(๐ ๐ )
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 ๐ป ) ๐ ๐ 13 1 ๐ 12 1 3 ๐ ๐ = = 0 ๐ 13 ๐ 12 ๐ 23 2 1 ๐ ๐ 23 ๐ = 1 ๐ 12 ๐ ๐ = ๐ 0 ๐ 13
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 ๐ป ) The sketches of ๐ are formed by concatenation ( โ ) of the sketches of each ๐ ๐ ๐ต ๐ = ๐ต 1 ๐ ๐ ๐ โ ๐ต 2 ๐ ๐ ๐ โ โฏ โ ๐ต ๐ ๐ ๐ ๐ Homomorphic sketches: For each operation on ๐ป there is a corresponding operation on the sketches
Streaming Graph Algorithms Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) 4 5 1 3 7 2 6
Streaming Graph Algorithms Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) Letโs begin with a simple (non -sketch) algorithm 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
Streaming Graph Algorithms Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) 4 5 1 3 7 2 6
Streaming Graph Algorithms Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) 4 5 1 3 7 2 6 34 12 567
Streaming Graph Algorithms Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) 4 5 1 3 7 2 6 super-vertices 34 12 567
Streaming Graph Algorithms Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) 4 5 1 3 7 2 6 34 12 567 34 12 567
Streaming Graph Algorithms Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) 4 5 1 3 7 2 6 new super-vertices 34 12 567 34 12 567
Streaming Graph Algorithms Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐, ๐น) Letโs begin with a simple (non -sketch) algorithm 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 Finds the connected components of ๐ป , and a spanning forest, in O(log ๐) rounds
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
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 โ ๐ -sampling 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.
Streaming Graph Algorithms Connectivity via Sketches To design an algorithm that uses sketches we have to: 1. Define an appropriate graph representation ๐ For each vertex ๐ค ๐ we define a vector ๐ ๐ โ โ1,0,1 2 with entries +1, if ๐ = ๐ < ๐ and (๐ค ๐ , ๐ค ๐ ) โ ๐น ๐ ๐ (๐,๐) = แ โ1, if ๐ < ๐ = ๐ and (๐ค ๐ , ๐ค ๐ ) โ ๐น 0, otherwise
Streaming Graph Algorithms Connectivity via Sketches To design an algorithm that uses sketches we have to: 1. Define an appropriate graph representation 1 3 4 2 ๐ ๐ ๐ = ๐ 1,2 ๐ ๐ ๐ ๐ ๐ ๐ ๐ 1,3 ๐ (1,4) ๐ 2,3 ๐ 2,4 ๐ 3,4 Vector of vertex ๐ :
Streaming Graph Algorithms Connectivity via Sketches To design an algorithm that uses sketches we have to: 1. Define an appropriate graph representation 1 3 4 2 ๐ ๐ ๐ = ๐ 1,2 ๐ ๐ ๐ ๐ ๐ ๐ ๐ 1,3 ๐ (1,4) ๐ 2,3 ๐ 2,4 ๐ 3,4 Vector of vertex ๐ : ๐ ๐ = 1 ๐ ๐ = 0 0 ๐ 1 ๐ 1 0 0 0 โ1 0 โ1 0 ๐ ๐ = โ1 ๐ ๐ = 0 0 ๐ โ1 ๐ 0 0 1 0 0 0 0 0
Streaming Graph Algorithms Connectivity via Sketches To design an algorithm that uses sketches we have to: 1. Define an appropriate graph representation ๐ ๐ + ๐ ๐ = 1 3 4 0 ๐ 0 1 0 1 0 2 ๐ ๐ ๐ = ๐ 1,2 ๐ ๐ ๐ ๐ ๐ ๐ ๐ 1,3 ๐ (1,4) ๐ 2,3 ๐ 2,4 ๐ 3,4 Vector of vertex ๐ : ๐ ๐ = 1 ๐ ๐ = 0 0 ๐ 1 ๐ 1 0 0 0 โ1 0 โ1 0 ๐ ๐ = โ1 ๐ ๐ = 0 0 ๐ โ1 ๐ 0 0 1 0 0 0 0 0
Streaming Graph Algorithms Connectivity via Sketches To design an algorithm that uses sketches we have to: 1. Define an appropriate graph representation ๐ ๐ + ๐ ๐ = 1 3 4 0 ๐ 0 ๐ 0 ๐ 0 2 ๐ ๐ ๐ = ๐ 1,2 ๐ ๐ ๐ ๐ ๐ ๐ ๐ 1,3 ๐ (1,4) ๐ 2,3 ๐ 2,4 ๐ 3,4 Vector of vertex ๐ : ๐ ๐ = 1 ๐ ๐ = 0 0 ๐ 1 ๐ 1 0 0 0 โ1 0 โ1 0 ๐ ๐ = โ1 ๐ ๐ = 0 0 ๐ โ1 ๐ 0 0 1 0 0 0 0 0
Streaming Graph Algorithms Connectivity via Sketches To design an algorithm that uses sketches we have to: 1. Define an appropriate graph representation ๐ For each vertex ๐ค ๐ we define a vector ๐ ๐ โ โ1,0,1 2 with entries +1, if ๐ = ๐ < ๐ and (๐ค ๐ , ๐ค ๐ ) โ ๐น ๐ ๐ (๐,๐) = แ โ1, if ๐ < ๐ = ๐ and (๐ค ๐ , ๐ค ๐ ) โ ๐น 0, otherwise ๐ ๐ For any subset of vertices ๐ โ ๐ , let ๐ ๐ = เท ๐ค ๐ โ๐
Streaming Graph Algorithms Connectivity via Sketches To design an algorithm that uses sketches we have to: 1. Define an appropriate graph representation ๐ For each vertex ๐ค ๐ we define a vector ๐ ๐ โ โ1,0,1 2 with entries +1, if ๐ = ๐ < ๐ and (๐ค ๐ , ๐ค ๐ ) โ ๐น ๐ ๐ (๐,๐) = แ โ1, if ๐ < ๐ = ๐ and (๐ค ๐ , ๐ค ๐ ) โ ๐น 0, otherwise ๐ ๐ For any subset of vertices ๐ โ ๐ , let ๐ ๐ = เท ๐ค ๐ โ๐ The non-zero entries of ๐(๐) correspond to ๐ ๐ป ๐ = the set of edges of ๐ป that cross the cut (๐, ๐\U)
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)
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 ๐ ๐ป ๐
Streaming Graph Algorithms Connectivity via Sketches Connectivity via Sketches Algorithm I: Compute the Sketches in a Single Pass 1. Choose ๐ข = O(log ๐) 2. for or ๐ = 1,2, โฆ , ๐ and ๐ = 1,2, โฆ , ๐ข do do ๐ ๐ ๐ 3. Construct the random projection ๐ 4. for or ๐ = 1,2, โฆ , ๐ do do Compute ๐ต ๐ ๐ ๐ ๐ = (๐ 1 ๐ ๐ ) โ (๐ 2 ๐ ๐ ) โ โฏ โ (๐ ๐ข ๐ ๐ ) 5.
Streaming Graph Algorithms Connectivity via Sketches Connectivity via Sketches Algorithm I: Compute the Sketches in a Single Pass 1. Choose ๐ข = O(log ๐) 2. for or ๐ = 1,2, โฆ , ๐ and ๐ = 1,2, โฆ , ๐ข do do ๐ ๐ ๐ 3. Construct the random projection ๐ 4. for or ๐ = 1,2, โฆ , ๐ do do Compute ๐ต ๐ ๐ ๐ ๐ = (๐ 1 ๐ ๐ ) โ (๐ 2 ๐ ๐ ) โ โฏ โ (๐ ๐ข ๐ ๐ ) 5. โข Each sketch ๐ต ๐ has dimension O(polylog๐) โข Since there are n sketches, the required space is O(๐ polylog๐)
Streaming Graph Algorithms Connectivity via Sketches Connectivity via Sketches Algorithm II: Emulate Connectivity Algorithm Let เท 1. ๐ = ๐ be the initial set of super-vertices 2. for or ๐ = 1,2, โฆ , ๐ข do do or each super-vertex ๐ โ เท 3. for ๐ do do use ฯ ๐ค ๐ โ๐ ๐๐ ๐ to sample an edge between ๐ and another super-vertex ๐ 4. 5. collapse ๐ and ๐ to form a new super-vertex
Streaming Graph Algorithms Connectivity via Sketches Connectivity via Sketches Algorithm II: Emulate Connectivity Algorithm Let เท 1. ๐ = ๐ be the initial set of super-vertices 2. for or ๐ = 1,2, โฆ , ๐ข do do or each super-vertex ๐ โ เท 3. for ๐ do do use ฯ ๐ค ๐ โ๐ ๐๐ ๐ to sample an edge between ๐ and another super-vertex ๐ 4. 5. collapse ๐ and ๐ to form a new super-vertex The update time (to process the next edge in ๐ ) is O(polylog๐)
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๐) )
Recommend
More recommend