src/graph/clique/enum/lib.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../../../util/alias/others/lib.hpp" | ||
| 4 | |||
| 5 | namespace tifa_libs { | ||
| 6 | |||
| 7 | // enumerate all maximal cliques | ||
| 8 | // @param P possibly in clique | ||
| 9 | // @param X not in clique | ||
| 10 | // @param R in clique | ||
| 11 | template <usz N, class F> | ||
| 12 | requires requires(F f, std::bitset<N> R) { f(R); } | ||
| 13 | 16 | CEXP void cliques(u32 n, arr<std::bitset<N>, N> CR adj, F&& f) NE { | |
| 14 | using B = std::bitset<N>; | ||
| 15 | 3154505 | auto g = [&](auto&& g, B P, B X, B R) NE -> void { | |
| 16 |
2/2✓ Branch 1 taken 2220970 times.
✓ Branch 2 taken 933519 times.
|
3154489 | if (P.none()) { |
| 17 |
2/2✓ Branch 1 taken 2218310 times.
✓ Branch 2 taken 2660 times.
|
2220970 | if (X.none()) f(R); |
| 18 | 2220970 | return; | |
| 19 | } | ||
| 20 | 933519 | B _ = P & ~adj[(P | X)._Find_first()]; | |
| 21 |
2/2✓ Branch 0 taken 37326992 times.
✓ Branch 1 taken 933519 times.
|
38260511 | flt_ (u32, i, 0, n) |
| 22 |
2/2✓ Branch 3 taken 3154473 times.
✓ Branch 4 taken 34172519 times.
|
37326992 | if (_[i]) R[i] = 1, g(g, P & adj[i], X & adj[i], R), R[i] = P[i] = 0, X[i] = 1; |
| 23 | }; | ||
| 24 | 16 | g(g, ~B(), B(), B()); | |
| 25 | 16 | } | |
| 26 | |||
| 27 | } // namespace tifa_libs | ||
| 28 |