1 / 24

Algorithms for computing Canonical labeling of Graphs and Sub-Graph Isomorphism

Algorithms for computing Canonical labeling of Graphs and Sub-Graph Isomorphism. Agenda. Brief overview of complexity issues of Graph Isomorphism, Sub Graph Isomorphism. Canonical Labeling problem McKay’s Algorithm to find canonical labels and generators for Aut(G)

chip
Télécharger la présentation

Algorithms for computing Canonical labeling of Graphs and Sub-Graph Isomorphism

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Algorithms for computing Canonical labeling of Graphs and Sub-Graph Isomorphism

  2. Agenda • Brief overview of complexity issues of Graph Isomorphism, Sub Graph Isomorphism. • Canonical Labeling problem • McKay’s Algorithm to find canonical labels and generators for Aut(G) • Ullmann’s Algorithm for Sub-Graph Isomorphism. • Conclusion.

  3. Complexity of Graph Isomorphismand Sub Graph Isomorphism • Sub Graph Isomorphism is a NP-Complete problem • Graph Isomorphism (GI) is NP , but currently its still a open problem if GI is in P or NP-complete. • Babai gave a O(n4m+c) deterministic algorithm , where m is the multiplicity of the eigen values (spectrum) of the adjacency matrix. • Equivalence of spectrumis a Necessary but not Sufficient condition to test isomorphism.

  4. Automorphism Group of a Graph. • AUT(G) subgroup within a symmetric group Sn (set of all permutations) • AUT(G) = { g | g €Sn and Gg = G } • Gg is the relabeled graph with permutation g • In simple terms AUT(G) is the set of all permutations under which adjacency matrix of G remains the same. • A Graph G and its compliment G’has same AUT(G)

  5. 1 2 3 4 Label-1 Example of Automorphism Rewrite the adjacency matrix for each permutation 3 4 1 2 1 2 3 4 2 4 3 1 0 1 1 1 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 1 1 0 1 0 0 1 0 0 0 1 0 0 0 1 0 1 1 0 1 0 0 1 0 If a permutation g is in Aut(G) then the adjacency matrix remain the same When we apply g to the adjacency matrix Gg. Aut(G) = { (1, 2 ,4) , (3) }

  6. Canonical Labeling Problem • Let G*(V) be the set of labeled graphs with Vertex set V. • G€G*(V) , Canon(G): G*(V)  G*(V) • Canon(G) is isomorphic to G • Canon(Gg) = Canon(G) , g € Sn • We are interested in finding this mapping function, a direct use of this labeling is that we can find isomorphism very easily for this.

  7. Equitable Partitions • V = {1,2,…,n} , partition of V is a set of disjoint of subsets of V (union of which is V) • p = {C1,C2,….Ck } , C1 U C2 U … Ck = V • d(vi,Cj) = no.of vertices adjacent to vi in Ci . • Partition p is equitable if • vi,vj € Cm, d(vi,Cp)= d(vj,Cp)

  8. Ordering among the Partitions. • p1 ≤ p2 , p1 is finer than p2 (p2 is coarser than p1 ) • Let P(V) be a set of all partitions on the vertex set V , then the operator ‘≤’creates a partial order among the partitions. • {(1),(2),(3),…(n)} ≤..... ≤ pi ≤ pm ≤ pn ….. ≤ {(1,2,3,…,n)} • ..... ≤ pi ≤ pm ≤ pn ….. • pi is coarsest partition finer than pm • pn is finest partition coarser than pm • We can add the equitable adjective to finer and coarser if the equitable property is statisfied.

  9. Fix of a partitionby permutation. • Let g € Sn (Symmetric group) , vi € V , vigis the image of vi under permutation g . • Let W subset of V then Wg = {vig | vi € W } • p = {C1 , C2 , … Ck } then pg = {Cg1, Cg2 , …} • If pg= p then g is said to Fix p. • Example: p = {(1,2,3),(4),(5,6)} , then g = {3,2,1,4,6,5} fixes p.

  10. Key Ideas behind Canonical labeling algorithm • Quick Recall: We are interested in finding Aut(G) and Canon(G). • Naïve Algorithm: generate all the O(n!) permutations and find Aut(G) and hencecompute the Canon(G). • Observation all the elements in Aut(G) should correspond to some labeling with finest partition of the vertex set V. • Also since all the partitions ( P(V) ) are ordered with ‘≤’ we can make use of this ordering to prune the finest partitions which are useless.

  11. Basic Structure of the Algorithm • Start with a Coarsest partition pv (the order of vertices in the input graph). • Generate a Equitable partition Eq(pv) from pv such that • ……. pj≤ Eq(pv) ≤ pv , (Eq(pv) is coarsest partition which is finer than pv ). • This is called Refinement , R(p) . • Keep Refining until the partition becomes finest(discrete) call these terminal partition.

  12. Backtrack depth first structure. pv Refine & Prune R(pv ) R(….R(R( (pv ) R(….R(R( (pv ) Discrete partitions

  13. Refinement Procedure. R(p,a) • R(p,a) is a function such that • INPUT: any partition p , a subset of p • OUTPUT: coarsest equitable partition which is finer than p. • p = { C1 ,C2 ,C1 .... Ck} , letp’ = p • a = {W} • for(i=0;i<k;i++) • partition Ci according to d(v,W) call the partitions B. • p’ =( p’-{Ci}) U (B)

  14. Example p = { (0,1,2,3,4,5) } , a = { (0,1,2,3,4,5)} d(0,a)=3 , d(1,a)=3,d(2,a)=3,d(3,a)=1 d(4,a)=1,d(5,a)=1 Two buckets of values 3 , 1 B = {(0,1,2) , (3,4,5) } = R(p,a) p = {(0,1,2),(3),(4,5)} not equitable a = {(3)} Loop1: C1 = (0,1,2) d(0,a) = 1, d(1,a) = 0 , d(2,a) =0 B= {(0),(1,2)} Loop2: C2 = (3) d(3,a) = 0 , B= {(3)} Loop3: C3 = (4,5) d(4,a) = 0 , d(5,a) = 0 , B={(4,5)} R(p,a) = {(0),(1,2),(3),(4,5)} 4 1 0 2 5 3

  15. Example {(3,4,5) (0,1,2)} 3 4 {(3)(4,5)(1,2)(0)} {(4)(3,5)(0,2)(1)} 4 5 4 3 1 {(3)(4)(5)(2)(1)(0)} {(3)(5)(4)(1)(2)(0)} 0 2 {(4)(3)(5)(2)(0)(1)} 5 3

  16. Collect all the leaf nodes • Let X be the collection of all the leaf nodes in the back track tree. • Now we can define a operator ‘~’ on t1 , t2 € X • t1 ~ t2 iff Gt1 = Gt2 • Re-label the vertices in the order of t1 and t2 and check if the adjacency matrices are the same. • Note ~ partitions X into equivalence classes we just need one class pick a element and define Aut(G) • Aut(G) = {g | t = tcg , t € X , t ~ tc } • In fact we can stick to a single equivalence class and eliminate all the others (that’s where the pruning comes into picture)

  17. The complete tree is never generated! • Since |Aut(G)| ≤ |X| • Generating all X is a big overkill infact its not possible since |Aut(G)| could be O(n!) • If we observe carefully we just need to generate ONE equivalence class. • How do we make sure that backtracking leads to leaf nodes from a singleequivalence class ? • We need some property which is common for the all leaf nodes in a single equivalence class along all the internal nodes.

  18. Property of terminal nodes used to prune… • Objective: We want to prune all the internal nodes( from different equivalence classes) in the backtrack tree. • Step 1: First find two terminal nodes t1 , t2 € X such that Gt1 = Gt2 , then its clear that t1 ~ t2 (also for some g € Sn, tg1 = t2 ) • From above its clear that we need some function F which will not change when g is applied to p • F(Gg,pg) = F(G,p)

  19. Property to prune. • If t1= pk≤ pk ≤ pk-1 …….≤ p2 ≤ p1 • F’(t1) = (F(G, pk) F(G, pk-1) …..F(G, p1)) • F*(t1) = (F(G, p1) F(G, p2) …..F(G, pk)) • We can generate F*(t1) by finding some two terminal nodes t1 , t2 € X , such that Gt1 = Gt2 • Once we generate F*(t1) prune any path which does not match the suffix of F*(t1)

  20. Pruning Illustrated p1 p2 = R(pv ) Pruned because F*(t1) don’t match at some suffix t1 t2 R(….R(R( (pv ) R(….R(R( (pv ) Compute F*(t1) = (F(G, p1) F(G, p2) ….. F(G, pk))

  21. Ullmann’s Sub-Graph Isomorphism algorithm • Problem: Given a graphs Ga ,Gb wewant to find if Ga is isomorphic to any sub graph in Gb . • Let M be a matching matrix of size |a x b | , Mij = 1 , if degree(j, Ga) ≤ degree(j, Gb) , 0 otherwise. • A systematic enumeration algorithm (depth first, backtrack) would generate this matrix M such that • There is exactly one 1 per row and column • Once the depth of the enumeration reaches |a| check if adjacency matrix of Ga and adjacency of match from M matches.

  22. Ullmann’s observation for pruning • Let Md be the matching matrix generated at any depth d ≤ |a| • Then the bottom |a-d| rows of Md and M are the same, the brute force algorithm will just continue. • Ullmann made an observation that makes use of some extra information from the top |d| rows which are fixed. • OBSERVATION: If vi €Va and vj € Vb are mapped in one of the top |d| rows in Md . Then any vertex adjacent to vi in Ga can be mapped only to vertex adjacent to vj in Gb . • With above observation we can reduce the # of 1’s in the bottom |a-d| rows of Md thus reducing search space. • Ullmann showed experimentally the validity of this pruning approach.

  23. References • D. G. Corneil and C. C. Gotlieb. An efficient algorithm for graph isomorphism. In Journal of the ACM (JACM), pages 51–64, Volume 17 , Issue1 (January 1970). • D. Cvetkovi´c, P. Rowlingson, and S. Simi´c. Eigenspaces of graphs. In Cambridge University Press, 1997. • C. D. Godsil and B. D. McKay. Constructing cospectral graphs. In Acquationes Mathematicae, pages 257–268, 2001. • F. Harary. The determinant of the adjacency matrix of a graph. In SIAM Review, pages 202–210, Vol.4, 1962. • Brendan D. McKay. Computing automorphishms and canonical labelling of graphs. In Combinatorial Mathematics, pages 223–232, Volume 686/1978. • B. D. McKay. Practical graph isomorphism. In Congressus Numerantium, pages 45–87, 1981.

  24. References A. J. Schwenk. Almost all trees are cospectral. In New Directions in the Theory of Graphs (Proc. Third Annual Arbor Conference), pages 275–307, 1973. J. R. Ullmann. An algorithm for subgraph isomorphism. In Journal of the ACM (JACM), pages 31–42, Volume 23 , Issue 1 (January 1976).

More Related