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

Function zero_flow

plugins/renepay/mcf.c:1082–1101  ·  view source on GitHub ↗

Set zero flow in the residual network. */

Source from the content-addressed store, hash-verified

1080
1081/* Set zero flow in the residual network. */
1082static void zero_flow(
1083 const struct linear_network *linear_network,
1084 struct residual_network *residual_network)
1085{
1086 for(u32 node=0;node<linear_network->max_num_nodes;++node)
1087 {
1088 residual_network->potential[node]=0;
1089 for(struct arc arc=node_adjacency_begin(linear_network,node);
1090 !node_adjacency_end(arc);
1091 arc = node_adjacency_next(linear_network,arc))
1092 {
1093 if(arc_is_dual(arc))continue;
1094
1095 struct arc dual = arc_dual(arc);
1096
1097 residual_network->cap[arc.idx] = linear_network->capacity[arc.idx];
1098 residual_network->cap[dual.idx] = 0;
1099 }
1100 }
1101}
1102
1103// TODO(eduardo): unit test this
1104/* Starting from a feasible flow (satisfies the balance and capacity

Callers 1

optimize_mcfFunction · 0.85

Calls 5

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

Tested by

no test coverage detected