public Iterator<Pair> compute(){
  FlowNetworkArray network=new FlowNetworkArray(numVertices,srcIndex,tgtIndex,edges.iterator());
  FordFulkerson solver=new FordFulkerson(network,new DFS_SearchArray(network));
  solver.compute();
  ArrayList<Pair> pairs=new ArrayList<Pair>();
  for (  EdgeInfo ei : edges) {
    if (ei.start != srcIndex && ei.end != tgtIndex) {
      if (ei.getFlow() == 1) {
        pairs.add(new Pair(reverse.get(ei.start),reverse.get(ei.end)));
      }
    }
  }
  return pairs.iterator();
}

public Iterator < Pair > compute ( ) { FlowNetworkArray network = new FlowNetworkArray ( numVertices , srcIndex , tgtIndex , edges . iterator ( ) ) ; FordFulkerson solver = new FordFulkerson ( network , new DFS_SearchArray ( network ) ) ; solver . compute ( ) ; ArrayList < Pair > pairs = new ArrayList < Pair > ( ) ; for ( EdgeInfo ei : edges ) { if ( ei . start != srcIndex && ei . end != tgtIndex ) { if ( ei . getFlow ( ) == 1 ) { pairs . add ( new Pair ( reverse . get ( ei . start ) , reverse . get ( ei . end ) ) ) ; } } } return pairs . iterator ( ) ; }
compute a solution to the flownetwork problem and find all edges in the solution whose flow is 1 , since these are valid solutions to the matching problem . < p >
