-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathseed.h
More file actions
112 lines (69 loc) · 2.35 KB
/
seed.h
File metadata and controls
112 lines (69 loc) · 2.35 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
* Seed.h
*
* Created on: 01-Dec-2009
* Author: freid
*/
#ifndef SEED_H_
#define SEED_H_
#include <math.h>
#include <set>
#include <map>
#include <algorithm>
#include "../util/graph/graph_representation.hpp"
//This class operates on a single representation of the graph, expected to be in global variable g
extern SimpleIntGraph theGlobalGraph;
class Seed {
public:
//responsible for updating the cached edges
//adds a node, which is assumed not to be contained, and updates the cached internal edges
void addNodeFromFrontier(V newNode);
void addNode(V newNode);
static float minimumOverlapToMerge;
static float alphaValueForFitness;
//need a calculate overlap method
//Calculate the current fitness of the seed.
float calculateFitness();
pair<int, int> calculateEdgesIfInsertFromFrontier(V newNode);
//float calculateFitnessIfInsertFromFrontier(V newNode);
float calculateFitnessIfInsertFromFrontier(int, int);
pair<int, int> calculateNumberOfInternalAndExternalEdgesForNodeFromScratch(V theNode);
void updateFrontierFromScratch();
void updateCachedEdgeValuesFromScratch();
bool contains(V theNode);
bool isEqualTo(Seed &other);
bool frontierContains(V theNode);
float addBestNodeFromFrontierToSeed();
//accessor methods
int getInternalEdges();
int getExternalEdges();
const set <V> &getNodes();
Seed();
virtual ~Seed();
void rawPrint();
void rawPrintInOrderOfAddition();
void prettyPrint();
void prettyPrintFrontier();
float overlap(Seed &other);
bool overlapsAlreadyAcceptedSeed();
int getNumberOfNodes();
bool dead;
void clearCaches();
//map<Seed*, int> overlapWithOtherSeedsInNodes;
void addNodeNoCaching(V newNode);
void putIntoNodeToSeedsCache();
void removeFromNodeToSeedsList();
private:
//This vector stores the nodes that are in the graph.
//This vector will be sorted.
set <V> nodes;
vector<V> nodesInOrderOfAddition;
int internalEdges;
int externalEdges;
bool cachesDirty;
//Store the internal and external edges of each node that is in the frontier of the seed.
map<V, pair<int, int> > frontierNodeToInternalAndExternalEdges;
//Need a map of node to fitness for the frontier.
};
extern vector<std::set<Seed *>> nodeToSeeds;
#endif /* SEED_H_ */