GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 15 / 0 / 15
Functions: 100.0% 1 / 0 / 1
Branches: 100.0% 14 / 0 / 14

src/graph/nf/gomory_hu/lib.hpp
Line Branch Exec Source
1 #pragma once
2
3 #include "../dinic/lib.hpp"
4
5 namespace tifa_libs {
6
7 // @return {w, u, v} edges in Gomory--Hu tree
8 template <class EW>
9 91 CEXP vec<edge_t<EW>> gomory_hu(u32 n, vec<edge_t<EW>> CR ed) NE {
10 91 vecu par(n);
11 91 dinic<EW> D(n);
12 91 vecptu ed_locs;
13
2/2
✓ Branch 7 taken 140923 times.
✓ Branch 8 taken 91 times.
141014 for (auto [w, u, v] : ed) ed_locs.push_back(D.add(u, v, w, w));
14 91 vec<edge_t<EW>> ans;
15
2/2
✓ Branch 0 taken 7480 times.
✓ Branch 1 taken 91 times.
7571 flt_ (u32, i, 1, n) {
16
2/2
✓ Branch 6 taken 12181589 times.
✓ Branch 7 taken 7480 times.
12189069 for (auto [ed, loc] : ed_locs) {
17 12181589 auto &e = D.e[ed][loc], &e_rev = D.e[e.to][e.inv];
18 12181589 e.w = e_rev.w = (e.w + e_rev.w) / 2;
19 }
20 7480 ans.emplace_back(D.template get<EW>(i, par[i]), i, par[i]);
21
2/2
✓ Branch 0 taken 400371 times.
✓ Branch 1 taken 7480 times.
407851 flt_ (u32, j, i + 1, n)
22
6/6
✓ Branch 2 taken 399936 times.
✓ Branch 3 taken 435 times.
✓ Branch 5 taken 24005 times.
✓ Branch 6 taken 375931 times.
✓ Branch 7 taken 24005 times.
✓ Branch 8 taken 376366 times.
400371 if (par[j] == par[i] && D.dep[j]) par[j] = i;
23 }
24 91 return ans;
25 91 }
26
27 } // namespace tifa_libs
28