I am searching for state-of-art implementation of min cost max flow problem or reference to it. I am unable to come to sensible conclusion in reasonable time looking at what is currently avalible online, especialy in terms of min cost max flow that doesnt relly on maximum cost in edges. Thanks to anyone who sees this.
Can't you just write it yourself? If not, why the fuck do you need it?
stfu toxic cunt
Have you tried using bitset?
While it is definitely not sate-of-the-art, just as a related observation on MCMF, I think a relatively easy to implement optimization that can be done to the most "canonical" algorithm is to use SPFA instead of Bellman-Ford when searching for an augmenting path of minimum cost (per unit of flow).
The cases where SPFA is as slow as Bellman-Ford occur when a path of minimum cost is made out of a lot of edges, which is something that does not happen in many flow networks, specially with the first augmenting paths found.
An example of a problem where this was useful to me is this problem. The time limit is 3 seconds, using Bellman-Ford I received a "Time limit exceeded verdict" (maybe because I was using python, but that is not the point I am trying to make, link to TLE submission), but after changing the calculation of the augmenting paths to SPFA, it got an "Accepted" verdict, and it took 300ms in the worst test case (link to AC submission).
Here's are the two main algorithms ($$$V$$$ vertices, $$$E$$$ edges, $$$U$$$ max capacity, $$$F$$$ total flow, $$$C$$$ max edge cost):
In general, Network Simplex is better on dense graphs, while Cost Scaling Push Relabel is better on sparse graphs. I think this is due to Network Simplex pivots taking $$$O(V)$$$ time, while PR needs the full $$$O(E)$$$ time to relabel all vertices once.
Some less competitive algorithms: