Class GraphImplQuadratic<V>
- java.lang.Object
-
- org.processmining.plugins.InductiveMiner.graphs.GraphImplQuadratic<V>
-
- All Implemented Interfaces:
java.lang.Cloneable,Graph<V>,NormalisedIntGraph
public class GraphImplQuadratic<V> extends java.lang.Object implements Graph<V>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classGraphImplQuadratic.EdgeIterator
-
Constructor Summary
Constructors Constructor Description GraphImplQuadratic(java.lang.Class<?> clazz)GraphImplQuadratic(java.lang.Class<?> clazz, int initialSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEdge(int source, int target, long weight)Adds an edge.voidaddEdge(V source, V target, long weight)Adds an edge.voidaddVertex(int vertexIndex)intaddVertex(V x)Add a vertex to the graph.voidaddVertices(java.util.Collection<V> xs)voidaddVertices(V[] xs)Graph<V>clone()booleancontainsEdge(int source, int target)Returns whether the graph contains an edge between source and target.booleancontainsEdge(V source, V target)Returns whether the graph contains an edge between source and target.java.lang.Iterable<java.lang.Long>getEdges()Gives an iterable that iterates over all edges that have a weight greater than 0; The edges that returns are indices.java.lang.Iterable<java.lang.Long>getEdgesOf(int indexOfV)Return an iterable of edgeIndex containing all edges of which v is a source or a target.java.lang.Iterable<java.lang.Long>getEdgesOf(V v)Return an array of edgeIndex containing all edges of which v is a source or a target.VgetEdgeSource(long edgeIndex)Returns the vertex the edgeIndex comes from.intgetEdgeSourceIndex(long edgeIndex)Returns the vertex the edgeIndex comes from.VgetEdgeTarget(long edgeIndex)Returns the vertex the edgeIndex points to.intgetEdgeTargetIndex(long edgeIndex)Returns the index of the vertex the edgeIndex points to.longgetEdgeWeight(int source, int target)Returns the weight of an edge between source and target.longgetEdgeWeight(long edgeIndex)Returns the weight of an edge.longgetEdgeWeight(V source, V target)Returns the weight of an edge.java.lang.Iterable<java.lang.Long>getIncomingEdgesOf(int v)Returns an array of edge index, containing all edges of which v is the target.java.lang.Iterable<java.lang.Long>getIncomingEdgesOf(V v)Returns an array of edge index, containing all edges of which v is the target.intgetIndexOfVertex(V v)intgetNumberOfVertices()java.lang.Iterable<java.lang.Long>getOutgoingEdgesOf(int v)Returns an array of edge index, containing all edges of which v is the source.java.lang.Iterable<java.lang.Long>getOutgoingEdgesOf(V v)Returns an array of edge index, containing all edges of which v is the source.int[]getVertexIndices()VgetVertexOfIndex(int index)V[]getVertices()longgetWeightOfHeaviestEdge()Returns the weight of the edge with the highest weight.voidremoveEdge(long edge)
-
-
-
Method Detail
-
addVertex
public int addVertex(V x)
Description copied from interface:GraphAdd a vertex to the graph. Has no effect if the vertex is already in the graph. Returns the index of the inserted vertex.
-
addVertices
public void addVertices(java.util.Collection<V> xs)
- Specified by:
addVerticesin interfaceGraph<V>
-
addVertices
public void addVertices(V[] xs)
- Specified by:
addVerticesin interfaceGraph<V>
-
addEdge
public void addEdge(int source, int target, long weight)Description copied from interface:NormalisedIntGraphAdds an edge. If the weight becomes 0, the edge is removed.- Specified by:
addEdgein interfaceNormalisedIntGraph
-
addEdge
public void addEdge(V source, V target, long weight)
Description copied from interface:GraphAdds an edge. If the weight becomes 0, the edge is removed. Use the integer variant if possible.
-
removeEdge
public void removeEdge(long edge)
-
getVertexOfIndex
public V getVertexOfIndex(int index)
- Specified by:
getVertexOfIndexin interfaceGraph<V>
-
getIndexOfVertex
public int getIndexOfVertex(V v)
- Specified by:
getIndexOfVertexin interfaceGraph<V>- Returns:
- the index of the given vertex
-
getVertices
public V[] getVertices()
- Specified by:
getVerticesin interfaceGraph<V>
-
getVertexIndices
public int[] getVertexIndices()
- Specified by:
getVertexIndicesin interfaceGraph<V>
-
getNumberOfVertices
public int getNumberOfVertices()
- Specified by:
getNumberOfVerticesin interfaceGraph<V>
-
getEdges
public java.lang.Iterable<java.lang.Long> getEdges()
Gives an iterable that iterates over all edges that have a weight greater than 0; The edges that returns are indices.- Specified by:
getEdgesin interfaceNormalisedIntGraph- Returns:
-
containsEdge
public boolean containsEdge(V source, V target)
Returns whether the graph contains an edge between source and target.- Specified by:
containsEdgein interfaceGraph<V>- Returns:
-
containsEdge
public boolean containsEdge(int source, int target)Returns whether the graph contains an edge between source and target.- Specified by:
containsEdgein interfaceNormalisedIntGraph- Returns:
-
getEdgeSource
public V getEdgeSource(long edgeIndex)
Returns the vertex the edgeIndex comes from.- Specified by:
getEdgeSourcein interfaceGraph<V>- Parameters:
edgeIndex-- Returns:
-
getEdgeSourceIndex
public int getEdgeSourceIndex(long edgeIndex)
Description copied from interface:NormalisedIntGraphReturns the vertex the edgeIndex comes from.- Specified by:
getEdgeSourceIndexin interfaceNormalisedIntGraph- Returns:
-
getEdgeTarget
public V getEdgeTarget(long edgeIndex)
Returns the vertex the edgeIndex points to.- Specified by:
getEdgeTargetin interfaceGraph<V>- Parameters:
edgeIndex-- Returns:
-
getEdgeTargetIndex
public int getEdgeTargetIndex(long edgeIndex)
Description copied from interface:NormalisedIntGraphReturns the index of the vertex the edgeIndex points to.- Specified by:
getEdgeTargetIndexin interfaceNormalisedIntGraph- Returns:
-
getEdgeWeight
public long getEdgeWeight(long edgeIndex)
Returns the weight of an edge.- Specified by:
getEdgeWeightin interfaceNormalisedIntGraph- Parameters:
edgeIndex-- Returns:
-
getEdgeWeight
public long getEdgeWeight(int source, int target)Description copied from interface:NormalisedIntGraphReturns the weight of an edge between source and target.- Specified by:
getEdgeWeightin interfaceNormalisedIntGraph- Returns:
-
getEdgeWeight
public long getEdgeWeight(V source, V target)
Returns the weight of an edge.- Specified by:
getEdgeWeightin interfaceGraph<V>- Parameters:
source-target-- Returns:
-
getIncomingEdgesOf
public java.lang.Iterable<java.lang.Long> getIncomingEdgesOf(V v)
Returns an array of edge index, containing all edges of which v is the target.- Specified by:
getIncomingEdgesOfin interfaceGraph<V>- Parameters:
v-- Returns:
-
getIncomingEdgesOf
public java.lang.Iterable<java.lang.Long> getIncomingEdgesOf(int v)
Description copied from interface:NormalisedIntGraphReturns an array of edge index, containing all edges of which v is the target. Notice that the edge weight might be 0.- Specified by:
getIncomingEdgesOfin interfaceNormalisedIntGraph- Returns:
-
getOutgoingEdgesOf
public java.lang.Iterable<java.lang.Long> getOutgoingEdgesOf(V v)
Returns an array of edge index, containing all edges of which v is the source.- Specified by:
getOutgoingEdgesOfin interfaceGraph<V>- Parameters:
v-- Returns:
-
getOutgoingEdgesOf
public java.lang.Iterable<java.lang.Long> getOutgoingEdgesOf(int v)
Description copied from interface:NormalisedIntGraphReturns an array of edge index, containing all edges of which v is the source. Notice that the edge weight might be 0.- Specified by:
getOutgoingEdgesOfin interfaceNormalisedIntGraph- Returns:
-
getEdgesOf
public java.lang.Iterable<java.lang.Long> getEdgesOf(V v)
Return an array of edgeIndex containing all edges of which v is a source or a target.- Specified by:
getEdgesOfin interfaceGraph<V>- Parameters:
v-- Returns:
-
getEdgesOf
public java.lang.Iterable<java.lang.Long> getEdgesOf(int indexOfV)
Description copied from interface:NormalisedIntGraphReturn an iterable of edgeIndex containing all edges of which v is a source or a target. Notice that the edge weight might be 0.- Specified by:
getEdgesOfin interfaceNormalisedIntGraph- Returns:
-
getWeightOfHeaviestEdge
public long getWeightOfHeaviestEdge()
Returns the weight of the edge with the highest weight.- Specified by:
getWeightOfHeaviestEdgein interfaceNormalisedIntGraph- Returns:
-
clone
public Graph<V> clone()
- Specified by:
clonein interfaceGraph<V>- Specified by:
clonein interfaceNormalisedIntGraph- Overrides:
clonein classjava.lang.Object- Returns:
- A copy of the graph that is not connected to this graph. Should not clone the vertices themselves.
-
addVertex
public void addVertex(int vertexIndex)
-
-