ENH: Add support for callables to capacity attributes in flow algorithms
Author: rossbarCreated Dec 16, 2025Updated Jan 8, 2026
Labelstype: Enhancementsfloating-point
Currently the flow-related analyses support a capacity keyword argument (see e.g. maximum_flow) to allow users to specify the name of a capacity attribute as a string.
I propose to expand support here to allow callables in addition to strings similar to how weight is handled in many places across the library (e.g. shortest paths.
One motivation for doing so would be to enable the recommended pattern for dealing with floating point precision comparisons without having to modify attributes directly (the modifications can happen in the function instead).
Source: networkx/networkx