summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGloria Mundi <gloria@gloria-mundi.eu>2025-02-15 14:48:08 +0100
committerGloria Mundi <gloria@gloria-mundi.eu>2025-02-15 14:48:08 +0100
commit57d99fb1601940a45aea30037396ddf0fb7c9c3d (patch)
tree2f98910f500ee52018e62b689a81f48ae1553e36 /test
parent9ffe82d6be37b4aede025a35abccdaa43d064ddd (diff)
shorten sccs and collect scc lists
Diffstat (limited to 'test')
-rw-r--r--test/graph/scc.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/graph/scc.cpp b/test/graph/scc.cpp
index cf4efc7..46ad201 100644
--- a/test/graph/scc.cpp
+++ b/test/graph/scc.cpp
@@ -28,7 +28,16 @@ void stress_test() {
return seen;
};
+ vector<int> seen(n);
+ for (int i = 0; i < ssize(sccs); i++) {
+ for (int v: sccs[i]) {
+ if (idx[v] != i) cerr << v << " is in scc " << i << ", but idx[" << v << "] = " << idx[v] << FAIL;
+ seen[v]++;
+ }
+ }
+
for (int a = 0; a < n; a++) {
+ if (seen[a] != 1) cerr << a << " occurs " << seen[a] << " times in sccs" << FAIL;
vector<bool> reacha = reach(a);
for (int b = 0; b < n; b++) {
if (idx[a] == idx[b]) {