SlideShare a Scribd company logo
1 of 26
Graph Isomorphism

Algorithms and networks
Today
•   Graph isomorphism: definition
•   Complexity: isomorphism completeness
•   The refinement heuristic
•   Isomorphism for trees
    – Rooted trees
    – Unrooted trees


                          Graph Isomorphism   2
Graph Isomorphism
• 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




                          Graph Isomorphism        3
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       4
Complexity of graph
               isomorphism
  • Problem is in NP, but
       – No NP-completeness proof is known
       – No polynomial time algorithm is known

If P   NP
                     NP-complete                  ? isomorphism
                                                       Graph


              NP       P

                              Graph Isomorphism               5
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   6
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    7
Special cases are easier
• Polynomial time algorithms for
  – Graphs of bounded degree
  – Planar graphs
                       This course
  – Trees
• Expected polynomial time for random
  graphs


                          Graph Isomorphism   8
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   9
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       10
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             11
Scheme
• Start with sequence SG = (A1) of subsets of G
  with A1=V, and sequence SH = (B1) of subsets of
  H with B1=W.
• Repeat until …
   – Replace Ai in SG by Ai1,…,Air and replace Bi in SH by
     Bi1,…,Bir.
      • Ai1,…,Air is partition of Ai
      • Bi1,…,Bir is partition of Bi
      • For each isormorphism f: v in Aij if and only if f(v) in Bij


                                      Graph Isomorphism                12
Possible refinement
• Count for each vertex in Ai and Bi how many
  neighbors they have in Aj and Bj for some i, j.
• Set Ais = {v in Ai | v has s neighbors in Aj}.
• Set Bis = {v in Bi | v has s neighbors in Bj}.
• Invariant: for all v in the ith set in SG, f(v) in the
  ith set in SH.
• If some |Ai| |Bi|, then stop: no isomorphism.


                               Graph Isomorphism           13
Other refinements
• Partition upon other characteristics of
  vertices
  – Label
  – Number of vertices at distance d (in a set Ai).
  –…




                            Graph Isomorphism         14
After refining
• If each Ai 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   15
Isomorphism on trees
• Linear time algorithm to test if two
  (labeled) trees are isomorphic.
• Algorithm to test if two rooted trees are
  isomorphic.
• Used as a subroutine for unrooted trees.



                         Graph Isomorphism    16
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 T1 and T2 have different number of levels:
  not isomorphic, and we stop. Otherwise, we
  continue:


                          Graph Isomorphism    17
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            18
Labeling procedure
• For each vertex, get the set of labels assigned to its
  children.
• Sort these sets.
   – Bucketsort the pairs (L(w), v) for T1, w child of v
   – Bucketsort the pairs (L(w), v) for T2, 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 T1 and T2
  such that vertices with same long label are
  consecutive in ordering.
                                 Graph Isomorphism         19
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      20
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                  21
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
  T1 is not equal to the set for the same level
  of T2, stop: not isomorphic.


                          Graph Isomorphism         22
Time
• One layer with n1 nodes with n2 nodes in
  next layer costs O(n1 + n2) time.
• Total time: O(n).




                        Graph Isomorphism    23
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        24
Isomorphism of unrooted trees
• Note: the center must be mapped to the center
• If T1 and T2 both have a center of size 1:
   – Use those vertices as root.
• If T1 and T2 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      25
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,…)

                         Graph Isomorphism    26

More Related Content

What's hot

Planar graph
Planar graphPlanar graph
Planar graphShakil Ahmed
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph TheoryYosuke Mizutani
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structureAbrish06
 
Interesting applications of graph theory
Interesting applications of graph theoryInteresting applications of graph theory
Interesting applications of graph theoryTech_MX
 
Slides Chapter10.1 10.2
Slides Chapter10.1 10.2Slides Chapter10.1 10.2
Slides Chapter10.1 10.2showslidedump
 
Graph coloring
Graph coloringGraph coloring
Graph coloringRashika Ahuja
 
Graph theory and life
Graph theory and lifeGraph theory and life
Graph theory and lifeMilan Joshi
 
Cs6702 graph theory and applications 2 marks questions and answers
Cs6702 graph theory and applications 2 marks questions and answersCs6702 graph theory and applications 2 marks questions and answers
Cs6702 graph theory and applications 2 marks questions and answersappasami
 
Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring Darwish Ahmad
 
