the GP Language Philip Cavanagh Graph Isomorphisms Isomorphism: - - PowerPoint PPT Presentation

the gp language
SMART_READER_LITE
LIVE PREVIEW

the GP Language Philip Cavanagh Graph Isomorphisms Isomorphism: - - PowerPoint PPT Presentation

A Graph Isomorphism Filter for the GP Language Philip Cavanagh Graph Isomorphisms Isomorphism: Two graphs which are the same up to a renaming of the vertices and edges These are a pair of isomorphic graphs: Graph Isomorphisms


slide-1
SLIDE 1

A Graph Isomorphism Filter for the GP Language

Philip Cavanagh

slide-2
SLIDE 2

Graph Isomorphisms

  • Isomorphism: Two graphs which are “the

same” up to a renaming of the vertices and edges

  • These are a pair of isomorphic graphs:
slide-3
SLIDE 3

Graph Isomorphisms

  • Isomorphism: Two graphs which are “the

same” up to a renaming of the vertices and edges

  • These are a pair of isomorphic graphs:
slide-4
SLIDE 4

The Graph Isomorphism Problem

  • A decision problem which asks, “Given two

graphs, G and H, is G isomorphic to H?”

  • In NP, as a map from G to H can be checked in

polynomial time by comparing adjacency matrices

  • Not known to be in either P or NP-Complete
  • Can be considered its own class between the

two: GI

slide-5
SLIDE 5

What is GP?

  • Graph Programming Language
  • Applies graph transformation rules
  • Rules are applied in a non-deterministic

manner as defined by the program text

  • Transforms a start graph into a set of output

graphs

slide-6
SLIDE 6

GP Example: Program

Rule name: link Program Text: “main = link!.”

slide-7
SLIDE 7

GP Example: Rule Application

link

slide-8
SLIDE 8

GP Example: Output Graphs

slide-9
SLIDE 9

Isomorphism Filter

  • Removal of isomorphic copies in this output

set would be beneficial

  • An adapted graph isomorphism problem:
  • Given a set of graphs S, return the smallest

subset S’ of S such that every graph in S is isomorphic to a graph in S’

  • This “filters out” unwanted duplicates
slide-10
SLIDE 10

Current Approaches

  • Direct Mapping

– Can “stop early” if isomorphism found – Can only compare two graphs

  • Canonical Forms (e.g. lexicographically

smallest adjacency matrix)

– Can compare many graphs – Requires full search to give an answer

slide-11
SLIDE 11

A Middle Ground?

  • José Luis López Presa, 2009 Thesis
  • Takes early stopping from direct mapping
  • Can be extended to compare many graphs
  • Seems a good method for the problem
slide-12
SLIDE 12

Presa’s Algorithm (Graph Pair)

  • Generate an ordering on the vertices of the

first graph

  • Try to generate a compatible ordering on the

second graph

  • The two orderings can be compared to see if

they define an isomorphism

slide-13
SLIDE 13

Example

  • We use the following graphs to compare for
  • isomorphism. First, graph G needs to be

processed.

slide-14
SLIDE 14

Generating a Vertex Ordering

  • Generate an initial partition according to the

vertices’ degrees within the graph

  • All vertices in G have degree 3, so the initial

partition is P0 = ({0,1,2,3,4,5,6,7})

  • Repeatedly refine the partition

using (in order of preference):

– Vertex refinement – Set refinement – Backtrack refinement

slide-15
SLIDE 15

Backtrack Refinement

  • As we only have one partition cell, we start

with a backtrack refinement

  • A vertex is chosen from the cell (e.g. 1)
  • Any vertex adjacent to 1 is placed in one cell
  • The others are placed in a

separate cell

  • P1 = ({0,2,7},{3,4,5,6})
slide-16
SLIDE 16

Set Refinement

  • Now that we have two cells, we can try to split

them based on their adjacencies with each

  • ther.
  • P1 = ({0,2,7},{3,4,5,6})
  • We use cell 1 to try to split

both of the cells of P1

  • P2 = ({2,7},{0},{6},{3,4},{5})
slide-17
SLIDE 17

Vertex Refinement

  • We now use the third type of refinement as

we have a cell containing only one vertex

  • This divides cells into those vertices which are

and are not adjacent to the chosen vertex

  • P2 = ({2,7},{0},{6},{3,4},{5})
  • We choose a vertex (e.g. 0)

and split the other cells with it

  • P3 = ({2,7},{6},{4},{3},{5})
slide-18
SLIDE 18

Vertex Refinement (II)

  • P3 = ({2,7},{6},{4},{3},{5})
  • We can use vertex refinement again, this time

using vertex 6:

  • P4 = ({7},{2},{4},{3},{5})
slide-19
SLIDE 19

Obtaining the ordering for G

  • We now have a partition of single vertex cells:

P4 = ({7},{2},{4},{3},{5})

  • We can now obtain an ordering by considering

the vertices removed (1, 0 and 6) and then adding the final partition:

  • Order(G) = (1,0,6,7,2,4,3,5)
slide-20
SLIDE 20

Now for H

  • To find an isomorphism between G and H, we

need to be able to generate a similar looking partition for H as for G using the same refinement types at each stage.

  • Again, all the vertex degrees are

3, so we start with a partition Q0 = ({0,1,2,3,4,5,6,7})

slide-21
SLIDE 21

First Attempt

  • As with G, we need to start with a backtrack
  • refinement. This time we pick vertex 0.
  • Then Q1 = ({1,2,7},{3,4,5,6})
  • P1 was ({0,2,7},{3,4,5,6}), so we can continue
  • A set refinement with cell 1

gives Q2 = ({1,2},{7},{3,4,5,6})

slide-22
SLIDE 22

Backtracking

  • Q2 = ({1,2},{7},{3,4,5,6}), while

P2 = ({2,7},{0},{6},{3,4},{5})

  • These are not compatible, so we are forced

back to the last backtracking refinement to try a different vertex.

  • Pick vertex 1 for backtracking:
  • Q1 = ({0,2,4},{3,5,6,7})
slide-23
SLIDE 23

Continuing

  • By applying a set refinement by cell 1, then

vertex refinements by vertices 4 and 3, we get the following, which are compatible with P1 to P4

  • Q1 = ({0,2,4},{3,5,6,7})
  • Q2 = ({0,2},{4},{3},{5,7},{6})
  • Q3 = ({0,2},{3},{5},{7},{6})
  • Q4 = ({2},{0},{5},{7},{6})
slide-24
SLIDE 24

Comparing orderings

  • We now have a pair of orderings for G and H:
  • Order(G) = (1,0,6,7,2,4,3,5)
  • Order(H) = (1,4,3,2,0,5,7,6)
  • We can see this represents an isomorphism
slide-25
SLIDE 25

Extension to GP Graphs

  • Graphs in GP are more general than this
  • example. Specifically, GP allows for graphs to

have:

– Vertex labels and loops: can be taken into consideration in the initial degree partition – Edge labels, directed edges and parallel edges: a slightly more complex definition of the degree of a vertex allows for this

slide-26
SLIDE 26

Extension to Many Graphs

  • Store successive refinements of a graph’s

degree partition in a tree structure

  • When testing a new graph, try to match its

partition refinements to existing branches (only possible at backtracking nodes)

  • If no branch can be matched, the graph is not

isomorphic and should be added to the tree down a new set of branches

slide-27
SLIDE 27

Summary

  • GP can have a large number of duplicated

graphs in the output set

  • Presa’s algorithm compares pairs of graphs,

taking good points from direct and canonical form methods

  • An adaptation of this algorithm can reduce

GP’s output set to a smaller set which is simpler for the user