示例#1
0
 /**
  * Adds the edge {@code e} to the network.
  * @param e the edge
  * @throws IllegalArgumentException unless endpoints of edge are between
  *         {@code 0} and {@code V-1}
  */
 public void addEdge(FlowEdge e) {
     int v = e.from();
     int w = e.to();
     validateVertex(v);
     validateVertex(w);
     adj[v].add(e);
     adj[w].add(e);
     E++;
 }
示例#2
0
 /**
  * Initializes a flow edge from another flow edge.
  * @param e the edge to copy
  */
 public FlowEdge(FlowEdge e) {
     this.v         = e.v;
     this.w         = e.w;
     this.capacity  = e.capacity;
     this.flow      = e.flow;
 }
示例#3
0
 /**
   * Unit tests the {@code FlowEdge} data type.
   *
   * @param args the command-line arguments
   */
  public static void main(String[] args) {
      FlowEdge e = new FlowEdge(12, 23, 4.56);
      StdOut.println(e);
  }