Graph Theory
Graph TheoryGraph Theory
Graph TheoryEhsan Hamzei
 
Graph data structure and algorithms
Graph data structure and algorithmsGraph data structure and algorithms
Graph data structure and algorithmsAnandhasilambarasan D
 
Graph: Euler path and Euler circuit
Graph: Euler path and Euler circuitGraph: Euler path and Euler circuit
Graph: Euler path and Euler circuitLiwayway Memije-Cruz
 
Prim's algorithm
Prim's algorithmPrim's algorithm
Prim's algorithmPankaj Thakur
 

What's hot (20)

Planar graph
Planar graphPlanar graph
Planar graph
 
Euler graph
Euler graphEuler graph
Euler graph
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
 
Interesting applications of graph theory
Interesting applications of graph theoryInteresting applications of graph theory
Interesting applications of graph theory
 
Graph theory
Graph  theoryGraph  theory
Graph theory
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Graphs - Discrete Math
Graphs - Discrete MathGraphs - Discrete Math
Graphs - Discrete Math
 
Slides Chapter10.1 10.2
Slides Chapter10.1 10.2Slides Chapter10.1 10.2
Slides Chapter10.1 10.2
 
Graph coloring
Graph coloringGraph coloring
Graph coloring
 
Graph theory and life
Graph theory and lifeGraph theory and life
Graph theory and life
 
Dijkstra
DijkstraDijkstra
Dijkstra
 
Cs6702 graph theory and applications 2 marks questions and answers
Cs6702 graph theory and applications 2 marks questions and answersCs6702 graph theory and applications 2 marks questions and answers
Cs6702 graph theory and applications 2 marks questions and answers
 
Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
 
Graph data structure and algorithms
Graph data structure and algorithmsGraph data structure and algorithms
Graph data structure and algorithms
 
Graph: Euler path and Euler circuit
Graph: Euler path and Euler circuitGraph: Euler path and Euler circuit
Graph: Euler path and Euler circuit
 
Prim's algorithm
Prim's algorithmPrim's algorithm
Prim's algorithm
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
 

Viewers also liked

Graph data structure
Graph data structureGraph data structure
Graph data structureTech_MX
 
Boolean Algebra
Boolean AlgebraBoolean Algebra
Boolean Algebragavhays
 
Control charts for attributes
Control charts for attributesControl charts for attributes
Control charts for attributesBuddy Krishna
 
Control charts
Control chartsControl charts
Control chartsMohit Singla
 
Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data StructureAnuj Modi
 
Control charts
Control charts Control charts
Control charts Gaurav Singh
 
Statistical Process Control
Statistical Process ControlStatistical Process Control
Statistical Process ControlMarwa Abo-Amra
 

Viewers also liked (10)

Lecture 27
Lecture 27Lecture 27
Lecture 27
 
Lecture 09
Lecture 09Lecture 09
Lecture 09
 
Graph data structure
Graph data structureGraph data structure
Graph data structure
 
Boolean Algebra
Boolean AlgebraBoolean Algebra
Boolean Algebra
 
Control charts for attributes
Control charts for attributesControl charts for attributes
Control charts for attributes
 
Control charts
Control chartsControl charts
Control charts
 
Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data Structure
 
CONTROL CHARTS
CONTROL CHARTSCONTROL CHARTS
CONTROL CHARTS
 
Control charts
Control charts Control charts
Control charts
 
Statistical Process Control
Statistical Process ControlStatistical Process Control
Statistical Process Control
 

Similar to Graph isomorphism

Problems in parallel computations of tree functions
Problems in parallel computations of tree functionsProblems in parallel computations of tree functions
Problems in parallel computations of tree functionsDr Sandeep Kumar Poonia
 
Data structure computer graphs
Data structure computer graphsData structure computer graphs
Data structure computer graphsKumar
 
Data Structures - Lecture 10 [Graphs]
Data Structures - Lecture 10 [Graphs]Data Structures - Lecture 10 [Graphs]
Data Structures - Lecture 10 [Graphs]Muhammad Hammad Waseem
 
Slopes of perpendicular lines
Slopes of perpendicular linesSlopes of perpendicular lines
Slopes of perpendicular linesjfrazier1916
 
