|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.aitools.aq.graph.weighted.concrete.GeneralUndirectedGraph<V>
V
- The vertices in this graph.
public final class GeneralUndirectedGraph<V>
A general implementation for all kind of vertices. To provide fast access,
each weight is of an edge is hold twice in the graph. You should use
ComparablesUndirectedGraph
if your vertices can be compared.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface de.aitools.aq.graph.weighted.UndirectedMutableGraph |
---|
UndirectedMutableGraph.Edge<V> |
Field Summary |
---|
Fields inherited from interface de.aitools.aq.graph.weighted.UndirectedGraph |
---|
DEFAULT_UNCONNECTED_WEIGHT |
Constructor Summary | |
---|---|
GeneralUndirectedGraph()
Deprecated. Create a new GeneralUndirectedGraph with
default weight for unconnected vertices and default capacity. |
|
GeneralUndirectedGraph(double unconnectedWeight,
int initialCapacity)
Deprecated. Create a new GeneralUndirectedGraph . |
Method Summary | |
---|---|
boolean |
addVertex(V vertex)
Deprecated. Add a vertex to the graph. |
boolean |
containsEdge(V vertexA,
V vertexB)
Deprecated. Check if there exists an edge in the graph connecting the two vertices given as parameters. |
boolean |
containsVertex(V vertex)
Deprecated. Check if given vertex is contained in the graph. |
java.util.Iterator<? extends UndirectedMutableGraph.Edge<V>> |
edges()
Deprecated. Get an iterator over all edges of the graph. |
java.util.Iterator<? extends UndirectedMutableGraph.Edge<V>> |
edgesConnectedTo(V vertex)
Deprecated. Get an iterator over all edges in the graph, given vertex is connected with. |
UndirectedMutableGraph.Edge<V> |
getEdge(V vertexA,
V vertexB)
Deprecated. Get the UndirectedGraph.Edge connecting the two vertices. |
double |
getEdgeWeight(V vertexA,
V vertexB)
Deprecated. Get the weight of the edge connecting the two vertices. |
double |
getUnconnectedWeight()
Deprecated. The method UndirectedGraph.getEdgeWeight(Object, Object) returns a double
value for any possible edge connecting two vertices in the graph. |
java.util.Iterator<V> |
iterator()
Deprecated. |
int |
numEdges()
Deprecated. Get the number of edges. |
int |
numEdges(V vertex)
Deprecated. |
int |
numVertices()
Deprecated. Get the number of vertices. |
double |
removeEdge(V vertexA,
V vertexB)
Deprecated. Remove a edge determined by two vertices. |
boolean |
removeVertex(V vertex)
Deprecated. Remove a vertex from the graph. |
double |
setEdgeWeight(V vertexA,
V 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 UndirectedGraph.getEdgeWeight(Object, Object) if the two vertices are not
connected. |
java.util.Iterator<V> |
vertices()
Deprecated. Get an iterator over all current vertices of this graph. |
java.util.Iterator<V> |
verticesConnectedTo(V vertex)
Deprecated. Get an iterator over 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 GeneralUndirectedGraph()
GeneralUndirectedGraph
with
default weight for unconnected vertices and default capacity.
setUnconnectedWeight(double)
,
GeneralUndirectedGraph(double, int)
public GeneralUndirectedGraph(double unconnectedWeight, int initialCapacity)
GeneralUndirectedGraph
.
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()
UndirectedGraph
UndirectedGraph.getEdgeWeight(Object, Object)
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 UndirectedGraph<V>
public void setUnconnectedWeight(double unconnectedWeight)
UndirectedMutableGraph
UndirectedGraph.getEdgeWeight(Object, Object)
if the two vertices are not
connected. This will remove all edges that currently have
unconnectedWeight as their weight.
setUnconnectedWeight
in interface UndirectedMutableGraph<V>
unconnectedWeight
- The new weight for unconnected vertices.public int numVertices()
UndirectedGraph
numVertices
in interface UndirectedGraph<V>
public int numEdges()
UndirectedGraph
numEdges
in interface UndirectedGraph<V>
public int numEdges(V vertex)
numEdges
in interface UndirectedGraph<V>
vertex
- Which vertex to count edges of.
public java.util.Iterator<V> vertices()
UndirectedGraph
Iterable.iterator()
.
vertices
in interface UndirectedGraph<V>
UndirectedGraph.numVertices()
public java.util.Iterator<V> verticesConnectedTo(V vertex)
UndirectedGraph
verticesConnectedTo
in interface UndirectedGraph<V>
vertex
- The vertex.
UndirectedGraph.numEdges(Object)
public java.util.Iterator<? extends UndirectedMutableGraph.Edge<V>> edges()
UndirectedGraph
edges
in interface UndirectedGraph<V>
edges
in interface UndirectedMutableGraph<V>
UndirectedGraph.numEdges()
public java.util.Iterator<? extends UndirectedMutableGraph.Edge<V>> edgesConnectedTo(V vertex)
UndirectedGraph
edgesConnectedTo
in interface UndirectedGraph<V>
edgesConnectedTo
in interface UndirectedMutableGraph<V>
vertex
- The vertex.
UndirectedGraph.numEdges(Object)
public boolean containsVertex(V vertex)
UndirectedGraph
containsVertex
in interface UndirectedGraph<V>
vertex
- The vertex to look for.
public boolean containsEdge(V vertexA, V vertexB)
UndirectedGraph
containsEdge
in interface UndirectedGraph<V>
vertexA
- One vertex.vertexB
- The other vertex.
public double getEdgeWeight(V vertexA, V vertexB)
UndirectedGraph
UndirectedGraph.getUnconnectedWeight()
if the two vertices are not connected.
getEdgeWeight
in interface UndirectedGraph<V>
vertexA
- One vertex.vertexB
- The other vertex.
UndirectedGraph.getUnconnectedWeight()
.UndirectedGraph.containsEdge(Object, Object)
,
UndirectedGraph.getEdge(Object, Object)
public UndirectedMutableGraph.Edge<V> getEdge(V vertexA, V vertexB)
UndirectedGraph
UndirectedGraph.Edge
connecting the two vertices. The object will also
be returned if there does not exists such an edge in the graph. Use
UndirectedGraph.Edge.exists()
to check.
getEdge
in interface UndirectedGraph<V>
getEdge
in interface UndirectedMutableGraph<V>
vertexA
- One vertex.vertexB
- The other vertex.
UndirectedGraph.containsEdge(Object, Object)
,
UndirectedGraph.getEdgeWeight(Object, Object)
public boolean addVertex(V vertex)
UndirectedMutableGraph
addVertex
in interface UndirectedMutableGraph<V>
vertex
- The vertex to be added.
public boolean removeVertex(V vertex)
UndirectedMutableGraph
removeVertex
in interface UndirectedMutableGraph<V>
vertex
- The vertex to be removed.
public double setEdgeWeight(V vertexA, V vertexB, double weight)
UndirectedMutableGraph
UndirectedGraph.getUnconnectedWeight()
, this should be the same as calling
UndirectedMutableGraph.removeEdge(Object, Object)
. The old weight of the edge is
returned, which may be UndirectedGraph.getUnconnectedWeight()
if the edge had
not existed.
setEdgeWeight
in interface UndirectedMutableGraph<V>
vertexA
- One vertex of the edge.vertexB
- The other vertex of the edge.weight
- The new weight of the edge.
UndirectedGraph.getEdgeWeight(Object, Object)
directly before this call.public double removeEdge(V vertexA, V vertexB)
UndirectedMutableGraph
UndirectedGraph.getUnconnectedWeight()
if the edge had
not existed (in which case nothing has happened).
removeEdge
in interface UndirectedMutableGraph<V>
vertexA
- One vertex of the edge.vertexB
- The other vertex of the edge.
UndirectedGraph.getEdgeWeight(Object, Object)
directly before this call.public java.util.Iterator<V> iterator()
iterator
in interface java.lang.Iterable<V>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |