-
Notifications
You must be signed in to change notification settings - Fork 0
/
eclat.c
37 lines (31 loc) · 924 Bytes
/
eclat.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdlib.h>
#include "eclat.h"
void eclat_rec(itemnode_t *prefix_end, itemnode_t *item_start, long minsup)
{
itemnode_t *node;
for (node=item_start; node!=NULL; node=node->right)
{
wrapped_bitmap_t *r = wrapped_bitmap_and(prefix_end->bitset->bitmap, node->bitset->bitmap);
long freq = wrapped_bitmap_get_cardinality(r);
if (freq < minsup)
{
wrapped_bitmap_free(r);
continue;
}
itemnode_t *n = (itemnode_t *)malloc(sizeof(itemnode_t));
n->item = node->item;
n->bitset = (bitset_t *)malloc(sizeof(bitset_t));
n->bitset->bitmap = r;
n->bitset->card = freq; // need this?
n->count = freq;
n->down = NULL;
itemtree_insert_down(prefix_end, n);
eclat_rec(n, node->right, minsup);
}
}
void eclat(itemnode_t *root, long minsup)
{
itemnode_t *node;
for (node=root; node!=NULL; node=node->right)
eclat_rec(node, node->right, minsup);
}