Interface NormalisedIntGraph
-
- All Superinterfaces:
java.lang.Cloneable
- All Known Subinterfaces:
Graph<V>
- All Known Implementing Classes:
GraphImplLinearEdge,GraphImplLinearEdgeImportOptimised,GraphImplQuadratic,NormalisedIntGraphImplQuadratic
public interface NormalisedIntGraph extends java.lang.CloneableAssumes that all nodes are normalised, i.e. their indices are [0..n-1]- Author:
- sander
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddEdge(int normalisedSource, int normalisedTarget, long weight)Adds an edge.NormalisedIntGraphclone()booleancontainsEdge(int normalisedSource, int normalisedTarget)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; The edges that are returned are indices.java.lang.Iterable<java.lang.Long>getEdgesOf(int normalisedNode)Return an iterable of edgeIndex containing all edges of which v is a source or a target.intgetEdgeSourceIndex(long edgeIndex)Returns the vertex the edgeIndex comes from.intgetEdgeTargetIndex(long edgeIndex)Returns the index of the vertex the edgeIndex points to.longgetEdgeWeight(int normalisedSource, int normalisedTarget)Returns the weight of an edge between source and target.longgetEdgeWeight(long edgeIndex)Returns the weight of an edge.java.lang.Iterable<java.lang.Long>getIncomingEdgesOf(int normalisedNode)Returns an array of edge index, containing all edges of which v is the target.java.lang.Iterable<java.lang.Long>getOutgoingEdgesOf(int normalisedNode)Returns an array of edge index, containing all edges of which v is the source.longgetWeightOfHeaviestEdge()Returns the weight of the edge with the highest weight.
-
-
-
Method Detail
-
addEdge
void addEdge(int normalisedSource, int normalisedTarget, long weight)Adds an edge. If the weight becomes 0, the edge is removed.- Parameters:
normalisedSource-normalisedTarget-weight-
-
getEdges
java.lang.Iterable<java.lang.Long> getEdges()
Gives an iterable that iterates over all edges; The edges that are returned are indices. Notice that the edge weight might NOT be 0.- Returns:
-
containsEdge
boolean containsEdge(int normalisedSource, int normalisedTarget)Returns whether the graph contains an edge between source and target.- Returns:
-
getEdgeSourceIndex
int getEdgeSourceIndex(long edgeIndex)
Returns the vertex the edgeIndex comes from.- Parameters:
edgeIndex-- Returns:
-
getEdgeTargetIndex
int getEdgeTargetIndex(long edgeIndex)
Returns the index of the vertex the edgeIndex points to.- Parameters:
edgeIndex-- Returns:
-
getEdgeWeight
long getEdgeWeight(int normalisedSource, int normalisedTarget)Returns the weight of an edge between source and target.- Parameters:
normalisedSource-normalisedTarget-- Returns:
-
getIncomingEdgesOf
java.lang.Iterable<java.lang.Long> getIncomingEdgesOf(int normalisedNode)
Returns an array of edge index, containing all edges of which v is the target. Notice that the edge weight might be 0.- Parameters:
normalisedNode-- Returns:
-
getOutgoingEdgesOf
java.lang.Iterable<java.lang.Long> getOutgoingEdgesOf(int normalisedNode)
Returns an array of edge index, containing all edges of which v is the source. Notice that the edge weight might be 0.- Parameters:
normalisedNode-- Returns:
-
getEdgesOf
java.lang.Iterable<java.lang.Long> getEdgesOf(int normalisedNode)
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:
normalisedNode-- Returns:
-
getWeightOfHeaviestEdge
long getWeightOfHeaviestEdge()
Returns the weight of the edge with the highest weight.- Returns:
-
getEdgeWeight
long getEdgeWeight(long edgeIndex)
Returns the weight of an edge.- Parameters:
edgeIndex-- Returns:
-
clone
NormalisedIntGraph clone()
-
-