Presentation is loading. Please wait.

Presentation is loading. Please wait.

Subtree Isomorphism in O(n2.5)

Similar presentations


Presentation on theme: "Subtree Isomorphism in O(n2.5)"β€” Presentation transcript:

1 Subtree Isomorphism in O(n2.5)
δΈζ–‡ιŸ¬ 丁基伟

2 Graph Matching Problems
V1 V2 V3 V5 V4 V6 V7 H1 G H2 Graph isomorphism Bijection πœ™: 𝑉 𝐺 β†’ 𝑉 𝐻1 , 𝑒,𝑣 ∈ 𝐸 𝐺 iff. πœ™ 𝑒 ,πœ™ 𝑣 ∈ 𝐸 𝐻1 Subgraph isomorphism 𝐺 is isomorphic to a 𝐻 𝑠 , which is a induced subgraph of 𝐻2 Graph monomorphism 𝐻 𝑠 is subgraph of 𝐻2 Graph homomorphism Two vertices in 𝐺 can be mapped to one vertex in 𝐻1.(πœ™ 𝑉 1 𝐺 =πœ™ 𝑉 3 𝐺 =𝑉 3 𝐻1 )

3 Subtree Isomorphism Determining if tree 𝑆 is isomorphic to any subtree of tree 𝑇. Find a mapping function from 𝑉 𝑆 to 𝑉(𝑇) Enumerate each vertex costs exponential time. Find a sub structure to decompose the problem S T

4 Decompose the Problem Decompose to vertices? A 5 1 2 3 4 6 7 8 D C B E
D E 𝐴,𝐢 βˆˆπ‘† and 1,4 βˆ‰π‘‡

5 Decompose the Problem Limb
𝑙[𝑒,𝑣] denotes the maximal subtree containing (𝑒,𝑣) where 𝑣 is an end vertex of of it and is designated as the root of 𝑙 𝑒,𝑣 In a rooted tree 𝑇 𝑣 , 𝑙[𝑒,𝑣] is a limb of 𝑇[𝑣] if 𝑣 is farther than 𝑒 from root. 5 1 2 3 4 6 7 8 4 5 6 7 8 𝑙[4,5] in 𝑇

6 Limb 𝑙 𝑇 ≔ the set of limbs in 𝑇 Recursive Limited
𝑙 𝐷,𝐢 can be matched to 𝑇 unless 𝑙 𝐢,𝐴 , 𝑙 𝐢,𝐡 and 𝐷,𝐢 can be matched to 𝑇 Limited 𝑙 𝑇 =2 𝑛 𝑑 βˆ’1 𝑙 𝑇 𝑣 =( 𝑛 𝑑 βˆ’1) 𝑙(𝑇)= π‘£βˆˆπ‘‡ 𝑙(𝑇[𝑣]) (Each edge corresponding to 2 limbs) D C A B 5 1 2 3 4 6 7 8

7 Matching Between Limbs
Limb imbedding matrix R D C A B 5 1 2 3 4 6 7 8 E F 9 𝑙[5,4] 𝑙 5,6 𝑙 5,7 … (𝑅,𝐷) 1 𝑙[𝐷,𝐢] 𝑙[𝐷,𝐸] Lim imbedding submatrix of 𝑙 𝑅,𝐷 to 𝑙 9,5

8 Matching Between Limbs
Convert to bipartite matching problem Bipartite matching problem can be solved within 𝑂( 𝑉 |𝐸|) time. Hopcraft-Karp algorithm 𝑙[𝐷,𝐢] 𝑙[𝐷,𝐸] 𝑙[5,4] 𝑙[5,6] 𝑙[5,7] 𝑅,𝐷 𝑙[5,4] 𝑙 5,6 𝑙 5,7 … (𝑅,𝐷) 1 𝑙[𝐷,𝐢] 𝑙[𝐷,𝐸]

9 Algorithm Select π‘Ÿβˆˆπ‘™π‘’π‘Žπ‘£π‘’π‘  𝑆 as the root vertex, decompose 𝑆[π‘Ÿ] into limbs Set the limbs imbedding submatrix for leaves in 𝑆[π‘Ÿ] (All leaves can be matched to any limbs in 𝑇) For 𝑙 𝑒,𝑣 βˆˆπ‘† π‘Ÿ in a topological order(e.g. ordered by non-decreasing height) For each 𝑙 π‘₯,𝑦 βˆˆπ‘‡ Set the limbs imbedding submatrix by previous result. Build the corresponding bipartite graph Run H-K algorithm to determine whether 𝑙[π‘₯,𝑦] contains 𝑙[𝑒,𝑣] Check whether 𝑙[π‘Ÿ,𝑣] can be matched to 𝑇

