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