effspm 0.1.5__cp311-cp311-win_amd64.whl → 0.2.6__cp311-cp311-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. effspm/__init__.py +9 -2
  2. effspm/_core.cpp +91 -13
  3. effspm/_effspm.cp311-win_amd64.pyd +0 -0
  4. effspm/_effspm.cpp +609 -0
  5. effspm/btminer/src/build_mdd.cpp +63 -0
  6. effspm/btminer/src/build_mdd.hpp +40 -0
  7. effspm/btminer/src/freq_miner.cpp +179 -0
  8. effspm/btminer/src/freq_miner.hpp +39 -0
  9. effspm/btminer/src/load_inst.cpp +200 -0
  10. effspm/btminer/src/load_inst.hpp +25 -0
  11. effspm/btminer/src/utility.cpp +65 -0
  12. effspm/btminer/src/utility.hpp +40 -0
  13. effspm/freq_miner.hpp +7 -2
  14. effspm/htminer/src/build_mdd.cpp +192 -0
  15. effspm/htminer/src/build_mdd.hpp +64 -0
  16. effspm/htminer/src/freq_miner.cpp +350 -0
  17. effspm/htminer/src/freq_miner.hpp +60 -0
  18. effspm/htminer/src/load_inst.cpp +394 -0
  19. effspm/htminer/src/load_inst.hpp +23 -0
  20. effspm/htminer/src/utility.cpp +72 -0
  21. effspm/htminer/src/utility.hpp +77 -0
  22. effspm/largebm/src/build_mdd.cpp +137 -0
  23. effspm/largebm/src/build_mdd.hpp +47 -0
  24. effspm/largebm/src/freq_miner.cpp +349 -0
  25. effspm/largebm/src/freq_miner.hpp +48 -0
  26. effspm/largebm/src/load_inst.cpp +230 -0
  27. effspm/largebm/src/load_inst.hpp +45 -0
  28. effspm/largebm/src/utility.cpp +45 -0
  29. effspm/largebm/src/utility.hpp +18 -0
  30. effspm/largehm/src/build_mdd.cpp +174 -0
  31. effspm/largehm/src/build_mdd.hpp +93 -0
  32. effspm/largehm/src/freq_miner.cpp +445 -0
  33. effspm/largehm/src/freq_miner.hpp +77 -0
  34. effspm/largehm/src/load_inst.cpp +357 -0
  35. effspm/largehm/src/load_inst.hpp +64 -0
  36. effspm/largehm/src/utility.cpp +38 -0
  37. effspm/largehm/src/utility.hpp +29 -0
  38. effspm/largepp/src/freq_miner.cpp +170 -0
  39. effspm/largepp/src/freq_miner.hpp +43 -0
  40. effspm/largepp/src/load_inst.cpp +219 -0
  41. effspm/largepp/src/load_inst.hpp +28 -0
  42. effspm/largepp/src/utility.cpp +34 -0
  43. effspm/largepp/src/utility.hpp +21 -0
  44. effspm/load_inst.hpp +18 -12
  45. effspm-0.2.6.dist-info/METADATA +237 -0
  46. effspm-0.2.6.dist-info/RECORD +53 -0
  47. {effspm-0.1.5.dist-info → effspm-0.2.6.dist-info}/WHEEL +1 -1
  48. effspm/_core.cp311-win_amd64.pyd +0 -0
  49. effspm-0.1.5.dist-info/METADATA +0 -38
  50. effspm-0.1.5.dist-info/RECORD +0 -14
  51. {effspm-0.1.5.dist-info → effspm-0.2.6.dist-info}/licenses/LICENSE +0 -0
  52. {effspm-0.1.5.dist-info → effspm-0.2.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,394 @@
1
+ #include <iostream>
2
+ #include <fstream>
3
+ #include <sstream>
4
+ #include <cmath>
5
+ #include <ctime>
6
+ #include "load_inst.hpp"
7
+ #include "freq_miner.hpp"
8
+ #include "utility.hpp"
9
+ #include "build_mdd.hpp"
10
+
11
+ namespace htminer {
12
+ using namespace std;
13
+
14
+ // unsigned int M = 0, mlim;
15
+ // unsigned long long E = 0;
16
+
17
+ // unsigned long long int N = 0, L = 0, theta;
18
+
19
+ bool itmset_exists = 0;
20
+
21
+ vector<int> item_dic;
22
+ // vector<Pattern> DFS;
23
+ // vector<VPattern> VDFS;
24
+
25
+ void Load_items_pre(string &inst_name);
26
+ bool Load_items(string &inst_name);
27
+ bool Preprocess(string& inst, double thresh);
28
+
29
+ bool Load_instance(std::string& items_file, double thresh) {
30
+ // Debug: entry
31
+ // std::cerr << "[HTMiner::Load_instance] called with file=\"" << items_file
32
+ // << "\" minsup=" << thresh << std::endl;
33
+
34
+ // ── RESET EVERYTHING BEFORE BUILDING ───────────────────────────────────
35
+ Tree.clear();
36
+ CTree.clear();
37
+ VTree.clear();
38
+ DFS.clear();
39
+ VDFS.clear();
40
+ N = 0;
41
+ M = 0;
42
+ L = 0;
43
+ E = 0;
44
+ itmset_exists = false;
45
+
46
+ std::clock_t kk = std::clock();
47
+
48
+
49
+ // Initialize root of Tree (after reset)
50
+ Tree.emplace_back(0, 0, 0);
51
+ Tree[0].itmset = 1;
52
+ {
53
+ std::vector<unsigned int> dummyAnc(L, 0);
54
+ std::vector<int> dummyItems;
55
+ CTree.emplace_back(dummyAnc, dummyItems);
56
+ VTree.emplace_back(); // calls VArc() default ctor
57
+ }
58
+
59
+ // ─── Allocate DFS/VDFS to length L so that Add_vec can index them ───
60
+ DFS.reserve(L);
61
+ for (unsigned int i = 0; i < L; ++i)
62
+ DFS.emplace_back(-static_cast<int>(i) - 1);
63
+ VDFS.resize(L);
64
+
65
+ if (pre_pro) {
66
+ // std::cerr << "[HTMiner::Load_instance] pre_pro flag is true; calling Preprocess" << std::endl;
67
+ if (!Preprocess(items_file, thresh)) {
68
+ // std::cerr << "[HTMiner::Load_instance] Preprocess failed; returning false" << std::endl;
69
+ return false;
70
+ }
71
+ // std::cout << "\nPreprocess done in " << give_time(std::clock() - kk) << " seconds\n\n";
72
+
73
+ // Reserve DFS stack
74
+ DFS.reserve(L);
75
+ for (int i = 0; i < static_cast<int>(L); ++i)
76
+ DFS.emplace_back(-i - 1);
77
+
78
+ kk = std::clock();
79
+ //std::cerr << "[HTMiner::Load_instance] calling Load_items_pre" << std::endl;
80
+ Load_items_pre(items_file);
81
+
82
+ // If Tree is very large, shrink vectors
83
+ if (Tree.size() > 100000000) {
84
+ Tree.shrink_to_fit();
85
+ CTree.shrink_to_fit();
86
+ VTree.shrink_to_fit();
87
+ // std::cerr << "[HTMiner::Load_instance] Shrunk Tree, CTree, VTree to fit" << std::endl;
88
+ }
89
+ // std::cerr << "[HTMiner::Load_instance] Load_items_pre completed; N=" << N
90
+ // << " M=" << M << " L=" << L << " E=" << E << std::endl;
91
+ }
92
+ else if (!Load_items(items_file)) {
93
+ // std::cerr << "[HTMiner::Load_instance] Load_items failed; returning false" << std::endl;
94
+ return false;
95
+ }
96
+ else {
97
+ // Calculate absolute theta if user passed a fraction
98
+ if (thresh < 1.0) {
99
+ theta = static_cast<unsigned long long>(std::ceil(thresh * N));
100
+ //std::cerr << "[HTMiner::Load_instance] Computed theta = ceil(" << thresh << " * " << N << ") = " << theta << std::endl;
101
+ } else {
102
+ theta = static_cast<unsigned long long>(thresh);
103
+ // std::cerr << "[HTMiner::Load_instance] Using theta = " << theta << " (absolute)" << std::endl;
104
+ }
105
+ // std::cerr << "[HTMiner::Load_instance] No preprocessing; Load_items succeeded; N=" << N
106
+ // << " M=" << M << " L=" << L << " E=" << E << std::endl;
107
+ }
108
+
109
+
110
+
111
+ std::cout << "\nMDD Database built in " << give_time(std::clock() - kk) << " seconds\n\n";
112
+ std::cout << "Found " << N << " sequence, with max line len " << M
113
+ << ", and " << L << " items, and " << E << " enteries\n";
114
+ // std::cout << "Total Trie nodes: " << Tree.size()
115
+ // << " Total CTree nodes: " << CTree.size()
116
+ // << " Total VTree nodes: " << VTree.size() << std::endl;
117
+
118
+ // std::cerr << "[HTMiner::Load_instance] Exiting normally; returning true" << std::endl;
119
+ return true;
120
+ }
121
+
122
+
123
+ bool Preprocess(string &inst, double thresh) {
124
+
125
+ //std::cerr << "[HTMiner::Preprocess] called with \"" << inst << "\" minsup=" << thresh << std::endl; //DEBUG
126
+
127
+
128
+ vector<unsigned long long int> MN(100, 0);
129
+ vector<vector<bool>> ML(100, vector<bool>(1000000, 0));
130
+
131
+
132
+ ifstream file(inst);
133
+
134
+ vector<unsigned int> freq(1000000, 0);
135
+ vector<unsigned long long int> counted(1000000, 0);
136
+
137
+ if (file.good()) {
138
+ string line;
139
+ int ditem;
140
+ while (getline(file, line) && give_time(clock() - start_time) < time_limit) {
141
+ ++N;
142
+
143
+ //if (N % 10000000 == 0)
144
+ //cout << "N: " << N << endl;
145
+ istringstream word(line);
146
+ string itm;
147
+ int size_m = 0;
148
+ while (word >> itm) {
149
+ ++size_m;
150
+ ditem = stoi(itm);
151
+
152
+ if (ditem > 0)
153
+ itmset_exists = 1;
154
+ else
155
+ ditem *= -1;
156
+
157
+ if (size_m < MN.size()) {
158
+ ++MN[size_m - 1];
159
+ if (ML[size_m - 1].size() < ditem) {
160
+ ML[size_m - 1].reserve(ditem);
161
+ while (ML[size_m - 1].size() < ditem)
162
+ ML[size_m - 1].push_back(0);
163
+ }
164
+ ML[size_m - 1][ditem - 1] = 1;
165
+ }
166
+
167
+ if (L < ditem)
168
+ L = ditem;
169
+
170
+ if (freq.size() < L) {
171
+ freq.reserve(L);
172
+ counted.reserve(L);
173
+ while (freq.size() < L) {
174
+ freq.push_back(0);
175
+ counted.push_back(0);
176
+ }
177
+ }
178
+
179
+ if (counted[ditem - 1] != N) {
180
+ ++freq[ditem - 1];
181
+ counted[ditem - 1] = N;
182
+ }
183
+
184
+ }
185
+ if (size_m > M)
186
+ M = size_m;
187
+ }
188
+ }
189
+ else {
190
+ //cout << "!!!!!! No such file exists: " << inst << " !!!!!!\n";
191
+ return 0;
192
+ }
193
+
194
+ if (thresh < 1)
195
+ theta = ceil(thresh * N);
196
+ else
197
+ theta = thresh;
198
+
199
+ int real_L = 0;
200
+ item_dic = vector<int>(L, -1);
201
+ vector<bool> item_in(L, 0);
202
+ for (int i = 0; i < L; ++i) {
203
+ if (freq[i] >= theta) {
204
+ item_dic[i] = ++real_L;
205
+ item_in[i] = 1;
206
+ }
207
+ }
208
+
209
+ //cout << "Original number of items: " << L << " Reduced to: " << real_L << endl;
210
+
211
+ unsigned long long int LpM = 1;
212
+ mlim = M;
213
+ int orgmlim;
214
+ int ulim = min(3 + real_L / 5, 10);
215
+ unsigned long long int ml;
216
+ int coef = 1 + 1 * itmset_exists;
217
+ for (int i = 0; i + ulim < MN.size() && i + ulim < M; ++i) {
218
+ ml = 0;
219
+ for (int j = 0; j < L; ++j) {
220
+ if (ML[i][j] && item_in[j])
221
+ ++ml;
222
+ }
223
+ LpM *= ml * coef;
224
+ // cout << ml << " " << LpM << " " << MN[i] << endl;
225
+ if (LpM * ulim > MN[i]) {
226
+ if (6 * (MN[i] - LpM) >= 5 * MN[i])
227
+ orgmlim = i;
228
+ while (i + ulim - 1 < MN.size() && i + ulim - 1 < M) {
229
+ // cout << MN[i - 1] - MN[i + ulim - 1] << " " << MN[i + ulim - 1] << endl;
230
+ if (MN[i - 1] - MN[i + ulim - 1] < MN[i + ulim - 1] && MN[i + ulim - 1] < 600000000 ) {
231
+ mlim = i - 1;
232
+ break;
233
+ }
234
+ i += 1;
235
+ }
236
+ break;
237
+ }
238
+ }
239
+
240
+ // cout << "M is: " << M << " Mlim is: " << mlim << " ulim is: " << ulim << " original mlim is: " << orgmlim << " guess is: " << round((log(N) - log(6)) / log(real_L)) << endl;
241
+
242
+
243
+ if (mlim < M) {
244
+ for (int i = 0; i < real_L; ++i)
245
+ VDFS.emplace_back(i);
246
+ if (MN[mlim + ulim] > 100000000) {
247
+ CTree.reserve(MN[mlim + ulim] / 2);
248
+ VTree.reserve(MN[mlim + ulim] / 2);
249
+ Tree.reserve((N - MN[mlim + ulim]) * 2);
250
+ }
251
+ }
252
+ else if (N > 100000000)
253
+ Tree.reserve(500000000);
254
+
255
+
256
+ L = real_L;
257
+ N = 0;
258
+ M = 0;
259
+
260
+ return 1;
261
+ }
262
+
263
+
264
+ void Load_items_pre(string &inst_name) {
265
+
266
+ ifstream file(inst_name);
267
+
268
+ if (file.good()) {
269
+ string line;
270
+ int ditem;
271
+ while (getline(file, line) && give_time(clock() - start_time) < time_limit) {
272
+ istringstream word(line);
273
+ string itm;
274
+ vector<int> temp_vec;
275
+ vector<int> temp_lim;
276
+ bool sgn = 0;
277
+ while (word >> itm) {
278
+
279
+ ditem = stoi(itm);
280
+
281
+ if (item_dic[abs(ditem) - 1] == -1) {
282
+ if (!sgn)
283
+ sgn = ditem < 0;
284
+ continue;
285
+ }
286
+ else {
287
+ if (ditem > 0)
288
+ ditem = item_dic[ditem - 1];
289
+ else
290
+ ditem = -item_dic[-ditem - 1];
291
+ }
292
+
293
+ if (sgn) {
294
+ if (ditem > 0)
295
+ ditem = -ditem;
296
+ sgn = 0;
297
+ }
298
+
299
+ if (temp_vec.size() <= mlim)
300
+ temp_vec.push_back(ditem);
301
+ else
302
+ temp_lim.push_back(ditem);
303
+ }
304
+
305
+ if (temp_vec.empty())
306
+ continue;
307
+
308
+ ++N;
309
+ //if (N % 1000000 == 0)
310
+ // cout << N << " " << Tree.size() << " " << CTree.size() << " " << VTree.size() << endl;
311
+
312
+ if (temp_vec.size() + temp_lim.size() > M)
313
+ M = temp_vec.size() + temp_lim.size();
314
+
315
+ Build_MDD(temp_vec, temp_lim);
316
+ }
317
+ }
318
+
319
+ }
320
+
321
+ bool Load_items(std::string &inst_name) {
322
+ //std::cerr << "[HTMiner::Load_items] called with filename=\"" << inst_name << "\"" << std::endl; // DEBUG
323
+ unsigned int mlim = 0;
324
+ // reset the global M and E here instead of redeclaring:
325
+ M = 0;
326
+ E = 0;
327
+
328
+ std::ifstream file(inst_name);
329
+ if (!file.good()) {
330
+ //std::cerr << "[HTMiner::Load_items] ERROR: No such file: " << inst_name << std::endl;
331
+ return false;
332
+ }
333
+
334
+ std::string line;
335
+ int ditem;
336
+ while (std::getline(file, line) && give_time(std::clock() - start_time) < time_limit) {
337
+ ++N;
338
+ if (N % 1000000 == 0) {
339
+ // std::cerr << "[HTMiner::Load_items] Read " << N << " sequences so far; "
340
+ // << "current M=" << M << ", L=" << L << ", E=" << E << std::endl;
341
+ }
342
+
343
+ std::istringstream word(line);
344
+ std::vector<int> temp_vec;
345
+ std::vector<int> temp_lim;
346
+ while (word >> ditem) {
347
+ E+=1;
348
+ if (ditem > 0)
349
+ itmset_exists = 1;
350
+
351
+ if (std::abs(ditem) > static_cast<int>(L)) {
352
+ L = std::abs(ditem);
353
+ //std::cerr << "[HTMiner::Load_items] Updated L to " << L << " (expanding DFS and VDFS)" << std::endl;
354
+ // Expand DFS
355
+ while (DFS.size() < L) {
356
+ DFS.reserve(L);
357
+ DFS.emplace_back(-static_cast<int>(DFS.size()) - 1);
358
+ }
359
+ // ALSO expand VDFS so that VDFS[cur_itm-1] is valid later
360
+ VDFS.resize(L);
361
+ }
362
+
363
+ if (temp_vec.size() < mlim)
364
+ temp_vec.push_back(ditem);
365
+ else
366
+ temp_lim.push_back(ditem);
367
+ }
368
+
369
+ if (temp_vec.size() + temp_lim.size() > M) {
370
+ M = temp_vec.size() + temp_lim.size();
371
+ //std::cerr << "[HTMiner::Load_items] Updated M to " << M << std::endl;
372
+ }
373
+
374
+ // std::cerr << "[HTMiner::Load_items] Calling Build_MDD with temp_vec size=" << temp_vec.size()
375
+ // << ", temp_lim size=" << temp_lim.size() << std::endl;
376
+ Build_MDD(temp_vec, temp_lim);
377
+ //std::cerr << "[HTMiner::Load_items] Build_MDD returned; Tree size now=" << Tree.size() << std::endl;
378
+ }
379
+
380
+ // std::cerr << "[HTMiner::Load_items] Finished loading. Final counts: N=" << N
381
+ // << ", M=" << M << ", L=" << L << ", E=" << E << std::endl;
382
+ return true;
383
+ }
384
+
385
+ }
386
+
387
+
388
+
389
+
390
+
391
+
392
+
393
+
394
+
@@ -0,0 +1,23 @@
1
+ #pragma once
2
+
3
+ #include <vector>
4
+ #include <string>
5
+ #include <fstream>
6
+ #include <map>
7
+ #include <unordered_set>
8
+ #include <unordered_map>
9
+ namespace htminer {
10
+ using namespace std;
11
+
12
+ bool Load_instance(string& items_file, double thresh);
13
+
14
+ extern string out_file, folder;
15
+
16
+ extern bool b_disp, b_write, use_dic, just_build, pre_pro, itmset_exists;
17
+
18
+ extern unsigned int M, mlim, time_limit;
19
+
20
+ extern unsigned long long int N, L, theta;
21
+
22
+ extern clock_t start_time;
23
+ }
@@ -0,0 +1,72 @@
1
+ #include "utility.hpp"
2
+ #include "load_inst.hpp"
3
+ #include "freq_miner.hpp"
4
+ #include <vector>
5
+ namespace htminer {
6
+
7
+ // ─── Flag‐like globals ──────────────────────────────────────────────────────
8
+ bool use_list = false;
9
+ bool just_build = false;
10
+ bool b_disp = false;
11
+ bool b_write = false;
12
+ bool use_dic = false;
13
+ bool pre_pro = false;
14
+
15
+ unsigned int time_limit = 0;
16
+ std::string out_file = "";
17
+ std::clock_t start_time = 0;
18
+
19
+ // ─── Dataset‐level globals ─────────────────────────────────────────────────
20
+ std::vector<std::vector<int>> items;
21
+ unsigned long long N = 0;
22
+ unsigned long long L = 0;
23
+ unsigned long long theta = 0;
24
+ unsigned int M = 0;
25
+ unsigned long long E = 0;
26
+ unsigned int mlim = 0;
27
+ // ─── DFS stacks ─────────────────────────────────────────────────────────────
28
+ std::vector<Pattern> DFS;
29
+ std::vector<VPattern> VDFS;
30
+
31
+ // ─── Collected patterns storage ────────────────────────────────────────────
32
+ std::vector<std::vector<int>> collectedPatterns;
33
+ const std::vector<std::vector<int>>& GetCollected() {
34
+ return collectedPatterns;
35
+ }
36
+
37
+ // ─── give_time and check_parent get their definitions here (as provided) ───
38
+ float give_time(std::clock_t kk) {
39
+ return static_cast<float>(kk) / static_cast<float>(CLOCKS_PER_SEC);
40
+ }
41
+ bool check_parent(unsigned int cur_anct, unsigned int str_pnt, unsigned int start, vector<unsigned int>& strpnt_vec) {
42
+
43
+ vector<unsigned int> ancestors;
44
+
45
+ while (abs(Tree[cur_anct].itmset) > abs(Tree[str_pnt].itmset)) {
46
+ if (Tree[cur_anct].item > 0)
47
+ ancestors.push_back(cur_anct);
48
+ cur_anct = Tree[cur_anct].anct;
49
+ }
50
+
51
+ if (abs(Tree[cur_anct].itmset) == abs(Tree[str_pnt].itmset))
52
+ return 1;
53
+ else {
54
+ for (vector<unsigned int>::reverse_iterator it = ancestors.rbegin(); it != ancestors.rend(); ++it) {
55
+ for (unsigned int i = start; i < strpnt_vec.size(); ++i) {
56
+ if (strpnt_vec[i] == *it)
57
+ return 1;
58
+ }
59
+ }
60
+ }
61
+
62
+
63
+ return 0;
64
+
65
+ }
66
+
67
+
68
+
69
+
70
+
71
+
72
+ }
@@ -0,0 +1,77 @@
1
+ #pragma once
2
+
3
+ #include <vector>
4
+ #include <ctime>
5
+ #include <string>
6
+ #include "build_mdd.hpp"
7
+ #include "freq_miner.hpp"
8
+ #include "load_inst.hpp"
9
+
10
+ namespace htminer {
11
+
12
+ // ─── Global flags and counters ─────────────────────────────────────────────
13
+ /// Controls whether to mine in “list” mode (unused for HTMiner, but declared)
14
+ extern bool use_list;
15
+ /// If true, only build MDD and exit (don’t actually mine)
16
+ extern bool just_build;
17
+ /// If true, print each pattern to stdout as it’s found
18
+ extern bool b_disp;
19
+ /// If true, write each pattern to file (see out_file)
20
+ extern bool b_write;
21
+ /// If true, use a dictionary‐file mapping items → new IDs
22
+ extern bool use_dic;
23
+ /// If true, preprocess input (create dictionary) instead of mining
24
+ extern bool pre_pro;
25
+
26
+ /// Time limit (in seconds) for mining before forced exit
27
+ extern unsigned int time_limit;
28
+ /// Output filename (if b_write is true)
29
+ extern std::string out_file;
30
+ /// Clock tick when mining started
31
+ extern std::clock_t start_time;
32
+
33
+ // ─── Data‐set‐level globals ─────────────────────────────────────────────────
34
+ /// The input sequences (each sequence is a vector of integers)
35
+ extern std::vector<std::vector<int>> items;
36
+ /// Number of sequences (items.size())
37
+ extern unsigned long long N;
38
+ /// Number of distinct items (max absolute item ID)
39
+ extern unsigned long long L;
40
+ /// Minimum support threshold (absolute count, not fraction)
41
+ extern unsigned long long theta;
42
+ /// Maximum sequence length across all items
43
+ extern unsigned int M;
44
+ /// Total number of “entries” (sum of all sequence lengths)
45
+ extern unsigned long long E;
46
+
47
+ // ─── Per‐pattern DFS stacks ─────────────────────────────────────────────────
48
+ /// DFS stack of “in‐memory” patterns (each Pattern holds its own ilist/slist, freq, str_pnt, etc.)
49
+ extern std::vector<Pattern> DFS;
50
+
51
+ extern std::vector<std::vector<int>> collectedPatterns;
52
+ // ─── Collected output ───────────────────────────────────────────────────────
53
+ /// Clears any patterns left in DFS (called at the start of each run)
54
+ inline void ClearCollected() {
55
+ DFS.clear();
56
+ collectedPatterns.clear();
57
+ }
58
+ /// Returns a reference to the entire “collected patterns” vector
59
+ /// (each Pattern knows how to output itself as a vector<int>)
60
+ const std::vector<std::vector<int>>& GetCollected();
61
+
62
+ // ─── Helper functions ───────────────────────────────────────────────────────
63
+ /// Given a clock‐tick difference, return elapsed seconds as a float
64
+ float give_time(std::clock_t kk);
65
+
66
+ /// Check whether a candidate can extend its parent pattern:
67
+ /// cur_arc = current Arc node ID in MDD
68
+ /// str_pnt = string‐pointer of the existing pattern
69
+ /// start = starting index within the MDD arc‐list
70
+ /// strpnt_vec = parent’s “string pointers” vector
71
+ /// Returns true if `cur_arc` is a valid child of `str_pnt` from position `start`.
72
+ bool check_parent(unsigned int cur_arc,
73
+ unsigned int str_pnt,
74
+ unsigned int start,
75
+ std::vector<unsigned int>& strpnt_vec);
76
+
77
+ } // namespace htminer