Open kenkoooo opened 4 years ago
Actually reusing vector and priority queue instances would reduce the number of malloc and realloc, which might be important to do. Though my intention there was about the definition of comparison used in the priority queue.
The original implementation uses this custom structure instead of pair<Cost, int>
plus greater<pair<Cost, int>>
, since in this way, we can avoid comparing the vertex ids in the comparison function.
I think we can create a helper wrapper struct like this, or create a struct in place like what the original impl do.
In
mincostflow
, we can reuse some arrays._Originally posted by @MiSawa in https://github.com/rust-lang-ja/ac-library-rs/pull/25#discussion_r485758288_