Algorithm
Development Kit 1.0

algs.model.network
Class EdgeInfo

java.lang.Object
  extended by algs.model.network.EdgeInfo

public class EdgeInfo
extends java.lang.Object

This class is used to model the edges of the graph which contains a network flow problem.

Public data members are not a problem since this information is finalized once created, and the 'flow' value can only be read externally; it can be written only by the algs.model.network package.

Note that the 'cost' attribute is needed in only a few of the network flow algorithms but it has been provided here to simplify the modeling of the various problems being solved by Ford-Fulkerson as well as the Maximum Flow, Minimum Cost problem.

Since:
1.0
Version:
1.0, 6/15/08
Author:
George Heineman

Field Summary
 int capacity
          Capacity over the edge.
 int cost
          Shipping cost for this edge.
 int end
          End of edge.
 int start
          Start of edge.
 
Constructor Summary
EdgeInfo(int start, int end, int cap)
          Construct EdgeInfo from (start,end) vertices with given capacity.
EdgeInfo(int start, int end, int cap, int cost)
          Construct EdgeInfo from (start,end) vertices with given capacity.
 
Method Summary
 boolean equals(java.lang.Object o)
          Support default equals protocol.
 int getFlow()
          Return the flow computed by the algorithm.
 int hashCode()
          Support hashCode protocol.
 java.lang.String toString()
          Reasonable toString.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

start

public final int start
Start of edge.


end

public final int end
End of edge.


capacity

public final int capacity
Capacity over the edge.


cost

public final int cost
Shipping cost for this edge.

Constructor Detail

EdgeInfo

public EdgeInfo(int start,
                int end,
                int cap)
Construct EdgeInfo from (start,end) vertices with given capacity.

Parameters:
start - start vertex
end - end vertex
cap - existing capacity

EdgeInfo

public EdgeInfo(int start,
                int end,
                int cap,
                int cost)
Construct EdgeInfo from (start,end) vertices with given capacity.

Parameters:
start - start vertex
end - end vertex
cap - existing capacity
cost - shipping cost for this edge
Method Detail

getFlow

public int getFlow()
Return the flow computed by the algorithm.


toString

public java.lang.String toString()
Reasonable toString.

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Support default equals protocol.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Support hashCode protocol.

Overrides:
hashCode in class java.lang.Object

Algorithm Development Kit 1.0

This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.