321 Supply sum = 0; |
321 Supply sum = 0; |
322 for (NodeIt n(graph); n != INVALID; ++n) sum += supply[n]; |
322 for (NodeIt n(graph); n != INVALID; ++n) sum += supply[n]; |
323 if (sum != 0) return false; |
323 if (sum != 0) return false; |
324 |
324 |
325 // Finding a feasible flow |
325 // Finding a feasible flow |
326 Circulation< Graph, Capacity, FlowMap, ConstMap<Edge, Capacity>, |
326 Circulation< Graph, Capacity, ConstMap<Edge, Capacity>, |
327 CapacityRefMap, SupplyMap > |
327 CapacityRefMap, SupplyMap >::DefFlowMap<FlowMap>::Create |
328 circulation( graph, constMap<Edge>((Capacity)0), |
328 circulation( graph, constMap<Edge>((Capacity)0), |
329 capacity, supply, flow ); |
329 capacity, supply); |
330 return circulation.run() == -1; |
330 circulation.flowMap(flowMap); |
|
331 return circulation.run(); |
331 } |
332 } |
332 |
333 |
333 #ifdef LIMITED_CYCLE_CANCELING |
334 #ifdef LIMITED_CYCLE_CANCELING |
334 /// \brief Executes a cycle-canceling algorithm using |
335 /// \brief Executes a cycle-canceling algorithm using |
335 /// \ref lemon::BellmanFord "Bellman-Ford" algorithm with limited |
336 /// \ref lemon::BellmanFord "Bellman-Ford" algorithm with limited |