Package org.jgrapht.alg.isomorphism
Class GraphOrdering<V,E>
- java.lang.Object
-
- org.jgrapht.alg.isomorphism.GraphOrdering<V,E>
-
- Type Parameters:
V- the type of the verticesE- the type of the edges
class GraphOrdering<V,E> extends java.lang.ObjectThis class represents the order on the graph vertices. There are also some helper-functions for receiving outgoing/incoming edges, etc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classGraphOrdering.GeneralVertexDegreeComparator<V2>
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Boolean[][]adjMatrixprivate booleancacheEdgesprivate Graph<V,E>graphprivate int[][]incomingEdgesprivate java.util.ArrayList<V>mapOrderToVertexprivate java.util.Map<V,java.lang.Integer>mapVertexToOrderprivate int[][]outgoingEdgesprivate intvertexCount
-
Constructor Summary
Constructors Constructor Description GraphOrdering(Graph<V,E> graph)GraphOrdering(Graph<V,E> graph, boolean orderByDegree, boolean cacheEdges)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EgetEdge(int v1Number, int v2Number)int[]getEdgeNumbers(E e)Graph<V,E>getGraph()int[]getInEdges(int vertexNumber)int[]getOutEdges(int vertexNumber)VgetVertex(int vertexNumber)be careful: there's no check against an invalid vertexNumberintgetVertexCount()intgetVertexNumber(V v)booleanhasEdge(int v1Number, int v2Number)
-
-
-
Field Detail
-
mapVertexToOrder
private java.util.Map<V,java.lang.Integer> mapVertexToOrder
-
mapOrderToVertex
private java.util.ArrayList<V> mapOrderToVertex
-
vertexCount
private int vertexCount
-
outgoingEdges
private int[][] outgoingEdges
-
incomingEdges
private int[][] incomingEdges
-
adjMatrix
private java.lang.Boolean[][] adjMatrix
-
cacheEdges
private boolean cacheEdges
-
-
Constructor Detail
-
GraphOrdering
public GraphOrdering(Graph<V,E> graph, boolean orderByDegree, boolean cacheEdges)
- 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.
-
-
Method Detail
-
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 v1v2Number- the number of the second vertex v2- Returns:
- exists the edge from v1 to v2
-
getVertex
public V getVertex(int vertexNumber)
be careful: there's no check against an invalid vertexNumber- Parameters:
vertexNumber- the number identifying the vertex v- Returns:
- v
-
getEdge
public E getEdge(int v1Number, int v2Number)
- Parameters:
v1Number- the number identifying the vertex v1v2Number- the number identifying the vertex v2- Returns:
- the edge from v1 to v2
-
getVertexNumber
public int getVertexNumber(V v)
-
getEdgeNumbers
public int[] getEdgeNumbers(E e)
-
-