GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 19 / 0 / 19
Functions: 100.0% 3 / 0 / 3
Branches: 86.4% 19 / 0 / 22

src/graph/scc/e_bcc/lib.hpp
Line Branch Exec Source
1 #pragma once
2
3 #include "../../ds/eog/lib.hpp"
4
5 namespace tifa_libs {
6
7 struct e_bcc {
8 vecu dfn, low;
9 vvecu belongs;
10
11 //! g should be undirect
12 template <class T, class... Info>
13 105 CEXP e_bcc(eog<T, Info...> CR g) NE : dfn(g.vsize()), low(g.vsize()) {
14 21 vecu stk;
15 21 u32 tot = 0;
16 1149503 auto tarjan = [&](auto&& f, u32 u, u32 fa) -> void {
17 1149503 dfn[u] = low[u] = ++tot;
18
1/2
✓ Branch 1 taken 1149503 times.
✗ Branch 2 not taken.
1149503 stk.push_back(u);
19 1149503 bool skipped_parent = false;
20 1149503 g.foreach(u, [&](u32 v) {
21
2/2
✓ Branch 1 taken 1012053 times.
✓ Branch 2 taken 2063603 times.
3075656 if (!dfn[v]) f(f, v, u), low[u] = min(low[u], low[v]);
22
6/6
✓ Branch 0 taken 1013647 times.
✓ Branch 1 taken 1049956 times.
✓ Branch 3 taken 1594 times.
✓ Branch 4 taken 1012053 times.
✓ Branch 5 taken 1051550 times.
✓ Branch 6 taken 1012053 times.
2063603 else if (v != fa || std::exchange(skipped_parent, true)) low[u] = min(low[u], dfn[v]);
23 });
24
2/2
✓ Branch 2 taken 452093 times.
✓ Branch 3 taken 697410 times.
1149503 if (low[u] == dfn[u]) {
25 452093 vecu res;
26 u32 p;
27
1/2
✓ Branch 2 taken 1149503 times.
✗ Branch 3 not taken.
1149503 do res.push_back(p = stk.back()), stk.pop_back();
28
2/2
✓ Branch 0 taken 697410 times.
✓ Branch 1 taken 452093 times.
1149503 while (u != p);
29
1/2
✓ Branch 2 taken 452093 times.
✗ Branch 3 not taken.
452093 belongs.emplace_back(std::move(res));
30 452093 }
31 };
32
2/2
✓ Branch 1 taken 1149503 times.
✓ Branch 2 taken 21 times.
1149524 flt_ (u32, i, 0, g.vsize())
33
2/2
✓ Branch 1 taken 137450 times.
✓ Branch 2 taken 1012053 times.
1149503 if (!dfn[i]) tarjan(tarjan, i, -1_u32);
34 21 }
35 };
36
37 } // namespace tifa_libs
38