Lesson 13 algebraic curves
Lesson 13    algebraic curvesLesson 13    algebraic curves
Lesson 13 algebraic curvesJean Leano
 
Graph Theory
Graph TheoryGraph Theory
Graph TheoryRashmi Bhat
 
Data structure
Data structureData structure
Data structuresumit singh
 
14 chapter9 graph_algorithmstopologicalsort_shortestpath
14 chapter9 graph_algorithmstopologicalsort_shortestpath14 chapter9 graph_algorithmstopologicalsort_shortestpath
14 chapter9 graph_algorithmstopologicalsort_shortestpathSSE_AndyLi
 
Mathematics compendium for class ix
Mathematics compendium for class ixMathematics compendium for class ix
Mathematics compendium for class ixAPEX INSTITUTE
 
Lecture 1--Graph Algorithms -- Basics.pptx
Lecture 1--Graph Algorithms -- Basics.pptxLecture 1--Graph Algorithms -- Basics.pptx
Lecture 1--Graph Algorithms -- Basics.pptxChandanGiri21
 
Transform as a vector? Tying functional parity with rotation angle of coordin...
Transform as a vector? Tying functional parity with rotation angle of coordin...Transform as a vector? Tying functional parity with rotation angle of coordin...
Transform as a vector? Tying functional parity with rotation angle of coordin...SayakBhattacharjee4
 
Graphs (Models & Terminology)
Graphs (Models & Terminology)Graphs (Models & Terminology)
Graphs (Models & Terminology)zunaira saleem
 
Graphs and eularian circuit & path with c++ program
Graphs and eularian circuit & path with c++ programGraphs and eularian circuit & path with c++ program
Graphs and eularian circuit & path with c++ programMuhammad Danish Badar
 

Similar to Graph isomorphism (20)

Unit 2: All
Unit 2: AllUnit 2: All
Unit 2: All
 
Problems in parallel computations of tree functions
Problems in parallel computations of tree functionsProblems in parallel computations of tree functions
Problems in parallel computations of tree functions
 
Data structure computer graphs
Data structure computer graphsData structure computer graphs
Data structure computer graphs
 
Data Structures - Lecture 10 [Graphs]
Data Structures - Lecture 10 [Graphs]Data Structures - Lecture 10 [Graphs]
Data Structures - Lecture 10 [Graphs]
 
Graph ds
Graph dsGraph ds
Graph ds
 
graphtheory
graphtheorygraphtheory
graphtheory
 
Slopes of perpendicular lines
Slopes of perpendicular linesSlopes of perpendicular lines
Slopes of perpendicular lines
 
Presentation on graphs
Presentation on graphsPresentation on graphs
Presentation on graphs
 
Lesson 13 algebraic curves
Lesson 13    algebraic curvesLesson 13    algebraic curves
Lesson 13 algebraic curves
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
 
Data structure
Data structureData structure
Data structure
 
14 chapter9 graph_algorithmstopologicalsort_shortestpath
14 chapter9 graph_algorithmstopologicalsort_shortestpath14 chapter9 graph_algorithmstopologicalsort_shortestpath
14 chapter9 graph_algorithmstopologicalsort_shortestpath
 
Mathematics compendium for class ix
Mathematics compendium for class ixMathematics compendium for class ix
Mathematics compendium for class ix
 
Lecture 1--Graph Algorithms -- Basics.pptx
Lecture 1--Graph Algorithms -- Basics.pptxLecture 1--Graph Algorithms -- Basics.pptx
Lecture 1--Graph Algorithms -- Basics.pptx
 
Algorithm Assignment Help
Algorithm Assignment HelpAlgorithm Assignment Help
Algorithm Assignment Help
 
Graphs
GraphsGraphs
Graphs
 
Transform as a vector? Tying functional parity with rotation angle of coordin...
Transform as a vector? Tying functional parity with rotation angle of coordin...Transform as a vector? Tying functional parity with rotation angle of coordin...
Transform as a vector? Tying functional parity with rotation angle of coordin...
 
Graph 1
Graph 1Graph 1
Graph 1
 
Graphs (Models & Terminology)
Graphs (Models & Terminology)Graphs (Models & Terminology)
Graphs (Models & Terminology)
 
Graphs and eularian circuit & path with c++ program
Graphs and eularian circuit & path with c++ programGraphs and eularian circuit & path with c++ program
Graphs and eularian circuit & path with c++ program
 

