the gp language
play

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


  1. A Graph Isomorphism Filter for the GP Language Philip Cavanagh

  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:

  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:

  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

  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

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

  7. GP Example: Rule Application link

  8. GP Example: Output Graphs

  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

  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

  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

  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

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

  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 P 0 = ({0,1,2,3,4,5,6,7}) • Repeatedly refine the partition using (in order of preference): – Vertex refinement – Set refinement – Backtrack refinement

  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 • P 1 = ({0,2,7},{3,4,5,6})

  16. Set Refinement • Now that we have two cells, we can try to split them based on their adjacencies with each other. • P 1 = ({0,2,7},{3,4,5,6}) • We use cell 1 to try to split both of the cells of P 1 • P 2 = ({2,7},{0},{6},{3,4},{5})

  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 • P 2 = ({2,7},{0},{6},{3,4},{5}) • We choose a vertex (e.g. 0) and split the other cells with it • P 3 = ({2,7},{6},{4},{3},{5})

  18. Vertex Refinement (II) • P 3 = ({2,7},{6},{4},{3},{5}) • We can use vertex refinement again, this time using vertex 6: • P 4 = ({7},{2},{4},{3},{5})

  19. Obtaining the ordering for G • We now have a partition of single vertex cells: P 4 = ({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)

  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 Q 0 = ({0,1,2,3,4,5,6,7})

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

  22. Backtracking • Q 2 = ({1,2},{7},{3,4,5,6}), while P 2 = ({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: • Q 1 = ({0,2,4},{3,5,6,7})

  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 P 1 to P 4 • Q 1 = ({0,2,4},{3,5,6,7}) • Q 2 = ({0,2},{4},{3},{5,7},{6}) • Q 3 = ({0,2},{3},{5},{7},{6}) • Q 4 = ({2},{0},{5},{7},{6})

  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

  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

  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

  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

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend