streaming model of computation
play

Streaming Model of Computation A streaming algorithm processes a data - PowerPoint PPT Presentation

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


  1. 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

  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 ๐‘ฆ = โ‹ฏ ๐‘ฆ ๐‘œ โ‹ฎ ๐‘ฆ ๐‘œ

  3. 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 ๐‘ฆ ๐‘ˆ ๐‘€ ๐ป ๐‘ฆ = เท ๐‘ฅ(๐‘—, ๐‘˜) ๐‘ฆ ๐‘— โˆ’ ๐‘ฆ ๐‘˜ (๐‘—,๐‘˜)โˆˆ๐น

  4. Streaming Graph Algorithms Spectral Sparsification Graph ๐ป = (๐‘Š, ๐น) A weighted subgraph ๐ผ = (๐‘Š, ๐น ๐ผ , ๐‘ฅ) of ๐ป is a (1 + ๐œ) spectral sparsifier of ๐ป if 1 โˆ’ ๐œ โˆ™ ๐‘ฆ ๐‘ˆ ๐‘€ ๐ป ๐‘ฆ โ‰ค ๐‘ฆ ๐‘ˆ ๐‘€ ๐ผ ๐‘ฆ โ‰ค (1 + ๐œ) โˆ™ ๐‘ฆ ๐‘ˆ ๐‘€ ๐ป ๐‘ฆ for all real vectors ๐‘ฆ โˆˆ โ„ ๐‘œ

  5. 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

  6. 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.

  7. 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.

  8. 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.

  9. 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 .

  10. 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

  11. 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

  12. 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 โ€ข ๐ผ ๐‘—

  13. 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

  14. 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

  15. 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 ๐‘—

  16. 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 )

  17. 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 ๐‘ โˆ—

  18. 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 ๐‘ โˆ—

  19. 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 ๐‘

  20. 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

  21. 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 ๐‘ โˆ—

  22. 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 ๐‘

  23. 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.

  24. 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 ๐ท . โˆˆ ๐‘

  25. 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 ๐‘

  26. 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๐œ ๐‘ = {}

  27. 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)}

  28. 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)}

  29. 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)}

  30. 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)}

  31. 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)}

  32. 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)}

  33. 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)}

  34. 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)}

  35. 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)}

  36. 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๐œ

  37. 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๐œ

  38. 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

  39. 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.

  40. 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 ๐‘

  41. 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 ๐‘ฅ(๐‘ˆ ๐‘“ ) โ‰ค ๐‘ฅ(๐‘“)/๐›ฟ

  42. Streaming Graph Algorithms Weighted Matchings It can be shown that ๐‘ฅ(๐‘ โˆ— ) โ‰ค (1 + ๐›ฟ) โˆ™ เท (๐‘ฅ ๐‘ˆ ๐‘“ + 2๐‘ฅ(๐‘“)) ๐‘“โˆˆ๐‘ ๐‘ฅ(๐‘ โˆ— ) ๐‘ฅ(๐‘) < 5.828 By applying a careful charging scheme we get

  43. 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(๐œ)

  44. 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 ,โ€ฆ

  45. 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.

  46. Streaming Graph Algorithms Graph Sketches Picture from https://people.cs.umass.edu/~mcgregor/711S12/lec-2-2.pdf

  47. 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.

  48. 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

  49. 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

  50. 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: ๐ต ๐’ˆ = ๐ต ๐’ˆ + ฮ” โˆ™ ๐ต(๐’‹ ๐‘“ )

  51. 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

  52. 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

  53. Streaming Graph Algorithms Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐‘Š, ๐น) 4 5 1 3 7 2 6

  54. 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

  55. Streaming Graph Algorithms Connectivity via Sketches We wish to maintain a spanning forest of a graph ๐ป = (๐‘Š, ๐น) 4 5 1 3 7 2 6

  56. 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

  57. 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

  58. 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

  59. 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

  60. 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

  61. 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

  62. 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.

  63. 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

  64. 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 ๐‘— :

  65. 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

  66. 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

  67. 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

  68. 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 ๐’ƒ ๐‘‰ = เท ๐‘ค ๐‘— โˆˆ๐‘‰

  69. 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)

  70. 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)

  71. 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 ๐œ€ ๐ป ๐‘‰

  72. 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.

  73. 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๐‘œ)

  74. 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

  75. 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๐‘œ)

  76. 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