de.aitools.aq.graph.weighted.concrete
Class GeneralUndirectedGraph<V>

java.lang.Object
  extended by de.aitools.aq.graph.weighted.concrete.GeneralUndirectedGraph<V>
Type Parameters:
V - The vertices in this graph.
All Implemented Interfaces:
UndirectedGraph<V>, UndirectedMutableGraph<V>, java.lang.Iterable<V>

Deprecated. see package de.aitools.aq.structure.graph

public final class GeneralUndirectedGraph<V>
extends java.lang.Object
implements UndirectedMutableGraph<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.

Version:
$Id: GeneralUndirectedGraph.java,v 1.2 2011/09/29 12:43:04 dogu3912 Exp $
Author:
johannes.kiesel(/\t)uni-weimar.de

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

GeneralUndirectedGraph

public GeneralUndirectedGraph()
Deprecated. 
Create a new GeneralUndirectedGraph with default weight for unconnected vertices and default capacity.

See Also:
setUnconnectedWeight(double), GeneralUndirectedGraph(double, int)

GeneralUndirectedGraph

public GeneralUndirectedGraph(double unconnectedWeight,
                              int initialCapacity)
Deprecated. 
Create a new GeneralUndirectedGraph.

Parameters:
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

getUnconnectedWeight

public double getUnconnectedWeight()
Deprecated. 
Description copied from interface: UndirectedGraph
The method 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.

Specified by:
getUnconnectedWeight in interface UndirectedGraph<V>
Returns:
A weight for not existing edges.

setUnconnectedWeight

public void setUnconnectedWeight(double unconnectedWeight)
Deprecated. 
Description copied from interface: UndirectedMutableGraph
Change the weight that is returned by UndirectedGraph.getEdgeWeight(Object, Object) if the two vertices are not connected. This will remove all edges that currently have unconnectedWeight as their weight.

Specified by:
setUnconnectedWeight in interface UndirectedMutableGraph<V>
Parameters:
unconnectedWeight - The new weight for unconnected vertices.

numVertices

public int numVertices()
Deprecated. 
Description copied from interface: UndirectedGraph
Get the number of vertices.

Specified by:
numVertices in interface UndirectedGraph<V>
Returns:
The number of vertices in the graph.

numEdges

public int numEdges()
Deprecated. 
Description copied from interface: UndirectedGraph
Get the number of edges.

Specified by:
numEdges in interface UndirectedGraph<V>
Returns:
The number of edges in the graph.

numEdges

public int numEdges(V vertex)
Deprecated. 
Specified by:
numEdges in interface UndirectedGraph<V>
Parameters:
vertex - Which vertex to count edges of.
Returns:
The number of edges this vertex is connected with.

vertices

public java.util.Iterator<V> vertices()
Deprecated. 
Description copied from interface: UndirectedGraph
Get an iterator over all current vertices of this graph. This is the same as calling Iterable.iterator().

Specified by:
vertices in interface UndirectedGraph<V>
Returns:
The iterator.
See Also:
UndirectedGraph.numVertices()

verticesConnectedTo

public java.util.Iterator<V> verticesConnectedTo(V vertex)
Deprecated. 
Description copied from interface: UndirectedGraph
Get an iterator over all vertices that are connected with given vertex at the moment of this call.

Specified by:
verticesConnectedTo in interface UndirectedGraph<V>
Parameters:
vertex - The vertex.
Returns:
The iterator.
See Also:
UndirectedGraph.numEdges(Object)

edges

public java.util.Iterator<? extends UndirectedMutableGraph.Edge<V>> edges()
Deprecated. 
Description copied from interface: UndirectedGraph
Get an iterator over all edges of the graph. Each edge is only visited once.

Specified by:
edges in interface UndirectedGraph<V>
Specified by:
edges in interface UndirectedMutableGraph<V>
Returns:
The iterator.
See Also:
UndirectedGraph.numEdges()

edgesConnectedTo

public java.util.Iterator<? extends UndirectedMutableGraph.Edge<V>> edgesConnectedTo(V vertex)
Deprecated. 
Description copied from interface: UndirectedGraph
Get an iterator over all edges in the graph, given vertex is connected with.

