java.lang.Object
org.jgrapht.alg.isomorphism.GraphOrdering<V,E>
- Type Parameters:
V
- the type of the verticesE
- the type of the edges
This class represents the order on the graph vertices. There are also some helper-functions for
receiving outgoing/incoming edges, etc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]
if caching is enabled, adjMatrix contains cached information on existing edges, valid values: 0 - no cached value 1 - edge exists -1 - no edge existsprivate final boolean
private final E[]
private final int[][]
private final int[][]
private final int
-
Constructor Summary
ConstructorsConstructorDescriptionGraphOrdering
(Graph<V, E> graph) GraphOrdering
(Graph<V, E> graph, boolean orderByDegree, boolean cacheEdges) -
Method Summary
Modifier and TypeMethodDescriptiongetEdge
(int v1Number, int v2Number) int[]
getEdgeNumbers
(E e) getGraph()
int[]
getInEdges
(int vertexNumber) int[]
getOutEdges
(int vertexNumber) getVertex
(int vertexNumber) be careful: there's no check against an invalid vertexNumberint
int
getVertexNumber
(V v) boolean
hasEdge
(int v1Number, int v2Number)
-
Field Details
-
graph
-
mapVertexToOrder
-
mapOrderToVertex
-
vertexCount
private final int vertexCount -
outgoingEdges
private final int[][] outgoingEdges -
incomingEdges
private final int[][] incomingEdges -
edgeCache
-
adjMatrix
private final byte[] adjMatrixif caching is enabled, adjMatrix contains cached information on existing edges, valid values:- 0 - no cached value
- 1 - edge exists
- -1 - no edge exists
-
cacheEdges
private final boolean cacheEdges
-
-
Constructor Details
-
GraphOrdering
- Parameters:
graph
- the graph to be orderedorderByDegree
- should the vertices be ordered by their degree. This speeds up the VF2 algorithm.cacheEdges
- if true, the class creates a adjacency matrix and two arrays for incoming and outgoing edges for fast access.
-
GraphOrdering
- Parameters:
graph
- the graph to be ordered
-
-
Method Details
-
getVertexCount
public int getVertexCount()- Returns:
- returns the number of vertices in the graph.
-
getOutEdges
public int[] getOutEdges(int vertexNumber) - Parameters:
vertexNumber
- the number which identifies the vertex $v$ in this order.- Returns:
- the identifying numbers of all vertices which are connected to $v$ by an edge outgoing from $v$.
-
getInEdges
public int[] getInEdges(int vertexNumber) - Parameters:
vertexNumber
- the number which identifies the vertex $v$ in this order.- Returns:
- the identifying numbers of all vertices which are connected to $v$ by an edge incoming to $v$.
-
hasEdge
public boolean hasEdge(int v1Number, int v2Number) - Parameters:
v1Number
- the number of the first vertex $v_1$v2Number
- the number of the second vertex $v_2$- Returns:
- exists the edge from $v_1$ to $v_2$
-
getVertex
be careful: there's no check against an invalid vertexNumber- Parameters:
vertexNumber
- the number identifying the vertex $v$- Returns:
- $v$
-
getEdge
- Parameters:
v1Number
- the number identifying the vertex $v_1$v2Number
- the number identifying the vertex $v_2$- Returns:
- the edge from $v_1$ to $v_2$
-
getVertexNumber
-
getEdgeNumbers
-
getGraph
-