DS.GR.14 Graph Matching Input: 2 digraphs G1 = (V1,E1), G2 = (V2,E2)

Slides:



Advertisements
Similar presentations
Graphs and Finding your way in the wilderness
Advertisements

DS.GR.14 Graph Matching Input: 2 digraphs G1 = (V1,E1), G2 = (V2,E2) Questions to ask: 1.Are G1 and G2 isomorphic? 2.Is G1 isomorphic to a subgraph of.
gSpan: Graph-based substructure pattern mining
Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
Graph Isomorphism Algorithms and networks. Graph Isomorphism 2 Today Graph isomorphism: definition Complexity: isomorphism completeness The refinement.
TECH Computer Science Graphs and Graph Traversals  // From Tree to Graph  // Many programs can be cast as problems on graph Definitions and Representations.
Hardness Results for Problems P: Class of “easy to solve” problems Absolute hardness results Relative hardness results –Reduction technique.
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
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.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
TTIT33 Alorithms and Optimization – DALG Lecture 4 Graphs HT TTIT33 Algorithms and optimization Algorithms Lecture 4 Graphs.
Example: HP ≤ p HC Hamiltonian Path –Input: Undirected Graph G = (V,E) –Y/N Question: Does G contain a Hamiltonian Path? Hamiltonian Cycle –Input: Undirected.
1.1. Graph Models Two basic notions: Graphs Directed Graphs.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
Tirgul 13 Today we’ll solve two questions from last year’s exams.
Chapter 9: Graphs Basic Concepts
TDDB56 DALGOPT-D TDDB57 DALG-C – Lecture 11 – Graphs Graphs HT TDDB56 – DALGOPT-D Algorithms and optimization Lecture 11 Graphs.
Daniel Kroening and Ofer Strichman 1 Decision Procedures in First Order Logic Decision Procedures for Equality Logic.
Graph Algorithms Using Depth First Search Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms.
1 CS104 : Discrete Structures Chapter V Graph Theory.
1 Steiner Tree Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Maximum Flow. p2. Maximum Flow A flow network G=(V, E) is a DIRECTED graph where each has a nonnegative capacity u.
Chapter 10 Graph Theory Eulerian Cycle and the property of graph theory 10.3 The important property of graph theory and its representation 10.4.
Data Structures CSCI 132, Spring 2014 Lecture 38 Graphs
EMIS 8373: Integer Programming Combinatorial Relaxations and Duals Updated 8 February 2005.
Graphs A ‘Graph’ is a diagram that shows how things are connected together. It makes no attempt to draw actual paths or routes and scale is generally inconsequential.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
Spanning tree Lecture 4.
Trees Thm 2.1. (Cayley 1889) There are nn-2 different labeled trees
Chapter 13 Backtracking Introduction The 3-coloring problem
Graphs and Paths : Chapter 15 Saurav Karmakar
1 GRAPHS – Definitions A graph G = (V, E) consists of –a set of vertices, V, and –a set of edges, E, where each edge is a pair (v,w) s.t. v,w  V Vertices.
CSC317 1 At the same time: Breadth-first search tree: If node v is discovered after u then edge uv is added to the tree. We say that u is a predecessor.
Discrete Structures Li Tak Sing( 李德成 ) Lectures
Gspan: Graph-based Substructure Pattern Mining
BCA-II Data Structure Using C Submitted By: Veenu Saini
Data Structures & Algorithm Analysis lec(8):Graph T. Souad alonazi
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
P & NP.
CSE 373, Copyright S. Tanimoto, 2002 Graphs 2 -
Decision trees Polynomial-Time
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness Proofs
Graph theory Definitions Trees, cycles, directed graphs.
Algorithms and networks
CSE373: Data Structures & Algorithms Lecture 23: Applications
Topological Sort (topological order)
Graph Algorithms Using Depth First Search
Lecture 11: Connectivity Paths in Undirected & Directed Graphs
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
Connected Components Minimum Spanning Tree
Algorithms and networks
2018, Fall Pusan National University Ki-Joune Li
What is a Graph? a b c d e V= {a,b,c,d,e} E= {(a,b),(a,c),(a,d),
Shortest Path Algorithms
Chapter 11 Graphs.
2017, Fall Pusan National University Ki-Joune Li
COMPS263F Unit 2 Discrete Structures Li Tak Sing( 李德成 ) Room A
Graphs and Algorithms (2MMD30)
Copyright © Cengage Learning. All rights reserved.
5/9/2019 Discrete Math II Howon Kim
Graph Algorithms DS.GR.1 Chapter 9 Overview Representation
Graphs.
Based on slides by Y. Peng University of Maryland
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Locality In Distributed Graph Algorithms
INTRODUCTION A graph G=(V,E) consists of a finite non empty set of vertices V , and a finite set of edges E which connect pairs of vertices .
Presentation transcript:

DS.GR.14 Graph Matching Input: 2 digraphs G1 = (V1,E1), G2 = (V2,E2) Questions to ask: Are G1 and G2 isomorphic? Is G1 isomorphic to a subgraph of G2? How similar is G1 to G2? How similar is G1 to the most similar subgraph of G2?

DS.GR.15 Isomorphism for Digraphs G1 is isomorphic to G2 if there is a 1-1, onto mapping h: V1  V2 such that ( vi,vj )  E1 iff ( h(vi), h(vj) )  E2 G1 G2 1 2 a b 3 c 4 5 e d Find an isomorphism h: {1,2,3,4,5}  {a,b,c,d,e}. Check that the condition holds for every edge.

DS.GR.16 Subgraph Isomorphism for Digraphs G1 is isomorphic to a subgraph of G2 if there is a 1-1 mapping h: V1  V2 such that ( vi,vj )  E1 ( h(vi), h(vj) )  E2 G1 G2 1 2 a b 3 c d Isomorphism and subgraph isomorphism are defined similarly for undirected graphs. In this case, when (vi,vj)  E1, either (vi,vj) or (vj,vi) can be listed in E2, since they are equivalent and both mean {vi,vj}.

DS.GR.17 Similar Digraphs Sometimes two graphs are close to isomorphic, but have a few “errors." Let h(1)=b, h(2)=e, h(3)=c, h(4)=a, h(5) = d. G1 G2 1 2 a b 3 c 4 5 e d (1,2) (b,e) (2,1) (e,b) X (c,b) (4,5) (a,d) (2,5) (e,d) (3,2) X (3,4) (c,a) The mapping h has 2 errors. (c,b)  G2, but (3,1)  G1 (3,2)  G1, but (c,e)  G2

Intuitively, the error of mapping h tells us DS.GR.18 Error of a Mapping Intuitively, the error of mapping h tells us how many edges of G1 have no corresponding edge in G2 and how many edges of G2 have no corresponding edge in G1. Let G1=(V1,E1) and G2=(V2,E2), and let h:V1 V2 be a 1-1, onto mapping. forward error backward total error relational distance EF(h) = |{(vi,vj)E1 | (h(vi),h(vj))E2}| edge in E1 corresponding edge not in E2 -1 -1 EB(h) = |{(vi,vj)E2 | (h (vi),h (vj))E1}| edge in E2 corresponding edge not in E1 Error(h) = EF(h) + EB(h) GD(G1,G2) = min Error(h) for all 1-1, onto h:V1 V2

DS.GR.19 Variations of Relational Distance normalized relational distance: Divide by the sum of the number of edges in E1 and those in E2. undirected graphs: Just modify the definitions of EF and EB to accommodate. one way mappings: h is 1-1, but need not be onto Only the forward error EF is used. labeled graphs: When nodes and edges can have labels, each node should be mapped to a node with the same label, and each edge should be mapped to an edge with the same label.

DS.GR.20 Graph Matching Algorithms graph isomorphism subgraph isomorphism relational distance attributed relational distance (uses labels) * Subgraph Isomorphism Given model graph M = (VM,EM) data graph D = (VD,ED) Find 1-1 mapping h:VM  VD satisfying (vi,vj)  EM  ((h(vi),h(vj))  ED.

Method: Backtracking Tree Search DS.GR.21 Method: Backtracking Tree Search M D 1 2 a b c 3 e d root 1,a 1,b 1,c 1,d 1,e . . . . . . . . . 2,b 2,c . . . 2,a 2,c X X 3,c 3,d 3,e 3,a 3,d X X X X YES!

DS.GR.22 Treesearch for Subgraph Isomorphism in Digraphs procedure Treesearch(VM, VD, EM, ED, h) { v = first(VM); for each w  VD h’ = h  {(v,w)}; OK = true; for each edge (vi,vj) in EM satisfying that either 1. vi = v and vj  domain(h’) or 2. vj = v and vi  domain(h’) if ( (h’(vi),h’(vj))  ED ) {OK = false; break;}; if OK { VM’ = VM – v; VD’ = VD – w’ if isempty(VM’) output(h’); else Treesearch(VM’,VD’,EM,ED,h’) } } }

Branch-and-Bound Tree Search Keep track of the least-error mapping. DS.GR.23 Branch-and-Bound Tree Search Keep track of the least-error mapping. M D 1 2 a b c 3 d map_err = 0 bound_err = 99999 root map_err = 0 map_err = 0 1,a 1,b . . . map_err = 1 map_err = 0 2,b 2,c 2,d 2,a 2,c 2,d X X X X 3,c 3,a 3,c X map_err = 1 bound_err = 1 mapping = {(1,a)(2,b)(3,c)} map_err = 0; bound_err = 1 mapping = {(1,b)(2,d)(3,c)}