Approximate Labeled Subtree Homeomorphism Ron Pinter Oleg Rokhlenko
Approximate Labeled Subtree Homeomorphism Ron Pinter Oleg Rokhlenko Dekel Tsur Michal Ziv-Ukelson
Subtree Homeomorphism Pattern Text
Subtree Homeomorphism Pattern Text
Subtree Homeomorphism Pattern Text
Subtree Homeomorphism Pattern Text
Subtree Homeomorphism Pattern Text
Best Homeomorphism Pattern Text 1 deletion 2 deletions
Approximate Labelled Subtree Homeomorphism (ALSH) ∆[i, j] M T 1 i j T 2 LSH score = 5 -1 -1 +2 -2 -2 +2 LSH score = 12
Subtree Homeomorphism Complexity m - # of vertices in P n - # of vertices in T Rooted trees: nm 1. 5/logm [Shamir and Tsur, 99] Unrooted trees: nm 1. 5/logm [Shamir and Tsur, 99]
Our Results ALSH Rooted Unordered Trees Ordered Trees m - # of vertices in P n - # of vertices in T Unrooted
Applications • Analysis of metabolic pathways • Semantic queries against semistructured databases (represented as e. g. XML documents) • Natural language processing – trees representences – nodes are labeled by words and sentential forms
Agenda • ALSH for unordered trees: – rooted unordered: – unrooted unordered: • Improving time complexity by graph compression techniques: – rooted and unrooted unordered: • ALSH for ordered trees: – rooted ordered: – unrooted ordered:
Related Work • M. J. Chung. “O(N 2. 5) time algorithms for the subgraph homeomorphism problem on trees”. 1987. • R. Shamir and D. Tsur. “Faster subtree homeomorphism”. 1999. • G. Valiente. “Constrained tree inclusion”. 2003. • P. Kilplelainer and H. Mannila. “Ordered and unordered tree inclusion”. 1995. • M. A. Steel and T. Warnow. “Kaikoura tree theorems: Computing the maximum agreement subtree”. 1993 • M. Farach and M. Thorup. “Fast comparison of evolutionary trees”. 1995 • M. Y. Kao, T. W. Lam, W. K. Sung, and H. F. Ting. “Cavity matchings, label compressions, and unrooted evolutionary trees”. 2000
ALSH on Rooted Unordered Trees P T u v y 2 x. P 2 y 1 x 1 x 2 y 1 w 12 y 2 w 21 w 22 x 12 u w y 3 w 31 w 32 w 3 u … v … … u w 1 u T y 3 u … v x 2 y 1 y 2 y 3
ALSH on Rooted Unordered Trees P T u x 1 v y 2 x 2 y 1 w 12 w 1 u y 2 w 21 w 22 w 2 u y 3 w 31 w 32 w 3 u … v … … u y 3 …
ALSH on Rooted Unordered Trees P T u x 1 v y 2 x 2 y 1 w 12 w 1 u y 2 w 21 w 22 w 2 u y 3 w 31 w 32 w 3 u … v … … u Weighted Assignment on G y 3 y 1 … x 1 w 31 w 12 x 2 y 3
Time Complexity of ALSH Rooted Unordered Trees ui x 1 … P xki vj y 1 T … ylj • The algorithm computes an assignment for each pair , where and. • The assignment for ui and vj is computed using the bipartite graph , where. • [Fredman & Tarjan 87] show to compute Assignment. Score(G) in.
Time Complexity of ALSH Rooted Unordered Trees • Observation 1: and Summing up all (ui, vj) node pairs: Observation 1 Under the similarity assumption weighted assignment can be solved in O(V 0. 5 Elog(VC)) [Gabow and Tarjan, 89]. And ALSH can be solved in O(m 1. 5 nlog(n. C)).
Unrooted Unordered Trees (naïve approach) Pattern (P) u Text (T) v Weighted Assignment 2 x 4 …
Unrooted Unordered Trees (naïve approach) Pattern (P) u Text (T) v Weighted Assignment 2 x 4 …
Unrooted Unordered Trees (naïve approach) Pattern (P) Text (T) O(nm 3+nm 2 logn) !!! O(nm 2+nmlogn) u v Weighted Assignment 2 x 4 …
Unrooted Unordered Algorithm Pattern (P) Text (T) y 1 x 1 y 2 x 2 y 3 y 4 x 3 u v X Weighted Assignment 3 x 4 … Y
Unrooted Unordered Algorithm Pattern (P) Text (T) y 1 x 1 y 2 xq y 3 y 4 x 3 u v X Y
Unrooted Unordered Algorithm Pattern (P) Text (T) y 1 x 1 y 2 xq y 3 y 4 x 3 u v X One augmentation ! Y
Unrooted Unordered Algorithm Pattern (P) Text (T) y 1 x 1 y 2 x 2 y 3 y 4 x 3 u xq v X Y
Unrooted Unordered Algorithm Pattern (P) Text (T) y 1 x 1 y 2 x 2 y 3 y 4 x 3 u v X xq One augmentation ! Y
Unrooted Unordered Algorithm Pattern (P) Text (T) y 1 x 2 xq u y 2 y 3 y 4 x 3 v X Y
Unrooted Unordered Algorithm Pattern (P) Text (T) y 1 x 2 xq u y 2 y 3 y 4 x 3 v X One augmentation ! Y
Decremental Property of Weighted Assignment Lemma: Let: – – – be a bipartite graph for Computing the weighted assignments for the series of bipartite graphs can be done in time , for
Compressed Graph • Motivation: • Assuming a constant-sized label alphabet. • Using the notion of clique partition of a bipartite graph. [ Feder and Motwani 1991, Shamir and Tsur 1999 ]
Compressed Graph P y 1 T u x 1 x 2 y 1 v y 2 x 1 y 3 y 2 x 2 • Each node in bipartite graph represents the whole subtree. • Bounded alphabet the number of distinct trees is bounded. • Lemma: – The number of distinct labeled rooted trees in a forest of n vertices is: y 3
Compressed Graph G X 7 4 2 4 5 3 Y P X x 1 T u x 2 x 3 y 1 v y 2 y 3 y 4 Y
Compressed Graph G* X 7 4 2 4 5 3 0 0 0 C 7 2 4 4 5 Y P X x 1 T u x 2 x 3 y 1 v y 2 y 3 y 4 Y 3
Compressed Graph • Lemma: – The assignment between be computed in time: and can E + V log. V where – d(u) is the number of neighbors of node u. – D(u) is the number of distinct trees in the forest of trees rooted at neighbors of u. – c(v) is the number of children of node v.
Compressed Graph • Observation 2: The sum of vertex degrees in an unrooted tree P is: • Summing up the work over all pairs we get: Observation 1 Observation 2
Time Complexity • Lemma: (similar to Shamir and Tsur 1999) • Thus the algorithm computes the optimal ALSH solution for two rooted unordered trees in
ALSH on Rooted Ordered Trees y 1 x 1 y 2 x 2 y 3 P T u x 1 x 2 y 1 v y 2 y 3
ALSH on Rooted Ordered Trees y 1 x 1 y 2 x 2 y 3 P T u x 1 x 2 y 1 v y 2 y 3
ALSH on Rooted Ordered Trees y 1 The main property: NO CROSS-EDGES in the bipartite graph !!! x 1 y 2 x 2 y 3 P T u x 1 x 2 y 1 v y 2 y 3
ALSH on Rooted Ordered Trees y 1 The main property: NO CROSS-EDGES in the bipartite graph !!! x 1 y 2 x 2 y 3 P T u x 1 x 2 y 1 v y 2 y 3
ALSH on Rooted Ordered Trees 0 y 1 x 1 -∞ y 2 x 2 0 0 ∆ ki+1 x 1 -∞ y 3 x 2 y 1 y 2 lj+1 y 3
ALSH on Rooted Ordered Trees 0 y 1 x 1 -∞ y 2 x 2 0 ∆(x 1, y 1) ki+1 x 1 ∆(x 2, y 2) -∞ y 3 x 2 0 y 1 y 2 lj+1 Observation 1 y 3
ALSH on Unrooted Ordered Trees (Cyclic order) C A B E E C D D E A B C D
Cyclic String Comparison BCBADEDCD T: n P: ABCDE m Source B T A B C B A D E D C D P P A B C D E 1 2 D 3 4 5 1 2 3 4 5 E C Destination: Column n’s Maxima
A Cyclic String Comparison B E C D T T B C B A D E D C D P P A B C D E B C B A D E D C D 1 2 3 4 P 5 1 2 3 4 5 P A B C D E 1 2 3 4 5
A Cyclic String Comparison B E C D T T B C B A D E D C D P P A B C D E B C B A D E D C D 1 2 3 4 P 5 1 2 3 4 5 P A B C D E 1 2 3 4 5
A Cyclic String Comparison B E C D T T B C B A D E D C D P P A B C D E B C B A D E D C D 1 2 3 4 P 5 1 2 3 4 5 P A B C D E 1 2 3 4 5
A Cyclic String Comparison B E C D T T B C B A D E D C D P P A B C D E B C B A D E D C D 1 2 3 4 P 5 1 2 3 4 5 P A B C D E 1 2 3 4 5
A Cyclic String Comparison B E C D T T B C B A D E D C D P P A B C D E B C B A D E D C D 1 2 3 4 P 5 1 2 3 4 5 P A B C D E 1 2 3 4 5
A Cyclic String Comparison B E C D T T B C B A D E D C D P P A B C D E B C B A D E D C D 1 2 3 4 P 5 1 2 3 4 5 P A B C D E 1 2 3 4 5
Time Complexity A B E C D T Real numbers score metric: [Maez 1990] Rational numbers score metric: [Schmidt 1998] B C B A D E D C D P P A B C D E B C B A D E D C D 1 2 3 4 P 5 1 2 3 4 5 P A B C D E 1 2 3 4 5
Time Complexity A B Real numbers score metric: [Maez 1990] E C Rational numbers score metric: [Schmidt 1998] D Observation 1
ALSH on Unrooted Ordered Trees (Linear order) C A B E E C D A B D E A B C D
ALSH on Unrooted Ordered Trees (Linear order) y 1 A B C D E y 2 . . . Dy na m ic P rog ram FORWARD BACKWARD mi ng Ma trix yl
ALSH on Unrooted Ordered Trees (Linear order) y 1 y 2 . . . Forward A B C searching the best [i-1, j] + [i+1, j+1] D E Backward yl
ALSH on Unrooted Ordered Trees (Linear order) y 1 y 2 . yj yj+1 . . Forward A B C searching the best [i-1, j] + [i+1, j+1] D E Backward yl
Time Complexity • Weighted assignment for each pair (u, v) can be computed in: • And summing up the work for all pairs (u, v): Observation 1
Acknowledgments • • • Seffi Naor Amihood Amir Gabriel Valiente Ydo Wexler Carmel Kent
- Slides: 58