22#include " bucket.h"
33#include " sketch_concept.h"
44
5+ #include < cmath>
6+
57#include " util.h"
68
79#include < hwy/highway.h>
@@ -31,13 +33,28 @@ class FixedSizeSketchColumn {
3133 ~FixedSizeSketchColumn ();
3234 SketchSample<vec_t > sample () const ;
3335 void clear ();
36+
3437 void update (const vec_t update);
3538 void merge (FixedSizeSketchColumn &other);
3639 uint8_t get_depth () const ;
3740 void serialize (std::ostream &binary_out) const ;
41+
42+ static uint8_t suggest_capacity (size_t num_vertices) {
43+ size_t num_edges = num_vertices * (num_vertices - 1 ) / 2 ;
44+ return static_cast <uint8_t >(1 + ceil (log2 (num_edges)));
45+ }
46+
47+ [[deprecated]]
48+
3849 void reset_sample_state () {
3950 // no-op
4051 };
52+
53+ [[deprecated]]
54+ void zero_contents () {
55+ clear ();
56+ }
57+
4158 bool operator ==(const FixedSizeSketchColumn &other) const {
4259 for (size_t i = 0 ; i < capacity; ++i) {
4360 if (buckets[i] != other.buckets [i]) {
@@ -56,6 +73,7 @@ class FixedSizeSketchColumn {
5673 }
5774 return os;
5875 }
76+
5977};
6078
6179
@@ -78,9 +96,20 @@ class ResizeableSketchColumn {
7896 void update (const vec_t update);
7997 void merge (ResizeableSketchColumn &other);
8098 uint8_t get_depth () const ;
99+
100+ [[deprecated]]
101+ void zero_contents () {
102+ clear ();
103+ }
104+
81105 void reset_sample_state () {
82106 // no-op
83107 };
108+
109+ static uint8_t suggest_capacity (size_t num_vertices) {
110+ return 4 ;
111+ }
112+
84113 void serialize (std::ostream &binary_out) const ;
85114 bool operator ==(const ResizeableSketchColumn &other) const {
86115 for (size_t i = 0 ; i < capacity; ++i) {
0 commit comments