Graph Isomorphism Algorithms and networks. Graph Isomorphism 2 Today Graph isomorphism: definition Complexity: isomorphism completeness The refinement.

Slides:



Advertisements
Similar presentations
Bart Jansen 1.  Problem definition  Instance: Connected graph G, positive integer k  Question: Is there a spanning tree for G with at least k leaves?
Advertisements

Shortest Paths and Treewidth Algorithms and Networks.
Algorithms for computing Canonical labeling of Graphs and Sub-Graph Isomorphism.
Lecture 24 MAS 714 Hartmut Klauck
PHYLOGENETIC TREES Bulent Moller CSE March 2004.
2/14/13CMPS 3120 Computational Geometry1 CMPS 3120: Computational Geometry Spring 2013 Planar Subdivisions and Point Location Carola Wenk Based on: Computational.
1 Discrete Structures & Algorithms Graphs and Trees: III EECE 320.
Approximation, Chance and Networks Lecture Notes BISS 2005, Bertinoro March Alessandro Panconesi University La Sapienza of Rome.
1 NP-completeness Lecture 2: Jan P The class of problems that can be solved in polynomial time. e.g. gcd, shortest path, prime, etc. There are many.
1 Steiner Tree on graphs of small treewidth Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
Self Stabilizing Algorithms for Topology Management Presentation: Deniz Çokuslu.
The Theory of NP-Completeness
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
1 The Monte Carlo method. 2 (0,0) (1,1) (-1,-1) (-1,1) (1,-1) 1 Z= 1 If  X 2 +Y 2  1 0 o/w (X,Y) is a point chosen uniformly at random in a 2  2 square.
CS774. Markov Random Field : Theory and Application Lecture 17 Kyomin Jung KAIST Nov
Probabilistic networks Inference and Other Problems Hans L. Bodlaender Utrecht University.
Applied Discrete Mathematics Week 12: Trees
On the Hardness of Graph Isomorphism Jacobo Tor á n SIAM J. Comput. Vol 33, p , Presenter: Qingwu Yang April, 2006.
Vertex Cover, Dominating set, Clique, Independent set
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
Graphs and Trees This handout: Trees Minimum Spanning Tree Problem.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
CSE 421 Algorithms Richard Anderson Lecture 4. What does it mean for an algorithm to be efficient?
SubSea: An Efficient Heuristic Algorithm for Subgraph Isomorphism Vladimir Lipets Ben-Gurion University of the Negev Joint work with Prof. Ehud Gudes.
2-Layer Crossing Minimisation Johan van Rooij. Overview Problem definitions NP-Hardness proof Heuristics & Performance Practical Computation One layer:
Study Group Randomized Algorithms Jun 7, 2003 Jun 14, 2003.
Coloring Algorithms and Networks. Coloring2 Graph coloring Vertex coloring: –Function f: V  C, such that for all {v,w}  E: f(v)  f(w) Chromatic number.
Additive Spanners for k-Chordal Graphs V. D. Chepoi, F.F. Dragan, C. Yan University Aix-Marseille II, France Kent State University, Ohio, USA.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
Clique Cover Cook’s Theorem 3SAT and Independent Set
Steiner trees Algorithms and Networks. Steiner Trees2 Today Steiner trees: what and why? NP-completeness Approximation algorithms Preprocessing.
Treewidth Algorithms and Networks. Treewidth2 Overview Historic introduction: Series parallel graphs Dynamic programming on trees Dynamic programming.
Data Structures and Algorithms Graphs Minimum Spanning Tree PLSD210.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
Fixed Parameter Complexity Algorithms and Networks.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta
Lecture 22 More NPC problems
Graph Algorithms. Definitions and Representation An undirected graph G is a pair (V,E), where V is a finite set of points called vertices and E is a finite.
1 Steiner Tree Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
Graph Colouring L09: Oct 10. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including the famous.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b.
Partitioning the Labeled Spanning Trees of an Arbitrary Graph into Isomorphism Classes Austin Mohr.
The Dominating Set and its Parametric Dual  the Dominated Set  Lan Lin prepared for theory group meeting on June 11, 2003.
Bipartite Matching. Unweighted Bipartite Matching.
Computing Branchwidth via Efficient Triangulations and Blocks Authors: F.V. Fomin, F. Mazoit, I. Todinca Presented by: Elif Kolotoglu, ISE, Texas A&M University.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
The full Steiner tree problem Theoretical Computer Science 306 (2003) C. L. Lu, C. Y. Tang, R. C. T. Lee Reporter: Cheng-Chung Li 2004/06/28.
CSE 421 Algorithms Richard Anderson Winter 2009 Lecture 5.
NP-completeness NP-complete problems. Homework Vertex Cover Instance. A graph G and an integer k. Question. Is there a vertex cover of cardinality k?
Algorithms for hard problems Parameterized complexity Bounded tree width approaches Juris Viksna, 2015.
CSE 421 Algorithms Richard Anderson Autumn 2015 Lecture 5.
1 Variations of the maximum leaf spanning tree problem for bipartite graphs P.C. Li and M. Toulouse Information Processing Letters 97 (2006) /03/14.
Honors Track: Competitive Programming & Problem Solving Tree Isomorphism Pantea Haghighatkhah.
Theory of Computational Complexity Probability and Computing Chapter Hikaru Inada Iwama and Ito lab M1.
Steiner trees: Approximation Algorithms
IOI/ACM ICPC Training 4 June 2005.
Graphs and Algorithms (2MMD30)
Algorithms and Networks
Haim Kaplan and Uri Zwick
Algorithms and Networks
Algorithms and networks
Vertex Cover, Dominating set, Clique, Independent set
Algorithms and Complexity
Algorithms and networks
Lectures on Graph Algorithms: searching, testing and sorting
Complexity Theory: Foundations
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:

