|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface UndirectedLongGraph
An undirected weighted graph.
Nested Class Summary | |
---|---|
static interface |
UndirectedLongGraph.Edge
A possible edge connecting two vertices of an underlying UndirectedLongGraph . |
Field Summary | |
---|---|
static double |
DEFAULT_UNCONNECTED_WEIGHT
The default weight for two not connected vertices. |
Method Summary | |
---|---|
boolean |
addVertex(long vertex)
Adds a vertex to the graph. |
UndirectedLongGraph |
clone()
|
boolean |
containsEdge(long vertexA,
long vertexB)
Checks if there exists an edge in the graph connecting the two vertices given as parameters. |
boolean |
containsVertex(long vertex)
Checks if given vertex is contained in the graph. |
UndirectedLongGraph.Edge |
getEdge(long vertexA,
long vertexB)
Returns the Edge connecting the two vertices. |
java.util.Iterator<? extends UndirectedLongGraph.Edge> |
getEdges()
Returns an iterator over all edges of the graph. |
java.util.Iterator<? extends UndirectedLongGraph.Edge> |
getEdgesConnectedTo(long vertex)
Returns an iterator over all edges in the graph to which given vertex is connected to. |
double |
getEdgeWeight(long vertexA,
long vertexB)
Returns the weight of the edge connecting the two vertices. |
double |
getMass(long vertex)
Returns the sum of the weights of all edges connected to given vertex. |
int |
getNumberOfEdges()
Returns the number of edges. |
int |
getNumberOfEdgesConnectedTo(long vertex)
Returns the number of edges connected to given vertex. |
int |
getNumberOfVertices()
Returns the number of vertices. |
double |
getUnconnectedWeight()
Returns the default weight for unconnected vertices. |
long[] |
getVertices()
Returns an array containing all current vertices of this graph. |
long[] |
getVerticesConnectedTo(long vertex)
Returns an array containing all vertices that are connected with given vertex at the moment of this call. |
double |
removeEdge(long vertexA,
long vertexB)
Removes an edge determined by two vertices. |
boolean |
removeVertex(long vertex)
Removes a vertex from the graph. |
double |
setEdgeWeight(long vertexA,
long vertexB,
double weight)
Sets the weight of a edge determined by two vertices. |
void |
setUnconnectedWeight(double unconnectedWeight)
Change the weight that is returned by getEdgeWeight(long, long) if the two vertices are not connected. |
Field Detail |
---|
static final double DEFAULT_UNCONNECTED_WEIGHT
Method Detail |
---|
void setUnconnectedWeight(double unconnectedWeight)
unconnectedWeight
- the new weight for unconnected vertices.getEdgeWeight(long, long)
,
getUnconnectedWeight()
double getUnconnectedWeight()
Returns the default weight for unconnected vertices.
The method getEdgeWeight(long, long) returns a double value for any possible edge connecting two vertices in the graph. If an edge does not exist, the method will return this value.
getEdgeWeight(long, long)
,
setUnconnectedWeight(double)
int getNumberOfVertices()
int getNumberOfEdges()
int getNumberOfEdgesConnectedTo(long vertex) throws java.util.NoSuchElementException
vertex
- which vertex to count edges of.
java.util.NoSuchElementException
- if the vertex is not part of the
graph.boolean addVertex(long vertex)
vertex
- the vertex to be added.
boolean removeVertex(long vertex)
vertex
- the vertex to be removed.
long[] getVertices()
getNumberOfVertices()
long[] getVerticesConnectedTo(long vertex) throws java.util.NoSuchElementException
vertex
- the vertex.
java.util.NoSuchElementException
- If the vertex is not part of the graph.#getNumberOfEdges(long)
double getMass(long vertex) throws java.util.NoSuchElementException
vertex
- the vertex.
java.util.NoSuchElementException
- if the vertex is not part of the
graph.double setEdgeWeight(long vertexA, long vertexB, double weight) throws java.util.NoSuchElementException
vertexA
- one vertex of the edge.vertexB
- the other vertex of the edge.weight
- the new weight of the edge.
java.util.NoSuchElementException
- if at least one of the two vertices is
not a part of the graph (see containsVertex(long)
).getUnconnectedWeight()
,
getEdgeWeight(long, long)
,
removeEdge(long, long)
double removeEdge(long vertexA, long vertexB) throws java.util.NoSuchElementException
vertexA
- one vertex of the edge.vertexB
- the other vertex of the edge.
java.util.NoSuchElementException
- if at least one of the two vertices is
not a part of the graph.getUnconnectedWeight()
,
getEdgeWeight(long, long)
,
setEdgeWeight(long, long, double)
java.util.Iterator<? extends UndirectedLongGraph.Edge> getEdges()
getNumberOfEdges()
java.util.Iterator<? extends UndirectedLongGraph.Edge> getEdgesConnectedTo(long vertex) throws java.util.NoSuchElementException
vertex
- the vertex.
java.util.NoSuchElementException
- if the vertex is not part of the graph.#getNumberOfEdges(long)
boolean containsVertex(long vertex)
vertex
- the vertex to look for.
boolean containsEdge(long vertexA, long vertexB) throws java.util.NoSuchElementException
vertexA
- one vertex.vertexB
- the other vertex.
java.util.NoSuchElementException
- if at least one of the vertices is not
part of the graph.double getEdgeWeight(long vertexA, long vertexB) throws java.util.NoSuchElementException
vertexA
- one vertex.vertexB
- the other vertex.
java.util.NoSuchElementException
- if at least one of the vertices is not
part of the graph.containsEdge(long, long)
,
getEdge(long, long)
,
getUnconnectedWeight()
UndirectedLongGraph.Edge getEdge(long vertexA, long vertexB) throws java.util.NoSuchElementException
vertexA
- one vertex.vertexB
- the other vertex.
java.util.NoSuchElementException
- if at least one of the vertices is not
part of the graph.UndirectedLongGraph.Edge
,
containsEdge(long, long)
,
getEdgeWeight(long, long)
,
UndirectedLongGraph.Edge.exists()
UndirectedLongGraph clone()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |