summaryrefslogtreecommitdiff
path: root/content/graph/cycleCounting.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'content/graph/cycleCounting.cpp')
-rw-r--r--content/graph/cycleCounting.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/content/graph/cycleCounting.cpp b/content/graph/cycleCounting.cpp
index 6a299ee..deac71e 100644
--- a/content/graph/cycleCounting.cpp
+++ b/content/graph/cycleCounting.cpp
@@ -9,8 +9,8 @@ struct cycles {
cycles(int n) : adj(n), seen(n), paths(n) {}
void addEdge(int u, int v) {
- adj[u].push_back({v, sz(edges)});
- adj[v].push_back({u, sz(edges)});
+ adj[u].push_back({v, ssize(edges)});
+ adj[v].push_back({u, ssize(edges)});
edges.push_back({u, v});
}
@@ -36,10 +36,10 @@ struct cycles {
cur[id].flip();
}}}
- bool isCycle(cycle cur) {//cycle must be constrcuted from base
+ bool isCycle(cycle cur) {// cycle must be constructed from base
if (cur.none()) return false;
- init(sz(adj)); // union find @\sourceref{datastructures/unionFind.cpp}@
- for (int i = 0; i < sz(edges); i++) {
+ init(ssize(adj)); // union find @\sourceref{datastructures/unionFind.cpp}@
+ for (int i = 0; i < ssize(edges); i++) {
if (cur[i]) {
cur[i] = false;
if (findSet(edges[i].first) ==
@@ -50,12 +50,12 @@ struct cycles {
}
int count() {
- for (int i = 0; i < sz(adj); i++) findBase(i);
- assert(sz(base) < 30);
+ for (int i = 0; i < ssize(adj); i++) findBase(i);
+ assert(ssize(base) < 30);
int res = 0;
- for (int i = 1; i < (1 << sz(base)); i++) {
+ for (int i = 1; i < (1 << ssize(base)); i++) {
cycle cur;
- for (int j = 0; j < sz(base); j++)
+ for (int j = 0; j < ssize(base); j++)
if (((i >> j) & 1) != 0) cur ^= base[j];
if (isCycle(cur)) res++;
}