More from Core Condor

Weighted graphs
Weighted graphsWeighted graphs
Weighted graphsCore Condor
 
Red black 2
Red black 2Red black 2
Red black 2Core Condor
 
Red black 1
Red black 1Red black 1
Red black 1Core Condor
 
Disjoint sets
Disjoint setsDisjoint sets
Disjoint setsCore Condor
 
Red blacktrees
Red blacktreesRed blacktrees
Red blacktreesCore Condor
 

More from Core Condor (6)

Weighted graphs
Weighted graphsWeighted graphs
Weighted graphs
 
Red black 2
Red black 2Red black 2
Red black 2
 
Red black 1
Red black 1Red black 1
Red black 1
 
Disjoint sets
Disjoint setsDisjoint sets
Disjoint sets
 
Red blacktrees
Red blacktreesRed blacktrees
Red blacktrees
 
2 3 tree
2 3 tree2 3 tree
2 3 tree
 

Recently uploaded

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 

Recently uploaded (20)

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 

Graph isomorphism

  • 2. Today • Graph isomorphism: definition • Complexity: isomorphism completeness • The refinement heuristic • Isomorphism for trees – Rooted trees – Unrooted trees Graph Isomorphism 2
  • 3. Graph Isomorphism • 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 Graph Isomorphism 3
  • 4. 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 4
  • 5. Complexity of graph isomorphism • Problem is in NP, but – No NP-completeness proof is known – No polynomial time algorithm is known If P NP NP-complete ? isomorphism Graph NP P Graph Isomorphism 5
  • 6. 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 6
  • 7. 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 7
  • 8. Special cases are easier • Polynomial time algorithms for – Graphs of bounded degree – Planar graphs This course – Trees • Expected polynomial time for random graphs Graph Isomorphism 8
  • 9. 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 9
  • 10. 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 10
  • 11. 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 11
  • 12. Scheme • Start with sequence SG = (A1) of subsets of G with A1=V, and sequence SH = (B1) of subsets of H with B1=W. • Repeat until … – Replace Ai in SG by Ai1,…,Air and replace Bi in SH by Bi1,…,Bir. • Ai1,…,Air is partition of Ai • Bi1,…,Bir is partition of Bi • For each isormorphism f: v in Aij if and only if f(v) in Bij Graph Isomorphism 12
  • 13. Possible refinement • Count for each vertex in Ai and Bi how many neighbors they have in Aj and Bj for some i, j. • Set Ais = {v in Ai | v has s neighbors in Aj}. • Set Bis = {v in Bi | v has s neighbors in Bj}. • Invariant: for all v in the ith set in SG, f(v) in the ith set in SH. • If some |Ai| |Bi|, then stop: no isomorphism. Graph Isomorphism 13
  • 14. Other refinements • Partition upon other characteristics of vertices – Label – Number of vertices at distance d (in a set Ai). –… Graph Isomorphism 14
  • 15. After refining • If each Ai 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 15
  • 16. Isomorphism on trees • Linear time algorithm to test if two (labeled) trees are isomorphic. • Algorithm to test if two rooted trees are isomorphic. • Used as a subroutine for unrooted trees. Graph Isomorphism 16
  • 17. 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 T1 and T2 have different number of levels: not isomorphic, and we stop. Otherwise, we continue: Graph Isomorphism 17
  • 18. 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 18
  • 19. Labeling procedure • For each vertex, get the set of labels assigned to its children. • Sort these sets. – Bucketsort the pairs (L(w), v) for T1, w child of v – Bucketsort the pairs (L(w), v) for T2, 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 T1 and T2 such that vertices with same long label are consecutive in ordering. Graph Isomorphism 19
  • 20. 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 20
  • 21. 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 21
  • 22. 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 T1 is not equal to the set for the same level of T2, stop: not isomorphic. Graph Isomorphism 22
  • 23. Time • One layer with n1 nodes with n2 nodes in next layer costs O(n1 + n2) time. • Total time: O(n). Graph Isomorphism 23
  • 24. 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 24
  • 25. Isomorphism of unrooted trees • Note: the center must be mapped to the center • If T1 and T2 both have a center of size 1: – Use those vertices as root. • If T1 and T2 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 25
  • 26. 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,…) Graph Isomorphism 26