com.mhhe.clrs2e
Class WeightedAdjacencyListGraph.WeightedEdge

java.lang.Object
  |
  +--com.mhhe.clrs2e.AdjacencyListGraph.Edge
        |
        +--com.mhhe.clrs2e.WeightedAdjacencyListGraph.WeightedEdge
Enclosing class:
WeightedAdjacencyListGraph

protected static class WeightedAdjacencyListGraph.WeightedEdge
extends AdjacencyListGraph.Edge

Inner class for weighted edges in adjacency lists. Adjacency lists are singly linked.


Field Summary
private  double weight
          The weight of this edge.
 
Fields inherited from class com.mhhe.clrs2e.AdjacencyListGraph.Edge
next, vertex
 
Constructor Summary
WeightedAdjacencyListGraph.WeightedEdge(com.mhhe.clrs2e.Vertex v, AdjacencyListGraph.Edge successor, double wgt)
          Creates a new edge.
 
Method Summary
 double getWeight()
          Returns the weight of this edge.
 void setWeight(double wgt)
          Sets the weight of this edge.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

weight

private double weight
The weight of this edge.

Constructor Detail

WeightedAdjacencyListGraph.WeightedEdge

public WeightedAdjacencyListGraph.WeightedEdge(com.mhhe.clrs2e.Vertex v,
                                               AdjacencyListGraph.Edge successor,
                                               double wgt)
Creates a new edge.

Parameters:
v - The adjacent vertex.
successor - Successor edge to this one.
wgt - The weight of the new edge.
Method Detail

setWeight

public void setWeight(double wgt)
Sets the weight of this edge.

Parameters:
wgt - The new weight for this edge.

getWeight

public double getWeight()
Returns the weight of this edge.