10 Algorithm Complexity Each limb in 𝑆[𝑣] corresponding to 𝑂 𝑙 𝑇 mbedding submatrix. A bipartite maximum matching for each limb imbedding submatrix. π‘‡π‘–π‘šπ‘’=𝑂 𝑙 π‘₯,𝑦 βˆˆπ‘‡ 𝑙 𝑒,𝑣 βˆˆπ‘† π‘‡π‘–π‘šπ‘’ π»βˆ’πΎ Submatrix of 𝑙[𝑒,𝑣] has deg⁑(𝑒) rows and 𝑙 𝑇 columns, the corresponding bipartite graph has at most 𝑂 𝑙 𝑇 vertices and 𝑂 deg 𝑒 β‹… 𝑙 𝑇 edges. π‘‡π‘–π‘šπ‘’=𝑂 𝑙 𝑇 𝑙 𝑒,𝑣 βˆˆπ‘† deg 𝑒 β‹… 𝑙 𝑇 =𝑂 𝑙 𝑇 β‹… π‘’βˆˆπ‘† deg 𝑒 =𝑂( n t 𝑛 𝑠 )

11 Improve π‘’βˆˆπ‘‡ |𝑙 𝑇 𝑒 |≫|𝑙(𝑇)| Consider a rooted set 𝑇 𝑒,β‹…

12 Improve 𝑆[ π‘Ž 0 ,𝑏] can be matched to 𝑇[𝑒,𝑣] only if the corresponding edge can be contained in a maximum matching.

13 Improve Alternating path 图片ζ₯源:ws.nju.edu.cn/courses/gt/

14 Improve An edge can be used in a maximum matching if it is in an alternating path of even length on any maximum matching V1 V3 V2 V4 V6 V5 V7 εŽŸε§‹ε›Ύη‰‡ζ₯源:ws.nju.edu.cn/courses/gt/

15 Improved Algorithm Select π‘Ÿβˆˆπ‘™π‘’π‘Žπ‘£π‘’π‘  𝑆 as the root vertex, decompose 𝑆[π‘Ÿ] into limbs Set the limbs imbedding submatrix for leaves in 𝑆[π‘Ÿ] (All leaves can be matched to any limbs in 𝑇) For 𝑙 𝑒,𝑣 βˆˆπ‘† π‘Ÿ in a topological order(e.g. ordered by non-decreasing height) For each 𝑇 𝑒,β‹… Set the limbs imbedding submatrix by previous result. Build the corresponding bipartite graph Run H-K algorithm to find a maximum matching Search the graph to determine the set of vertices that the first row can reach by alternating path Check whether 𝑙[π‘Ÿ,𝑣] can be matched to 𝑇

16 Impreovd Algorithm Complexity
Each limb in 𝑆[𝑣] corresponding to a rooted imbedding submatrix. A bipartite maximum matching for each limb imbedding submatrix. π‘‡π‘–π‘šπ‘’=𝑂 𝑙 𝑒,𝑣 βˆˆπ‘† π‘‡π‘–π‘šπ‘’ π»βˆ’πΎ Submatrix of 𝑙[𝑒,𝑣] has deg⁑(𝑒) rows and no more than 𝑙 𝑇 columns, the corresponding bipartite graph has at most 𝑂 𝑙 𝑇 vertices and 𝑂 deg 𝑒 β‹… 𝑙 𝑇 edges. π‘‡π‘–π‘šπ‘’=𝑂 𝑙 𝑒,𝑣 βˆˆπ‘† 𝑇 𝑒,β‹… deg 𝑒 β‹…deg π‘₯ 3 2 =𝑂 π‘’βˆˆπ‘† deg 𝑒 β‹… π‘₯βˆˆπ‘‡ deg⁑(π‘₯) =𝑂( n t 𝑛 𝑠 )

17 Reference Matula D W. Subtree isomorphism in O (n 5/2)[J]. Annals of Discrete Mathematics, 1978, 2: Conte D, Foggia P, Sansone C, et al. Thirty years of graph matching in pattern recognition[J]. International journal of pattern recognition and artificial intelligence, 2004, 18(03):

18 Thanks Q&A

19 Tree Isomorphism For unrooted tree:
ζ₯源:

20 Isomorphism via Sub-isomorphism
Ordering via Structure Detection


Download ppt "Subtree Isomorphism in O(n2.5)"

Similar presentations


Ads by Google