public OptimizedFlowNetwork(int numVertices,int srcIndex,int sinkIndex,Iterator<EdgeInfo> edges){
  n=numVertices;
  capacity=new int[n][n];
  flow=new int[n][n];
  previous=new int[n];
  visited=new int[n];
  source=srcIndex;
  sink=sinkIndex;
  while (edges.hasNext()) {
    EdgeInfo ei=edges.next();
    capacity[ei.start][ei.end]=ei.capacity;
  }
}

public OptimizedFlowNetwork ( int numVertices , int srcIndex , int sinkIndex , Iterator < EdgeInfo > edges ) { n = numVertices ; capacity = new int [ n ] [ n ] ; flow = new int [ n ] [ n ] ; previous = new int [ n ] ; visited = new int [ n ] ; source = srcIndex ; sink = sinkIndex ; while ( edges . hasNext ( ) ) { EdgeInfo ei = edges . next ( ) ; capacity [ ei . start ] [ ei . end ] = ei . capacity ; } }
construct an instance of the flownetwork problem using optimized array structure to solve problem . < p > we use the same input representation so we can properly compare the performance of this implementation .
