forked from ahmed-shariff/StreamRarePatternMining2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSRPTree.h
66 lines (58 loc) · 1.51 KB
/
SRPTree.h
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#pragma once
#include <iostream>
#include <fstream>
#include <vector>
#include <sstream>
#include <list>
#include <map>
#include <set>
#include <limits>
#include "FPTree.h"
using namespace std;
struct TreeNode {
int elementValue;
int elementFrequency;
TreeNode* up;
list<TreeNode*> down;
TreeNode* nextSimilar;
TreeNode* prevSimilar;
};
struct ConnectionRow {
TreeNode* firstOccurrence;
map <int, int> connectedElements; //key value is element number and the other value is frequency
int elementFrequency;
TreeNode* lastOccurrence;
};
class SRPTree {
int rareMinSup;
int freqMinSup;
int windowSize; //number of transactions after which mining should start
int inputWindowSize; //input window size given by a user
int distinctElements;
int inputDistinctElements;
string filename;
string sConfigFileLine;
ifstream in;
ifstream configStream;
TreeNode *rootNode;
bool useDfs;
map <int, ConnectionRow*> connectionTable;
string sTransaction; //One Transaction information in string
list<int> iTransaction; //List of integers for each transaction
void ExtractIntegersToList();
void AddElementFrequency();
void AddToTree();
void AddToConnectionTable();
TreeNode* AllocateTreeNodeMemory(int value);
ConnectionRow* AllocateConnectionRow();
void clearPreviousWindow();
void DeleteTreeNodes();
void ClearWhiteSpace();
public:
SRPTree();
int Initialize();
int Finalize();
int ReadTransaction();
int GetWindowSize();
map<set<int>, int> Mine();
};