|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.aitools.aq.graph.weighted.concrete.ConcreteUndirectedIntGraph
public final class ConcreteUndirectedIntGraph
A general implementation for int vertices. Each weight is stored only once in the graph.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface de.aitools.aq.graph.weighted.UndirectedMutableIntGraph |
---|
UndirectedMutableIntGraph.Edge |
Field Summary |
---|
Fields inherited from interface de.aitools.aq.graph.weighted.UndirectedIntGraph |
---|
DEFAULT_UNCONNECTED_WEIGHT |
Constructor Summary | |
---|---|
ConcreteUndirectedIntGraph()
Deprecated. Create a new ConcreteUndirectedIntGraph with
default weight for unconnected vertices and default capacity. |
|
ConcreteUndirectedIntGraph(double unconnectedWeight,
int initialCapacity)
Deprecated. Create a new ConcreteUndirectedIntGraph . |
|
ConcreteUndirectedIntGraph(int initialCapacity)
Deprecated. Create a new ConcreteUndirectedIntGraph with
default weight for unconnected vertices. |
Method Summary | |
---|---|
boolean |
addVertex(int vertex)
Deprecated. Add a vertex to the graph. |
boolean |
containsEdge(int vertexA,
int vertexB)
Deprecated. Check if there exists an edge in the graph connecting the two vertices given as parameters. |
boolean |
containsVertex(int vertex)
Deprecated. Check if given vertex is contained in the graph. |
java.util.Iterator<? extends UndirectedMutableIntGraph.Edge> |
edges()
Deprecated. Get an iterator over all edges of the graph. |
java.util.Iterator<? extends UndirectedMutableIntGraph.Edge> |
edgesConnectedTo(int vertex)
Deprecated. Get an iterator over all edges in the graph, given vertex is connected with. |
UndirectedMutableIntGraph.Edge |
getEdge(int vertexA,
int vertexB)
Deprecated. Get the UndirectedIntGraph.Edge connecting the two vertices. |
double |
getEdgeWeight(int vertexA,
int vertexB)
Deprecated. Get the weight of the edge connecting the two vertices. |
double |
getUnconnectedWeight()
Deprecated. The method UndirectedIntGraph.getEdgeWeight(int, int) returns a double
value for any possible edge connecting two vertices in the graph. |
int |
numEdges()
Deprecated. Get the number of edges. |
int |
numEdges(int vertex)
Deprecated. |
int |
numVertices()
Deprecated. Get the number of vertices. |
double |
removeEdge(int vertexA,
int vertexB)
Deprecated. Remove a edge determined by two vertices. |
boolean |
removeVertex(int vertex)
Deprecated. Remove a vertex from the graph. |
double |
setEdgeWeight(int vertexA,
int vertexB,
double weight)
Deprecated. Set the weight of a edge determined by two vertices. |
void |
setUnconnectedWeight(double unconnectedWeight)
Deprecated. Change the weight that is returned by UndirectedIntGraph.getEdgeWeight(int, int) if the two vertices are not
connected. |
int[] |
vertices()
Deprecated. Get an array containing all current vertices of this graph. |
int[] |
verticesConnectedTo(int vertex)
Deprecated. Get an array containing all vertices that are connected with given vertex at the moment of this call. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConcreteUndirectedIntGraph()
ConcreteUndirectedIntGraph
with
default weight for unconnected vertices and default capacity.
setUnconnectedWeight(double)
,
ConcreteUndirectedIntGraph(double, int)
public ConcreteUndirectedIntGraph(int initialCapacity)
ConcreteUndirectedIntGraph
with
default weight for unconnected vertices.
initialCapacity
- The initial capacity of vertices (grows
automatically) or a negative value to use a default value.setUnconnectedWeight(double)
,
ConcreteUndirectedIntGraph(double, int)
public ConcreteUndirectedIntGraph(double unconnectedWeight, int initialCapacity)
ConcreteUndirectedIntGraph
.
unconnectedWeight
- The weight for unconnected vertices.
Default is UndirectedGraph#DEFAULT_UNCONNECTED_WEIGHT
.initialCapacity
- The initial capacity of vertices (grows
automatically) or a negative value to use a default value.Method Detail |
---|
public double getUnconnectedWeight()
UndirectedIntGraph
UndirectedIntGraph.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.
getUnconnectedWeight
in interface UndirectedIntGraph
public void setUnconnectedWeight(double unconnectedWeight)
UndirectedMutableIntGraph
UndirectedIntGraph.getEdgeWeight(int, int)
if the two vertices are not
connected. This will remove all edges that currently have
unconnectedWeight as their weight.
setUnconnectedWeight
in interface UndirectedMutableIntGraph
unconnectedWeight
- The new weight for unconnected vertices.public int numVertices()
UndirectedIntGraph
numVertices
in interface UndirectedIntGraph
public int numEdges()
UndirectedIntGraph
numEdges
in interface UndirectedIntGraph
public int numEdges(int vertex)
numEdges
in interface UndirectedIntGraph
vertex
- Which vertex to count edges of.
public int[] vertices()
UndirectedIntGraph
vertices
in interface UndirectedIntGraph
UndirectedIntGraph.numVertices()
public int[] verticesConnectedTo(int vertex)
UndirectedIntGraph
verticesConnectedTo
in interface UndirectedIntGraph
vertex
- The vertex.
UndirectedIntGraph.numEdges(int)
public java.util.Iterator<? extends UndirectedMutableIntGraph.Edge> edges()
UndirectedIntGraph
edges
in interface UndirectedIntGraph
edges
in interface UndirectedMutableIntGraph
UndirectedIntGraph.numEdges()
public java.util.Iterator<? extends UndirectedMutableIntGraph.Edge> edgesConnectedTo(int vertex)
UndirectedIntGraph
edgesConnectedTo
in interface UndirectedIntGraph
edgesConnectedTo
in interface UndirectedMutableIntGraph
vertex
- The vertex.
UndirectedIntGraph.numEdges(int)
public boolean containsVertex(int vertex)
UndirectedIntGraph
containsVertex
in interface UndirectedIntGraph
vertex
- The vertex to look for.
public boolean containsEdge(int vertexA, int vertexB)
UndirectedIntGraph
containsEdge
in interface UndirectedIntGraph
vertexA
- One vertex.vertexB
- The other vertex.
public double getEdgeWeight(int vertexA, int vertexB)
UndirectedIntGraph
UndirectedIntGraph.getUnconnectedWeight()
if the two vertices are not connected.
getEdgeWeight
in interface UndirectedIntGraph
vertexA
- One vertex.vertexB
- The other vertex.
UndirectedIntGraph.getUnconnectedWeight()
.UndirectedIntGraph.containsEdge(int, int)
,
UndirectedIntGraph.getEdge(int, int)
public UndirectedMutableIntGraph.Edge getEdge(int vertexA, int vertexB)
UndirectedIntGraph
UndirectedIntGraph.Edge
connecting the two vertices. The object will also
be returned if there does not exists such an edge in the graph. Use
UndirectedIntGraph.Edge.exists()
to check.
getEdge
in interface UndirectedIntGraph
getEdge
in interface UndirectedMutableIntGraph
vertexA
- One vertex.vertexB
- The other vertex.
UndirectedIntGraph.containsEdge(int, int)
,
UndirectedIntGraph.getEdgeWeight(int, int)
public boolean addVertex(int vertex)
UndirectedMutableIntGraph
addVertex
in interface UndirectedMutableIntGraph
vertex
- The vertex to be added.
public boolean removeVertex(int vertex)
UndirectedMutableIntGraph
removeVertex
in interface UndirectedMutableIntGraph
vertex
- The vertex to be removed.
public double setEdgeWeight(int vertexA, int vertexB, double weight)
UndirectedMutableIntGraph
UndirectedIntGraph.getUnconnectedWeight()
, this should be the same as calling
UndirectedMutableIntGraph.removeEdge(int, int)
. The old weight of the edge is
returned, which may be UndirectedIntGraph.getUnconnectedWeight()
if the edge had
not existed.
setEdgeWeight
in interface UndirectedMutableIntGraph
vertexA
- One vertex of the edge.vertexB
- The other vertex of the edge.weight
- The new weight of the edge.
UndirectedIntGraph.getEdgeWeight(int, int)
directly before this call.public double removeEdge(int vertexA, int vertexB)
UndirectedMutableIntGraph
UndirectedIntGraph.getUnconnectedWeight()
if the edge had
not existed (in which case nothing has happened).
removeEdge
in interface UndirectedMutableIntGraph
vertexA
- One vertex of the edge.vertexB
- The other vertex of the edge.
UndirectedIntGraph.getEdgeWeight(int, int)
directly before this call.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |