Graph Reachability

Graph Reachability

Graph Reachability Panagiotis Parchas HKUST Where are the graphs? • Some famous graph data – Social Networks – Web sites/internet – XML Documents – Biological/chemical networks 2 Why graph analysis? • Knowledge discovery in social networks – Targeted advertising. – Pattern extraction for behavioral analysis. – Useful statistics and conclusions for a wide range of scientists • Mining in Web Data – Interesting navigation patterns – XML documents • Biological Data Analysis – Drug discovery – DNA Analysis • Geographic Information Systems • ………And much more…….. 3 Problem formulation Given a directed graph G and two nodes u and v, is there a path connecting u to v (denoted u↝v)? 15 3↝11? YES 14 3↝12? NO 11 13 10 12 6 7 8 9 3 4 5 1 2 Directed Graph DAG (directed acyclic graph) by 4 coalescing the strongly connected components Motivation • Classical problem in graph theory. • Studying the influence flow in social networks – Even undirected graphs (facebook) are converted to directed w.r.t a certain attribute distribution • Security: finding possible connections between suspects • Biological data: is that protein involved- directly or indirectly- in the expression of a gene? • Primitive for many graph related problems (pattern matching) 5 Methods Overview Query Index Method Construction time size DFS/BFS O(n+m) O(n+m) O(n+m) Naïve Transitive Closure O(1) O(nm)=O(n3) O(n2) Optimal Tree Cover O(n) O(nm)=O(n3 ) O(n2) (Agrawal et al., SIGMOD’89) Tree GRIPP O(m-n) O(n+m) O(n+m) Cover (Triβl et al., SIGMOD’07) Dual-Labeling O(1) O(n+m+t3) O(n+t2) (Wang et al., ICDE’06) Chain Optimal Chain Cover O(k) O(nm) O(nk) Cover (Jagadish, TODS’90) Path-Tree log2k’ O(mk’)/O(mn) O(nk’) (Jin, et al., SIGMOD’08) 2-HOP (SODA 2002) O(nm1/2) O(n3|T |)=O(n5 ) O(m1/2) HOP C 3-HOP Cover O(log n +k) O(kn2 ) O(nk) (Yang Xiang et al., SIGMOD ‘09) 6 Depth First Traversal • ? u↝v • Depth First Traversal (DFT) starting from u • if node v is discovered: – then stop search, report YES • If all nodes have been visited: – then report NO No index and thus no Query time: O(m+n) the construction overhead entire graph should be and no extra space traversed in the worst consumption case TOO GOOD TOO BAD 7 Transitive Closure (TC) 0 1 2 3 4 5 0 1 1 0 1 1 0 1 1 0 1 0 0 1 1 5 2 0 1 1 0 0 1 0 1 4 3 0 1 0 1 1 0 1 1 4 0 0 0 0 1 1 3 0 2 5 0 0 0 0 0 1 • It can be done by dynamic • BUT, queries can be programming algorithm Floyd– answered in constant 3 Warshall in Θ(푛 ) time O(1) • It takes O(푛2) space TOO BAD TOO GOOD 8 Optimal Tree Cover [idea] SIGMOD ‘89 a • Index: smallest postorder number of [1,8] descendants b d • DFT postorder [1,4] [6,7] number c Postorder: left- e right-root [5,5] [1,3] f g h [6,6] [1,1] [2,2] (example) ?(b↝h) ⟹ ? 1 ≤ 2 < 4 ⇒ 푌퐸푆 푙푎푏푒푙 푢 = 푢푠푡푎푟푡, 푢푒푛푑 ?(b↝c) ⟹ ? 1 ≤ 5 < 4 ⇒ 푁푂 Query Processing: ?(u↝v) ⟹ 9 ?(푢푠푡푎푟푡 ≤ 푣푒푛푑 < 푢푒푛푑) Optimal Tree Cover a • Inherited from b [1,8] b d [1,4] [6,7] c • [2,2] [1,4] e [1,4] [5,5] [2,2] [1,3] f g h [6,6] [1,1] [2,2] 10 Topological sorting: parent Optimal Tree Cover comes before the child • Index Construction: O(nm) time = O (푛3) 1. Connect all nodes with no predecessors to a dummy node-root. 2. Find a spanning tree for the DAG (+root) – requires a topological sorting first 3. Label nodes according to tree edges (postorder). 4. For each non-tree edge (u,v) – in reverse topological order of the nodes- : 푙푎푏푒푙 푣 = 푙푎푏푒푙 푣 ⋃푙푎푏푒푙 푢 5. If 푙푎푏푒푙 푎 ⊂ 푙푎푏푒푙(푏) for labels inherited from nodes 푎, 푏, then keep only 푙푎푏푒푙 푏 . 11 Optimal Tree Cover • Query processing: O(n) time 푙푎푏푒푙 푢 = 푢푠푡푎푟푡, 푢푒푛푑 , 푢푠푡푎푟푡1, 푢푒푛푑1 … (u↝v) iff ∃푖: (푢푠푡푎푟푡푖 ≤ 푣푒푛푑 < 푢푒푛푑푖) • Space: O(푛2) worst case n-x Bipartite Graph: every one of these (n-x) vertices will inherit all x labels, resulting in total (n-x)(x+1) labels, yielding O(푛2). x 12 Optimal Tree Cover • The authors propose an algorithm for finding the optimal spanning tree (in terms of total label size). • They also suggest a maintenance mechanism with non- consecutive numbering of nodes. • Although asymptotically equivalent to the straightforward method of transitive closure, in the experiments the method performs better in orders of magnitude. • The experiments are quite primitive (graphs with 1000 nodes) 13 GRIPP Index Creation SIGMOD ‘07 • Depth-first traversal of G • We reach a node v R [0 ,21] • for the first time • add tree instance [1, 20] A [16 ,17] of v to IND(G) • proceed traversal [2 ,7] [8, 9] [10 ,19] B C D • again [12 ,13] • add non-tree E F G H instance of v to [3, 4] [5, 6] [11, 14] [15 ,18] IND(G) • do not traverse child nodes of v 14 GRIPP Index Table, IND(G) [0 ,21] R node pre post inst R 0 21 tree [1, 20] A’A A 1 20 tree [16,17] B 2 7 tree E 3 4 tree [2 ,7] B’B [8, 9] C [10 ,19] D [12,13] F 5 6 tree C 8 9 tree G E F H D 10 19 tree [3, 4] [5, 6] [11, 14] [15 ,18] G 11 14 tree B‘ 12 13 Non-tree H 15 18 tree Graph, G A‘ 16 17 Non-tree GRIPP index, IND(G) • Is node C reachable from node D? 15 GRIPP Query answering ?(D↝C) If D pre < C pre < Dpost C reachable from D node pre post inst R 0 21 tree A 1 20 tree ‘ B 2 7 tree E 3 4 tree ‘ F 5 6 tree Reachable C 8 9 tree Instance Set D 10 19 tree of D G 11 14 tree B‘ 12 13 non RIS(D) H 15 18 tree Order tree, O(G) A‘ 16 17 non RIS(D) 16 GRIPP Query answering ?(D↝C) Step 1: Retrieve RIS (D). If 퐶 ∈ 푅퐼푆(퐷) then answer YES and finish. Step 2: Else foreach non_tree entry h’ ∈ 푅퐼푆(퐷) do: recursively issue the query ?(h↝C) ‘ h is the ‘ correspondent tree entry of h’ 17 Gripp [Facts] • Index Construction Time: Depth First Traversal, linear O(m+n) • Storage: O(n) nodes of the graph + O(m-n) non-tree nodes yields O(m+n) storage • Query Time: in the worst case we ask for O(m-n) recursive calls. The authors use some pruning techniques and heuristics and claim that their algorithm has almost constant query time for various types of graphs. The order of the traversal is crucial. The same for the order of the recursive hops. 18 Dual Labeling [assumptions] • Basic assumption: most practical graphs are sparse. – Examples of biological data and XML documents – Average degree ~1.2 (edges/node) • The authors will use this fact to build nearly optimal algorithms for tree-like sparse graphs • Thus, they assume that t<<n. number of non-tree edges 19 Dual Labeling [idea] ICDE ‘06 1. DFT to Compute a spanning tree and the Transitive Link Table (for the non-tree edges) 2. Compute the transitive link closure. [0 ,10) R [9 ,10) [1, 9) A K TRANSITIVE LINK TABLE 7->[2,5) [2 ,5) B [5, 6) C [6 ,9) D 9->[6,9) 9->[2,5) E F G H [3, 4) [4, 5) [7 ,8) [8 ,9) 20 Dual Labeling • Now we can answer queries by checking the tree labels + the transitive link table(TLT) – examples: ?A↝G YES: 7 ∈ [1,9) ?D↝ F YES: Although 4 ∉ [6,9) if we search TLT we find edge 7->[2,5) for which 7 ∈ [6,9) and 4 ∈ [2,5) ?D↝C NO: 5 ∉ [6,9) and there is no entry in TLT with the above property [0, 10) R [9 ,10) [1, 9) A K TRANSITIVE LINK TABLE 7->[2,5) [2 ,5) B [5, 6) C [6 ,9) D 9->[6,9) 9->[2,5) E F G H [3, 4) [4, 5) [7 ,8) [8 ,9) 21 Dual Labeling • The size of TLT is O(푡2) since it contains the transitive closure of t non-tree edges. • Given the above indexing scheme, query time might take 푂(푡2) for the linear search of TLT • The goal is to reduce query time to O(1). • We woudn’t mind to put them in a table (since t is small) in order to reduce the query time in O(1) but we cannot! – TLT consists of entries of the form: 푖 → [푥, 푦) – We would need 3D table • The authors propose one solution 22 Dual Labeling ? 푢 ↝ 푣 푎2 ∉ [푎1, 푏1) so unreachable from tree only edges 푢 = 푎1, 푏1 What is the property of an entry 푖 → [ 푗, 푘) in TLT? 푣 = [푎2, 푏2) 푖 ∈ [푎1, 푏1) ∧ [푗, 푘) ∋ 푎2 N(a1,a2)=1 N(b1,a2)=0 23 Dual Labeling [0, 10) R TRANSITIVE LINK TABLE <0,-,-> [9 ,10) [1, 9) 7->[2,5) <0,1,-> A K <1,-,-> 9->[6,9) 9->[2,5) [2 ,5) B [5, 6) C [6 ,9) D <0,0,0> <0,0,-> <0,1,1> y 9 E F G H (0,1) (1,1) [3, 4) [4, 5) [7 ,8) [8 ,9) <0,0,0> <0,0,0> <0,1,1> <1,1,1> 6 5 1 1 1 0 2 1 (0,0) (1,0) y x 0 1 2 TLT Matrix 7 9 x 24 TLT Grid Dual Labeling Now reachability can be defined in constant time by the values of the two labels.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    58 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us