@Override protected void initializeIterations() { parentCapacityMap.put(source, Integer.MAX_VALUE); parentMap.put(source, source); List<E> edgeList = new ArrayList<E>(mFlowGraph.getEdges()); for (int eIdx=0;eIdx< edgeList.size();eIdx++) { E edge = edgeList.get(eIdx); Number capacity = edgeCapacityTransformer.apply(edge); if (capacity == null) { throw new IllegalArgumentException("Edge capacities must be provided in Function passed to constructor"); } residualCapacityMap.put(edge, capacity); V source = mFlowGraph.getSource(edge); V destination = mFlowGraph.getDest(edge); if(mFlowGraph.isPredecessor(source, destination) == false) { E backEdge = edgeFactory.get(); mFlowGraph.addEdge(backEdge, destination, source, EdgeType.DIRECTED); residualCapacityMap.put(backEdge, 0); } } }
@Override protected void initializeIterations() { parentCapacityMap.put(source, Integer.MAX_VALUE); parentMap.put(source, source); List<E> edgeList = new ArrayList<E>(mFlowGraph.getEdges()); for (int eIdx=0;eIdx< edgeList.size();eIdx++) { E edge = edgeList.get(eIdx); Number capacity = edgeCapacityTransformer.transform(edge); if (capacity == null) { throw new IllegalArgumentException("Edge capacities must be provided in Transformer passed to constructor"); } residualCapacityMap.put(edge, capacity); V source = mFlowGraph.getSource(edge); V destination = mFlowGraph.getDest(edge); if(mFlowGraph.isPredecessor(source, destination) == false) { E backEdge = edgeFactory.create(); mFlowGraph.addEdge(backEdge, destination, source, EdgeType.DIRECTED); residualCapacityMap.put(backEdge, 0); } } }
@Override protected void initializeIterations() { parentCapacityMap.put(source, Integer.MAX_VALUE); parentMap.put(source, source); List<E> edgeList = new ArrayList<E>(mFlowGraph.getEdges()); for (int eIdx = 0; eIdx < edgeList.size(); eIdx++) { E edge = edgeList.get(eIdx); Number capacity = edgeCapacityTransformer.transform(edge); if (capacity == null) { throw new IllegalArgumentException( "Edge capacities must be provided in Transformer passed to constructor"); } residualCapacityMap.put(edge, capacity); V source1 = mFlowGraph.getSource(edge); V destination = mFlowGraph.getDest(edge); if (mFlowGraph.isPredecessor(source1, destination) == false) { E backEdge = edgeFactory.create(); mFlowGraph.addEdge(backEdge, destination, source1, EdgeType.DIRECTED); residualCapacityMap.put(backEdge, 0); } } }