Class IsomorphicGraphMapping<V,​E>

  • Type Parameters:
    V - the type of the vertices
    E - the type of the edges
    All Implemented Interfaces:
    GraphMapping<V,​E>

    public class IsomorphicGraphMapping<V,​E>
    extends java.lang.Object
    implements GraphMapping<V,​E>
    This class represents a GraphMapping between two (subgraph)isomorphic graphs. In the subgraph isomorphic case, the second one is assumed to be a subgraph of the first one.
    • Constructor Detail

      • IsomorphicGraphMapping

        public IsomorphicGraphMapping​(GraphOrdering<V,​E> g1,
                                      GraphOrdering<V,​E> g2,
                                      int[] core1,
                                      int[] core2)
        Construct a new isomorphic graph mapping
        Parameters:
        g1 - the first graph
        g2 - the second graph which is a possible subgraph of g1
        core1 - the mapping as array (forwards)
        core2 - the mapping as array (backwards)
    • Method Detail

      • getVertexCorrespondence

        public V getVertexCorrespondence​(V v,
                                         boolean forward)
        Description copied from interface: GraphMapping
        Gets the mapped value where the key is vertex
        Specified by:
        getVertexCorrespondence in interface GraphMapping<V,​E>
        Parameters:
        v - vertex in one of the graphs
        forward - if true, uses mapping from graph1 to graph2; if false, use mapping from graph2 to graph1
        Returns:
        corresponding vertex in other graph, or null if none
      • getEdgeCorrespondence

        public E getEdgeCorrespondence​(E e,
                                       boolean forward)
        Description copied from interface: GraphMapping
        Gets the mapped value where the key is edge
        Specified by:
        getEdgeCorrespondence in interface GraphMapping<V,​E>
        Parameters:
        e - edge in one of the graphs
        forward - if true, uses mapping from graph1 to graph2; if false, use mapping from graph2 to graph1
        Returns:
        corresponding edge in other graph, or null if none
      • hasVertexCorrespondence

        public boolean hasVertexCorrespondence​(V v)
        Checks if a vertex v from the first graph has a corresponding vertex in the second graph
        Parameters:
        v - the vertex
        Returns:
        is there a corresponding vertex to v in the subgraph
      • hasEdgeCorrespondence

        public boolean hasEdgeCorrespondence​(E e)
        Checks if a edge e from the first graph has a corresponding edge in the second graph
        Parameters:
        e - the edge
        Returns:
        is there a corresponding edge to e in the subgraph
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isEqualMapping

        public boolean isEqualMapping​(GraphMapping<V,​E> rel)
        Checks for equality. Assuming both are mappings on the same graphs.
        Parameters:
        rel - the corresponding mapping
        Returns:
        do both relations map to the same vertices