Closed rudenkornk closed 2 years ago
@rudenkornk I found the issue with the boykov_kolmogorov_max_flow
call and provided a fix (#304).
I also found the issue with your edmonds_karp_max_flow
calls. However, it is totally unrelated to the issue with boykov_kolmogorov_max_flow
:
The issue is that edmonds_karp_max_flow
internally uses a filtered_graph
for filtering residual edges. As you can see in the docs, the predicates of the filtered_graph
must be default constructible, but yours isn't.
This filtered_graph
uses an edge predicate that stores the residual capacity property map. In your case, the residual property map stores a copy of edge_index_map
which in turn stores a lambda that captures. Lambdas are default constructible since C++20, but only if they don't capture. Yours does and hence the entire chain, up to the out_edge_iterator
of the filtered_graph
, is not default constructible, which is what the error is telling you.
Two possible solutions I can think of:
&
from your edge_index_map
lambda: https://godbolt.org/z/oKo3cG46T
Boost provides three different algorithms for finding max flow in directed graphs: boykov_kolmogorov, edmonds_karp and push_relabel. All of them have named and non-named parameter versions. Parameter sets they use are also very similar. Despite that, with same parameters some of these algorithms compile and some of them do not. This is the case only for graph without edge_capacity_t interior property.
push_relabel compiles nicely with both named and non-named version:
boykov_kolmogorov compiles with non-named version:
But fails with named version:
edmonds_karp fails with both named and non-named versions with same error:
This issue was also asked on StackOverflow. User sehe suggested that the problem is connected to some subtle error in
choose_const_pmap
functionFull example: Live on godbolt