public class GraphImplQuadratic<V> extends java.lang.Object implements Graph<V>
Modifier and Type | Class and Description |
---|---|
class |
GraphImplQuadratic.EdgeIterator |
Constructor and Description |
---|
GraphImplQuadratic(java.lang.Class<?> clazz) |
GraphImplQuadratic(java.lang.Class<?> clazz,
int initialSize) |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(int source,
int target,
long weight)
Adds an edge.
|
void |
addEdge(V source,
V target,
long weight)
Adds an edge.
|
void |
addVertex(int vertexIndex) |
int |
addVertex(V x)
Add a vertex to the graph.
|
void |
addVertices(java.util.Collection<V> xs) |
void |
addVertices(V[] xs) |
Graph<V> |
clone() |
boolean |
containsEdge(int source,
int target)
Returns whether the graph contains an edge between source and target.
|
boolean |
containsEdge(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.
|
V |
getEdgeSource(long edgeIndex)
Returns the vertex the edgeIndex comes from.
|
int |
getEdgeSourceIndex(long edgeIndex)
Returns the vertex the edgeIndex comes from.
|
V |
getEdgeTarget(long edgeIndex)
Returns the vertex the edgeIndex points to.
|
int |
getEdgeTargetIndex(long edgeIndex)
Returns the index of the vertex the edgeIndex points to.
|
long |
getEdgeWeight(int source,
int target)
Returns the weight of an edge between source and target.
|
long |
getEdgeWeight(long edgeIndex)
Returns the weight of an edge.
|
long |
getEdgeWeight(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.
|
int |
getIndexOfVertex(V v) |
int |
getNumberOfVertices() |
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() |
V |
getVertexOfIndex(int index) |
V[] |
getVertices() |
long |
getWeightOfHeaviestEdge()
Returns the weight of the edge with the highest weight.
|
void |
removeEdge(long edge) |
public GraphImplQuadratic(java.lang.Class<?> clazz)
public GraphImplQuadratic(java.lang.Class<?> clazz, int initialSize)
public int addVertex(V x)
Graph
public void addVertices(java.util.Collection<V> xs)
addVertices
in interface Graph<V>
public void addVertices(V[] xs)
addVertices
in interface Graph<V>
public void addEdge(int source, int target, long weight)
NormalisedIntGraph
addEdge
in interface NormalisedIntGraph
public void addEdge(V source, V target, long weight)
Graph
public void removeEdge(long edge)
public V getVertexOfIndex(int index)
getVertexOfIndex
in interface Graph<V>
public int getIndexOfVertex(V v)
getIndexOfVertex
in interface Graph<V>
public V[] getVertices()
getVertices
in interface Graph<V>
public int[] getVertexIndices()
getVertexIndices
in interface Graph<V>
public int getNumberOfVertices()
getNumberOfVertices
in interface Graph<V>
public java.lang.Iterable<java.lang.Long> getEdges()
getEdges
in interface NormalisedIntGraph
public boolean containsEdge(V source, V target)
containsEdge
in interface Graph<V>
public boolean containsEdge(int source, int target)
containsEdge
in interface NormalisedIntGraph
public V getEdgeSource(long edgeIndex)
getEdgeSource
in interface Graph<V>
edgeIndex
- public int getEdgeSourceIndex(long edgeIndex)
NormalisedIntGraph
getEdgeSourceIndex
in interface NormalisedIntGraph
public V getEdgeTarget(long edgeIndex)
getEdgeTarget
in interface Graph<V>
edgeIndex
- public int getEdgeTargetIndex(long edgeIndex)
NormalisedIntGraph
getEdgeTargetIndex
in interface NormalisedIntGraph
public long getEdgeWeight(long edgeIndex)
getEdgeWeight
in interface NormalisedIntGraph
edgeIndex
- public long getEdgeWeight(int source, int target)
NormalisedIntGraph
getEdgeWeight
in interface NormalisedIntGraph
public long getEdgeWeight(V source, V target)
getEdgeWeight
in interface Graph<V>
source
- target
- public java.lang.Iterable<java.lang.Long> getIncomingEdgesOf(V v)
getIncomingEdgesOf
in interface Graph<V>
v
- public java.lang.Iterable<java.lang.Long> getIncomingEdgesOf(int v)
NormalisedIntGraph
getIncomingEdgesOf
in interface NormalisedIntGraph
public java.lang.Iterable<java.lang.Long> getOutgoingEdgesOf(V v)
getOutgoingEdgesOf
in interface Graph<V>
v
- public java.lang.Iterable<java.lang.Long> getOutgoingEdgesOf(int v)
NormalisedIntGraph
getOutgoingEdgesOf
in interface NormalisedIntGraph
public java.lang.Iterable<java.lang.Long> getEdgesOf(V v)
getEdgesOf
in interface Graph<V>
v
- public java.lang.Iterable<java.lang.Long> getEdgesOf(int indexOfV)
NormalisedIntGraph
getEdgesOf
in interface NormalisedIntGraph
public long getWeightOfHeaviestEdge()
getWeightOfHeaviestEdge
in interface NormalisedIntGraph
public Graph<V> clone()
clone
in interface Graph<V>
clone
in interface NormalisedIntGraph
clone
in class java.lang.Object
public void addVertex(int vertexIndex)