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

Function node_balance

plugins/askrene/child/algorithm.c:309–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309s64 node_balance(const struct graph *graph,
310 const struct node node,
311 const s64 *capacity)
312{
313 s64 balance = 0;
314
315 for (struct arc arc = node_adjacency_begin(graph, node);
316 !node_adjacency_end(arc); arc = node_adjacency_next(graph, arc)) {
317 struct arc dual = arc_dual(graph, arc);
318
319 if (arc_is_dual(graph, arc))
320 balance += capacity[arc.idx];
321 else
322 balance -= capacity[dual.idx];
323 }
324 return balance;
325}
326
327/* Helper.
328 * Compute the reduced cost of an arc. */

Callers 4

solve_caseFunction · 0.85
mainFunction · 0.85
problem1Function · 0.85
problem2Function · 0.85

Calls 5

node_adjacency_beginFunction · 0.70
node_adjacency_endFunction · 0.70
node_adjacency_nextFunction · 0.70
arc_dualFunction · 0.70
arc_is_dualFunction · 0.70

Tested by 4

solve_caseFunction · 0.68
mainFunction · 0.68
problem1Function · 0.68
problem2Function · 0.68