Helper. * Compute the reduced cost of an arc. */
| 327 | /* Helper. |
| 328 | * Compute the reduced cost of an arc. */ |
| 329 | static s64 reduced_cost(const struct graph *graph, const struct arc arc, |
| 330 | const s64 *cost, const s64 *potential) |
| 331 | { |
| 332 | struct node src = arc_tail(graph, arc); |
| 333 | struct node dst = arc_head(graph, arc); |
| 334 | return cost[arc.idx] - potential[src.idx] + potential[dst.idx]; |
| 335 | } |
| 336 | |
| 337 | /* Finds an optimal path from the source to the nearest sink node, by definition |
| 338 | * a node i is a sink if node_balance[i]<0. It uses a reduced cost: |
no test coverage detected