Class Isomorphism

java.lang.Object
org.graph4j.isomorphism.Isomorphism

public class Isomorphism extends Object
An immutable one-to-one correspondence (bijection) between the vertices of two graphs that preserves the edge connections. Objects of this class are created by algorithms that find tan isomorphism between two graphs.
Author:
Ignat Gabriel-Andrei, Cristian Frasinaru
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Isomorphism(Graph graph1, Graph graph2, int[] mapping, int[] inverse)
    Creates an isomorphism between two graphs.
  • Method Summary

    Modifier and Type
    Method
    Description
    int[]
    Returns a copy of the inverse mapping between the second graph and the first graph.
    int
    inverse(int u)
    Returns the inverse mapping of a vertex number in the second graph.
    boolean
    Checks if the current mapping is a valid isomorphism, i.e. it is a bijection between vertices that preserves the edges.
    int[]
    Returns a copy of the mapping between the first graph and the second graph.
    int
    mapping(int v)
    Returns the mapping of a vertex number in the first graph.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Isomorphism

      public Isomorphism(Graph graph1, Graph graph2, int[] mapping, int[] inverse)
      Creates an isomorphism between two graphs. If (@code mapping[i]=v} then the vertex with index i in the first graph is mapped to the vertex with number v in the second graph. If (@code inverse[j]=u} then the vertex with index j in the second graph is mapped to the vertex with number u in the first graph.
      Parameters:
      graph1 - the first graph.
      graph2 - the second graph.
      mapping - the correspondence between the vertices in the first graph and the second graph.
      inverse - the correspondence between the vertices in the second graph and the first graph.
  • Method Details

    • mapping

      public int[] mapping()
      Returns a copy of the mapping between the first graph and the second graph.
      Returns:
      the correspondence between the vertices in the first graph and the second graph.
    • mapping

      public int mapping(int v)
      Returns the mapping of a vertex number in the first graph.
      Parameters:
      v - a vertex number in the first graph.
      Returns:
      the vertex number in the second graph to which v is mapped to.
    • inverse

      public int[] inverse()
      Returns a copy of the inverse mapping between the second graph and the first graph.
      Returns:
      the correspondence between the vertices in the second graph and the first graph.
    • inverse

      public int inverse(int u)
      Returns the inverse mapping of a vertex number in the second graph.
      Parameters:
      u - a vertex number in the second graph.
      Returns:
      the vertex number in the first graph to which u is mapped to.
    • isValid

      public boolean isValid()
      Checks if the current mapping is a valid isomorphism, i.e. it is a bijection between vertices that preserves the edges.
      Returns:
      true if the current mapping is a valid isomorphism, false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object