Graph Isomorphism Algorithms and networks

Graph Isomorphism 2 Today Graph isomorphism: definition Complexity: isomorphism completeness The refinement heuristic Isomorphism for trees –Rooted trees –Unrooted trees

Graph Isomorphism 3 Two graphs G=(V,E) and H=(W,F) are isomorphic if there is a bijective function f: V  W such that for all v, w  V: –{v,w}  E  {f(v),f(w)}  F

Applications Chemistry: databases of molecules (etc.) –Actually needed: canonical form of molecule structure / graph Other, e.g., speeding up algorithms for highly symmetric graphs Graph Isomorphism 4

5 Variant for labeled graphs Let G = (V,E), H=(W,F) be graphs with vertex labelings l: V  L, l’  L. G and H are isomorphic labeled graphs, if there is a bijective function f: V  W such that –For all v, w  V: {v,w}  E  {f(v),f(w)}  F –For all v  V: l(v) = l’(f(v)). Application: organic chemistry: –determining if two molecules are identical.

Graph Isomorphism 6 Complexity of graph isomorphism Problem is in NP, but –No NP-completeness proof is known –No polynomial time algorithm is known If GI is NP-complete, then “strange things happen” –“Polynomial time hierarchy collapses to a finite level” NP NP-complete P Graph isomorphism If P  NP ?

Graph Isomorphism 7 Isomorphism-complete Problems are isomorphism- complete, if they are `equally hard’ as graph isomorphism –Isomorphism of bipartite graphs –Isomorphism of labeled graphs –Automorphism of graphs Given: a graph G=(V,E) Question: is there a non-trivial automorphism, i.e., a bijective function f: V  V, not the identity, with for all v,w  V: –{v,w}  E, if and only if {f(v),f(w)}  E.

Graph Isomorphism 8 More isomorphism complete problems Finding a graph isomorphism f Isomorphism of semi-groups Isomorphism of finite automata Isomorphism of finite algebra’s Isomorphism of –Connected graphs –Directed graphs –Regular graphs –Perfect graphs –Chordal graphs –Graphs that are isomorphic with their complement

Graph Isomorphism 9 Special cases are easier Polynomial time algorithms for –Graphs of bounded degree –Planar graphs –Trees –Bounded treewidth Expected polynomial time for random graphs This course

Graph Isomorphism 10 An equivalence relation on vertices Say v ~ w, if and only if there is an automorphism mapping v to w. ~ is an equivalence relation Partitions the vertices in automorphism classes Tells on structure of graph

Graph Isomorphism 11 Iterative vertex partition heuristic the idea Partition the vertices of G and H in classes Each class for G has a corresponding class for H. Property: vertices in class must be mapped to vertices in corresponding class Refine classes as long as possible When no refinement possible, check all possible ways that `remain’.

Graph Isomorphism 12 Iterative vertex partition heuristic If |V|  |W|, or |E|  |F|, output: no. Done. Otherwise, we partition the vertices of G and H into classes, such that –Each class for G has a corresponding class for H –If f is an isomorphism from G to H, then f(v) belongs to the class, corresponding to the class of v. First try: vertices belong to the same class, when they have the same degree. –If f is an isomorphism, then the degree of f(v) equals the degree of v for each vertex v.

