T
- the type of the data to store in Vertices of this graphpublic class WeightedUndirectedGraph<T> extends UndirectedGraph<T> implements WeightedGraph<T>
Constructor and Description |
---|
WeightedUndirectedGraph()
Creates a new weighted undirected graph
|
WeightedUndirectedGraph(java.util.Collection<T> vertexData)
Creates a new weighted undirected graph with the given data in vertices
|
WeightedUndirectedGraph(MultiMap<T,Pair<T,java.lang.Double>> connections)
Creates a new weighted undirected graph with the connections described by
a multimap.
|
Modifier and Type | Method and Description |
---|---|
WeightedUndirectedEdge<T> |
addEdge(Vertex<T> one,
Vertex<T> other,
double weight)
Adds an Edge to the graph between two Vertices with the given weight
|
WeightedUndirectedVertex<T> |
addVertex(T data)
Adds a new vertex to the graph with the given data
|
getEdges, getVertices, removeAllEdges, removeAllVertices, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEdges, getVertices, removeAllEdges, removeAllVertices
public WeightedUndirectedGraph()
public WeightedUndirectedGraph(java.util.Collection<T> vertexData)
vertexData
- the data to make vertices out ofpublic WeightedUndirectedGraph(MultiMap<T,Pair<T,java.lang.Double>> connections)
connections
- a map with pairs which describe the connections and weights
that should exist in the graphpublic WeightedUndirectedEdge<T> addEdge(Vertex<T> one, Vertex<T> other, double weight)
WeightedGraph
addEdge
in interface WeightedGraph<T>
one
- the Vertex the edge starts at (arbitrary for undirected
graphs)other
- the Vertex the edge ends at (arbitrary for undirected graphs)weight
- the weight of this edge