Class Graph.WeightedEdge<V,E>
java.lang.Object
Graph.Edge<V,E>
Graph.WeightedEdge<V,E>
An extension of the Edge class that also tracks a double for the associated
weight of the edge.
-
Field Summary
Fields inherited from class Graph.Edge
data -
Constructor Summary
ConstructorsConstructorDescriptionWeightedEdge(Graph.Vertex<V, E> u, Graph.Vertex<V, E> v, double weight) Created a weighted edge with the given endpoints and weight.WeightedEdge(Graph.Vertex<V, E> u, Graph.Vertex<V, E> v, double weight, boolean directed) Creates a weighted edge with the associated end points and data.WeightedEdge(Graph.Vertex<V, E> u, Graph.Vertex<V, E> v, double weight, boolean directed, E data) Creates a weighted edge with the associated endpoints, weight, and data.WeightedEdge(Graph.Vertex<V, E> u, Graph.Vertex<V, E> v, double weight, E data) Creates a weighted edge with the specified endpoints, weight, and data. -
Method Summary
Methods inherited from class Graph.Edge
equals, hashCode, isDirected, other, source, target, vertices
-
Constructor Details
-
WeightedEdge
Created a weighted edge with the given endpoints and weight.- Parameters:
u- an endpoint of this edgev- an endpoint of this edgeweight- the weight of this edge
-
WeightedEdge
Creates a weighted edge with the specified endpoints, weight, and data.- Parameters:
u- an endpoint of this edgev- an endpoint of this edgeweight- the weight of this edgedata- the associated data of this edge
-
WeightedEdge
Creates a weighted edge with the associated end points and data.If
directedistrue, this edge is directed fromutov. Otherwise, this edge is undirected.- Parameters:
u- an endpoint of this edgev- an endpoint of this edgeweight- the weight of this edgedirected- whether this edge is to be directed
-
WeightedEdge
public WeightedEdge(Graph.Vertex<V, E> u, Graph.Vertex<V, E> v, double weight, boolean directed, E data) Creates a weighted edge with the associated endpoints, weight, and data.If
directedistrue, this edge is directed fromutov. Otherwise, this edge is undirected.- Parameters:
u- an endpoint of this edgev- an endpoint of this edgeweight- the weight of this edgedirected- whether this edge is to be directeddata- the data of this edge
-
-
Method Details
-
reverse
Description copied from class:Graph.EdgeReturns an edge that is the reverse of this edge.If this edge is directed, the edge returned by this method will be directed in the opposite direction.
- Overrides:
reversein classGraph.Edge<V,E> - Returns:
- an edge that is the reverse of this edge.
-
toString
- Overrides:
toStringin classGraph.Edge<V,E>
-