diff --git a/graph/hyperanf.h b/graph/hyperanf.h index f3787a4..60bf52d 100644 --- a/graph/hyperanf.h +++ b/graph/hyperanf.h @@ -75,7 +75,6 @@ class HyperANF { for (int n = 0; n < num; n++) { uint64_t x = rng.randint(); int reg_idx = (x >> (64 - p_)) & ((1 << p_) - 1); - // uint8_t reg_rho = hll::clz8(x << p_ | 1 << (p_ - 1)) + 1; uint8_t reg_rho = hll::clz8(x << p_) + 1; if (reg_rho > reg_array[reg_idx]) reg_array[reg_idx] = reg_rho; } diff --git a/test/test_hyperanf.cpp b/test/test_hyperanf.cpp index 1604ef6..a26c206 100644 --- a/test/test_hyperanf.cpp +++ b/test/test_hyperanf.cpp @@ -24,26 +24,18 @@ void test_anf_single() { anf.initBitsCC(graph); printf("ANF: %.4fs\n", tm.seconds()); - printf("nd\ttruth\ttime\test\ttime\terror(%%)\n"); + printf("nd\ttruth\test\terror\n"); - // auto fw = ioutils::getIOOut("hepth_anf.dat"); - for (int i = 0; i < 100; i++) { - int nd = graph.sampleNode(); + for (auto ni = graph.beginNI(); ni != graph.endNI(); ni++) { + int nd = ni->first; - tm.tick(); bfs.doBFS(nd); - int truth = bfs.getBFSTreeSize(); - double t1 = tm.seconds(); - tm.tick(); + int truth = bfs.getBFSTreeSize(); double est = anf.estimate(nd); - double t2 = tm.seconds(); - - double err = std::abs(est - truth) / truth * 100; + double err = std::abs(est - truth) / truth; - printf("%d\t%d\t%.2e\t%.2f\t%.2e\t%.2f\n", nd, truth, t1, est, t2, err); - // fw->save("{:d}\t{:d}\t{:.3e}\t{:.3f}\t{:.3e}\t{:.2f}\n"_format( - // nd, truth, t1, est, t2, err)); + printf("%d\t%d\t%.2f\t%.4f\n", nd, truth, est, err); } }