MCPcopy Create free account
hub / github.com/ElementsProject/lightning / sendflow

Function sendflow

plugins/askrene/child/algorithm.c:207–222  ·  view source on GitHub ↗

Helper. * Sends an amount of flow through an arc, changing the flow balance of the * nodes connected by the arc and the [residual] capacity of the arc and its * dual. */

Source from the content-addressed store, hash-verified

205 * nodes connected by the arc and the [residual] capacity of the arc and its
206 * dual. */
207static void sendflow(const struct graph *graph, const struct arc arc,
208 const s64 flow, s64 *arc_capacity, s64 *node_balance)
209{
210 const struct arc dual = arc_dual(graph, arc);
211
212 arc_capacity[arc.idx] -= flow;
213 arc_capacity[dual.idx] += flow;
214
215 if (node_balance) {
216 const struct node src = arc_tail(graph, arc),
217 dst = arc_tail(graph, dual);
218
219 node_balance[src.idx] -= flow;
220 node_balance[dst.idx] += flow;
221 }
222}
223
224/* Augment a `flow` amount along the path defined by `prev`.*/
225static void augment_flow(const struct graph *graph,

Callers 2

augment_flowFunction · 0.85
mcf_refinementFunction · 0.85

Calls 2

arc_dualFunction · 0.70
arc_tailFunction · 0.70

Tested by

no test coverage detected