Specified by:
edgesConnectedTo in interface UndirectedGraph<V>
Specified by:
edgesConnectedTo in interface UndirectedMutableGraph<V>
Parameters:
vertex - The vertex.
Returns:
The iterator.
See Also:
UndirectedGraph.numEdges(Object)

containsVertex

public boolean containsVertex(V vertex)
Deprecated. 
Description copied from interface: UndirectedGraph
Check if given vertex is contained in the graph.

Specified by:
containsVertex in interface UndirectedGraph<V>
Parameters:
vertex - The vertex to look for.
Returns:
True if the vertex is contained. False otherwise.

containsEdge

public boolean containsEdge(V vertexA,
                            V vertexB)
Deprecated. 
Description copied from interface: UndirectedGraph
Check if there exists an edge in the graph connecting the two vertices given as parameters.

Specified by:
containsEdge in interface UndirectedGraph<V>
Parameters:
vertexA - One vertex.
vertexB - The other vertex.
Returns:
True if both vertices are connected.

getEdgeWeight

public double getEdgeWeight(V vertexA,
                            V vertexB)
Deprecated. 
Description copied from interface: UndirectedGraph
Get the weight of the edge connecting the two vertices. This will return UndirectedGraph.getUnconnectedWeight() if the two vertices are not connected.

Specified by:
getEdgeWeight in interface UndirectedGraph<V>
Parameters:
vertexA - One vertex.
vertexB - The other vertex.
Returns:
The weight of the edge or UndirectedGraph.getUnconnectedWeight().
See Also:
UndirectedGraph.containsEdge(Object, Object), UndirectedGraph.getEdge(Object, Object)

getEdge

public UndirectedMutableGraph.Edge<V> getEdge(V vertexA,
                                              V vertexB)
Deprecated. 
Description copied from interface: UndirectedGraph
Get the 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.

Specified by:
getEdge in interface UndirectedGraph<V>
Specified by:
getEdge in interface UndirectedMutableGraph<V>
Parameters:
vertexA - One vertex.
vertexB - The other vertex.
Returns:
The edge.
See Also:
UndirectedGraph.containsEdge(Object, Object), UndirectedGraph.getEdgeWeight(Object, Object)

addVertex

public boolean addVertex(V vertex)
Deprecated. 
Description copied from interface: UndirectedMutableGraph
Add a vertex to the graph.

Specified by:
addVertex in interface UndirectedMutableGraph<V>
Parameters:
vertex - The vertex to be added.
Returns:
True if the graph changed during this call. False if the graph already contained that vertex.

removeVertex

public boolean removeVertex(V vertex)
Deprecated. 
Description copied from interface: UndirectedMutableGraph
Remove a vertex from the graph.

Specified by:
removeVertex in interface UndirectedMutableGraph<V>
Parameters:
vertex - The vertex to be removed.
Returns:
True if the graph changed during this call. False if the graph has not contained that vertex.

setEdgeWeight

public double setEdgeWeight(V vertexA,
                            V vertexB,
                            double weight)
Deprecated. 
Description copied from interface: UndirectedMutableGraph
Set the weight of a edge determined by two vertices. If the new weight is 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.

Specified by:
setEdgeWeight in interface UndirectedMutableGraph<V>
Parameters:
vertexA - One vertex of the edge.
vertexB - The other vertex of the edge.
weight - The new weight of the edge.
Returns:
The value that would have been returned by a call to UndirectedGraph.getEdgeWeight(Object, Object) directly before this call.

removeEdge

public double removeEdge(V vertexA,
                         V vertexB)
Deprecated. 
Description copied from interface: UndirectedMutableGraph
Remove a edge determined by two vertices. The old weight of the edge is returned, which may be UndirectedGraph.getUnconnectedWeight() if the edge had not existed (in which case nothing has happened).

Specified by:
removeEdge in interface UndirectedMutableGraph<V>
Parameters:
vertexA - One vertex of the edge.
vertexB - The other vertex of the edge.
Returns:
The value that would have been returned by a call to UndirectedGraph.getEdgeWeight(Object, Object) directly before this call.

iterator

public java.util.Iterator<V> iterator()
Deprecated. 
Specified by:
iterator in interface java.lang.Iterable<V>