T
- the type of the data to store in Vertices of this graphpublic class WeightedDirectedGraph<T> extends DirectedGraph<T> implements WeightedGraph<T>
Constructor and Description |
---|
WeightedDirectedGraph()
Creates a new weighted directed graph
|
WeightedDirectedGraph(java.util.Collection<T> vertexData)
Creates a new weighted directed graph with the given data in vertices
|
WeightedDirectedGraph(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 |
---|---|
WeightedDirectedEdge<T> |
addEdge(Vertex<T> source,
Vertex<T> target,
double weight)
Adds an Edge to the graph between two Vertices with the given weight
|
WeightedDirectedVertex<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 WeightedDirectedGraph()
public WeightedDirectedGraph(java.util.Collection<T> vertexData)
vertexData
- the data to make vertices out ofpublic WeightedDirectedGraph(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 WeightedDirectedEdge<T> addEdge(Vertex<T> source, Vertex<T> target, double weight)
WeightedGraph
addEdge
in interface WeightedGraph<T>
source
- the Vertex the edge starts at (arbitrary for undirected
graphs)target
- the Vertex the edge ends at (arbitrary for undirected graphs)weight
- the weight of this edge