Package org.jgrapht.alg.isomorphism
Class IsomorphicGraphMapping<V,E>
- java.lang.Object
-
- org.jgrapht.alg.isomorphism.IsomorphicGraphMapping<V,E>
-
- Type Parameters:
V
- the type of the verticesE
- 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.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int[]
core1
(package private) int[]
core2
(package private) GraphOrdering<V,E>
g1
(package private) GraphOrdering<V,E>
g2
-
Constructor Summary
Constructors Constructor Description IsomorphicGraphMapping(GraphOrdering<V,E> g1, GraphOrdering<V,E> g2, int[] core1, int[] core2)
Construct a new isomorphic graph mapping
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description E
getEdgeCorrespondence(E e, boolean forward)
Gets the mapped value where the key isedge
V
getVertexCorrespondence(V v, boolean forward)
Gets the mapped value where the key isvertex
boolean
hasEdgeCorrespondence(E e)
Checks if a edge e from the first graph has a corresponding edge in the second graphboolean
hasVertexCorrespondence(V v)
Checks if a vertex v from the first graph has a corresponding vertex in the second graphboolean
isEqualMapping(GraphMapping<V,E> rel)
Checks for equality.java.lang.String
toString()
-
-
-
Field Detail
-
g1
GraphOrdering<V,E> g1
-
g2
GraphOrdering<V,E> g2
-
core1
int[] core1
-
core2
int[] core2
-
-
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 graphg2
- the second graph which is a possible subgraph of g1core1
- 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 isvertex
- Specified by:
getVertexCorrespondence
in interfaceGraphMapping<V,E>
- Parameters:
v
- vertex in one of the graphsforward
- 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 isedge
- Specified by:
getEdgeCorrespondence
in interfaceGraphMapping<V,E>
- Parameters:
e
- edge in one of the graphsforward
- 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 classjava.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
-
-