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