Graph Isomorphism 13 Scheme Start with sequence SG = (A 1 ) of subsets of G with A 1 =V, and sequence SH = (B 1 ) of subsets of H with B 1 =W. Repeat until … –Replace A i in SG by A i1,…,A ir and replace B i in SH by B i1,…,B ir. A i1,…,A ir is partition of A i B i1,…,B ir is partition of B i For each isormorphism f: v in A ij if and only if f(v) in B ij

Graph Isomorphism 14 Possible refinement Count for each vertex in A i and B i how many neighbors they have in A j and B j for some i, j. Set A is = {v in A i | v has s neighbors in A j }. Set B is = {v in B i | v has s neighbors in B j }. Invariant: for all v in the ith set in SG, f(v) in the ith set in SH. If some |A i |  |B i |, then stop: no isomorphism.

Graph Isomorphism 15 Other refinements Partition upon other characteristics of vertices –Label –Number of vertices at distance d (in a set A i ). –…

Graph Isomorphism 16 After refining If each A i contains one vertex: check the only possible isomorphism. Otherwise, cleverly enumerate all functions that are still possible, and check these. Works well in practice!

Graph Isomorphism 17 Isomorphism on trees Linear time algorithm to test if two (labeled) trees are isomorphic. (Aho, Hopcroft, Ullman, 1974) Algorithm to test if two rooted trees are isomorphic. Used as a subroutine for unrooted trees.

Graph Isomorphism 18 Rooted tree isomorphism For a vertex v in T, let T(v) be the subtree of T with v as root. Level of vertex: distance to root. If T 1 and T 2 have different number of levels: not isomorphic, and we stop. Otherwise, we continue:

Graph Isomorphism 19 Structure of algorithm Tree is processed level by level, from bottom to root Processing a level: –A long label for each vertex is computed –This is transformed to a short label Vertices in the same layer whose subtrees are isomorphic get the same labels: –If v and w on the same level, then L(v)=L(w), if and only if T(v) and T(w) are isomorphic with an isomorphism that maps v to w.

Graph Isomorphism 20 Labeling procedure For each vertex, get the set of labels assigned to its children. Sort these sets. –Bucketsort the pairs (L(w), v) for T 1, w child of v –Bucketsort the pairs (L(w), v) for T 2, w child of v For each v, we now have a long label LL(v) which is the sorted set of labels of the children. Use bucketsort to sort the vertices in T 1 and T 2 such that vertices with same long label are consecutive in ordering.

Graph Isomorphism 21 On sorting w.r.t. the long lists (1) Preliminary work: –Sort the nodes is the layer on the number of children they have. Linear time. (Counting sort / Radix sort.) –Make a set of pairs (j,i) with (j,i) in the set when the jth number in a long list is i. –Radix sort this set of pairs.

Graph Isomorphism 22 On sorting w.r.t. the long lists (2) Let q be the maximum length of a long list Repeat –Distribute among buckets the nodes with at least q children, with respect to the qth label in their long list Nodes distributed in buckets in earlier round are taken here in the order as they appear in these buckets. The sorted list of pairs (j,i) is used to skip empty buckets in this step. –q --; –Until q=0.

Graph Isomorphism 23 After vertices are sorted with respect to long label Give vertices with same long label same short label (start counting at 0), and repeat at next level. If we see that the set of labels for a level of T 1 is not equal to the set for the same level of T 2, stop: not isomorphic.

Graph Isomorphism 24 Time One layer with n 1 nodes with n 2 nodes in next layer costs O(n 1 + n 2 ) time. Total time: O(n).

Graph Isomorphism 25 Unrooted trees Center of a tree –A vertex v with the property that the maximum distance to any other vertex in T is as small as possible. –Each tree has a center of one or two vertices. Finding the center: –Repeat until we have a vertex or a single edge: Remove all leaves from T. –O(n) time: each vertex maintains current degree in variable. Variables are updated when vertices are removed, and vertices put in set of leaves when their degree becomes 1.

Graph Isomorphism 26 Isomorphism of unrooted trees Note: the center must be mapped to the center If T 1 and T 2 both have a center of size 1: –Use those vertices as root. If T 1 and T 2 both have a center of size 2: –Try the two different ways of mapping the centers –Or: subdivide the edge between the two centers and take the new vertices as root Otherwise: not isomorphic. 1 or 2 calls to isomorphism of rooted trees: O(n).

Graph Isomorphism 27 Conclusions Similar methods work for finding automorphisms We saw: heuristic for arbitrary graphs, algorithm for trees There are algorithms for several special graph classes (e.g., planar graphs, graphs of bounded degree,…)