Interface Graph<V>
-
- All Superinterfaces:
java.lang.Cloneable,NormalisedIntGraph
- All Known Implementing Classes:
GraphImplLinearEdge,GraphImplLinearEdgeImportOptimised,GraphImplQuadratic
public interface Graph<V> extends NormalisedIntGraph
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddEdge(V source, V target, long weight)Adds an edge.intaddVertex(V x)Add a vertex to the graph.voidaddVertices(java.util.Collection<V> xs)voidaddVertices(V[] xs)Graph<V>clone()booleancontainsEdge(V source, V target)Returns whether the graph contains an edge between source and target.java.lang.Iterable<java.lang.Long>getEdgesOf(V v)Return an iterable of edgeIndex containing all edges of which v is a source or a target.VgetEdgeSource(long edgeIndex)Returns the vertex the edgeIndex comes from.VgetEdgeTarget(long edgeIndex)Returns the vertex the edgeIndex points to.longgetEdgeWeight(V source, V target)Returns the weight of an edge.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(V v)Returns an array of edge index, containing all edges of which v is the source.int[]getVertexIndices()VgetVertexOfIndex(int index)V[]getVertices()-
Methods inherited from interface org.processmining.plugins.inductiveminer2.helperclasses.normalised.NormalisedIntGraph
addEdge, containsEdge, getEdges, getEdgesOf, getEdgeSourceIndex, getEdgeTargetIndex, getEdgeWeight, getEdgeWeight, getIncomingEdgesOf, getOutgoingEdgesOf, getWeightOfHeaviestEdge
-
-
-
-
Method Detail
-
addVertex
int addVertex(V x)
Add a vertex to the graph. Has no effect if the vertex is already in the graph. Returns the index of the inserted vertex.- Parameters:
x-
-
addVertices
void addVertices(java.util.Collection<V> xs)
-
addVertices
void addVertices(V[] xs)
-
addEdge
void addEdge(V source, V target, long weight)
Adds an edge. If the weight becomes 0, the edge is removed. Use the integer variant if possible.- Parameters:
source-target-weight-
-
getVertexOfIndex
V getVertexOfIndex(int index)
-
getVertices
V[] getVertices()
-
getVertexIndices
int[] getVertexIndices()
-
getNumberOfVertices
int getNumberOfVertices()
-
containsEdge
boolean containsEdge(V source, V target)
Returns whether the graph contains an edge between source and target.- Returns:
-
getEdgeSource
V getEdgeSource(long edgeIndex)
Returns the vertex the edgeIndex comes from.- Parameters:
edgeIndex-- Returns:
-
getEdgeTarget
V getEdgeTarget(long edgeIndex)
Returns the vertex the edgeIndex points to.- Parameters:
edgeIndex-- Returns:
-
getEdgeWeight
long getEdgeWeight(V source, V target)
Returns the weight of an edge.- Parameters:
source-target-- Returns:
-
getIncomingEdgesOf
java.lang.Iterable<java.lang.Long> getIncomingEdgesOf(V v)
Returns an array of edge index, containing all edges of which v is the target. Notice that the edge weight might be 0.- Parameters:
v-- Returns:
-
getOutgoingEdgesOf
java.lang.Iterable<java.lang.Long> getOutgoingEdgesOf(V v)
Returns an array of edge index, containing all edges of which v is the source.- Parameters:
v-- Returns:
-
getEdgesOf
java.lang.Iterable<java.lang.Long> getEdgesOf(V v)
Return an iterable of edgeIndex containing all edges of which v is a source or a target. Notice that the edge weight might be 0.- Parameters:
v-- Returns:
-
getIndexOfVertex
int getIndexOfVertex(V v)
- Parameters:
v-- Returns:
- the index of the given vertex
-
clone
Graph<V> clone()
- Specified by:
clonein interfaceNormalisedIntGraph- Returns:
- A copy of the graph that is not connected to this graph. Should not clone the vertices themselves.
-
-