Subtree Isomorphism in O(n2.5)

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

Introduction to Algorithms Graph Algorithms
© 2004 Goodrich, Tamassia Depth-First Search1 DB A C E.
Paths, Trees and Flowers
Chapter 9 Graphs.
Every edge is in a red ellipse (the bags). The bags are connected in a tree. The bags an original vertex is part of are connected.
Depth-First Search1 Part-H2 Depth-First Search DB A C E.
Introduction to Line Graphs Emphasizing their construction, clique decompositions, and regularity.
 Graph Graph  Types of Graphs Types of Graphs  Data Structures to Store Graphs Data Structures to Store Graphs  Graph Definitions Graph Definitions.
Mining Graphs.
Zheng Zhang, Exact Matchingslide 1 Exact (Graph) Matching Zheng Zhang e Presentation for VO Structural Pattern Recognition.
Sub Graph Listing محمد مهدی طالبی دانشگاه صنعتی امیرکبیر.
Data Transmission and Base Station Placement for Optimizing Network Lifetime. E. Arkin, V. Polishchuk, A. Efrat, S. Ramasubramanian,V. PolishchukA. EfratS.
Applied Discrete Mathematics Week 12: Trees
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
DAST 2005 Tirgul 11 (and more) sample questions. DAST 2005 Q.Let G = (V,E) be an undirected, connected graph with an edge weight function w : E→R. Let.
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 11, Wednesday, September 24.
D1: Matchings.
Perfect Phylogeny MLE for Phylogeny Lecture 14
Discrete Mathematics Lecture 9 Alexander Bukharovich New York University.
Perfect Gaussian Elimination and Chordality By Shashank Rao.
“On an Algorithm of Zemlyachenko for Subtree Isomorphism” Yefim Dinitz, Alon Itai, Michael Rodeh (1998) Presented by: Masha Igra, Merav Bukra.
1 ELEC692 Fall 2004 Lecture 1b ELEC692 Lecture 1a Introduction to graph theory and algorithm.
Lecture 10: Graphs Graph Terminology Special Types of Graphs
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Euler paths and tours.
Tree A connected graph that contains no simple circuits is called a tree. Because a tree cannot have a simple circuit, a tree cannot contain multiple.
Trees : Part 1 Section 4.1 (1) Theory and Terminology (2) Preorder, Postorder and Levelorder Traversals.
Graphs A graphs is an abstract representation of a set of objects, called vertices or nodes, where some pairs of the objects are connected by links, called.
Introduction to Graph Theory Lecture 17: Graph Searching Algorithms.
Lecture 17: Trees and Networks I Discrete Mathematical Structures: Theory and Applications.
CHAPTER 11 TREES INTRODUCTION TO TREES ► A tree is a connected undirected graph with no simple circuit. ► An undirected graph is a tree if and only.
Introduction to Graph Theory By: Arun Kumar (Asst. Professor) (Asst. Professor)
. Perfect Phylogeny MLE for Phylogeny Lecture 14 Based on: Setubal&Meidanis 6.2, Durbin et. Al. 8.1.
1 Trees : Part 1 Reading: Section 4.1 Theory and Terminology Preorder, Postorder and Levelorder Traversals.
Main Index Contents 11 Main Index Contents Graph Categories Graph Categories Example of Digraph Example of Digraph Connectedness of Digraph Connectedness.
An introduction to chordal graphs and clique trees
Applied Discrete Mathematics Week 14: Trees
Algorithms for Finding Distance-Edge-Colorings of Graphs
Lap Chi Lau we will only use slides 4 to 19
Graphs Representation, BFS, DFS
Fast Hamiltonicity Checking via Bases of Perfect Matchings
Topics in Algorithms Lap Chi Lau.
Discrete Mathematicsq
Source Code for Data Structures and Algorithm Analysis in C (Second Edition) – by Weiss
Graph theory Definitions Trees, cycles, directed graphs.
12. Graphs and Trees 2 Summary
Introduction to Trees Section 11.1.
Paths, Trees and Flowers
Graph Theory and Algorithm 01
PC trees and Circular One Arrangements
Algorithms and networks
The Taxi Scheduling Problem
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 10 Trees Slides are adopted from “Discrete.
Connected Components Minimum Spanning Tree
Lecture 16 Maximum Matching
Algorithms and networks
Lectures on Graph Algorithms: searching, testing and sorting
Comparative RNA Structural Analysis
Trees.
Depth-First Search D B A C E Depth-First Search Depth-First Search
Problem Solving 4.
Subgraphs, Connected Components, Spanning Trees
Discrete Math 2 Shortest Path Using Matrix
Discrete Mathematics Lecture 13_14: Graph Theory and Tree
An O(n log n)-Time Algorithm for the k-Center Problem in Trees
Lecture 10: Graphs Graph Terminology Special Types of Graphs
Planarity.
Chapter 16 1 – Graphs Graph Categories Strong Components
Important Problem Types and Fundamental Data Structures
瞿裕忠(Yuzhong Qu) 计算机科学与技术系
Presentation transcript:

Subtree Isomorphism in O(n2.5) 丁文韬 丁基伟

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 )

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

Decompose the Problem Decompose to vertices? A 5 1 2 3 4 6 7 8 D C B E D E 𝐴,𝐶 ∈𝑆 and 1,4 ∉𝑇

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 𝑇

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

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

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 𝑙[𝐷,𝐶] 𝑙[𝐷,𝐸]

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 𝑇

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 𝑢 ⋅ 𝑙 𝑇 3 2 =𝑂 𝑙 𝑇 5 2 ⋅ 𝑢∈𝑆 deg 𝑢 =𝑂( n t 5 2 𝑛 𝑠 )

Improve 𝑢∈𝑇 |𝑙 𝑇 𝑢 |≫|𝑙(𝑇)| Consider a rooted set 𝑇 𝑢,⋅

Improve 𝑆[ 𝑎 0 ,𝑏] can be matched to 𝑇[𝑢,𝑣] only if the corresponding edge can be contained in a maximum matching.

Improve Alternating path 图片来源:ws.nju.edu.cn/courses/gt/

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/

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 𝑇

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⁡(𝑥) 3 2 =𝑂( n t 3 2 𝑛 𝑠 )

Reference Matula D W. Subtree isomorphism in O (n 5/2)[J]. Annals of Discrete Mathematics, 1978, 2: 91-106. 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): 265-298. http://ws.nju.edu.cn/courses/gt/

Thanks Q&A

Tree Isomorphism For unrooted tree: 来源:http://perso.ens-lyon.fr/eric.thierry/Graphes2010/marthe-bonamy.pdf

Isomorphism via Sub-isomorphism Ordering via Structure Detection