forked from TUfischl/newdetkdecomp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFecCalculator.h
executable file
·52 lines (40 loc) · 1.2 KB
/
FecCalculator.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
#if !defined(CLS_FEC_CALCULATOR)
#define CLS_FEC_CALCULATOR
#include <set>
#include "NamedEntity.h"
#include "FractionalEdgeCover.h"
#include "Hypergraph.h"
#include "Hyperedge.h"
#include "Vertex.h"
struct Map {
NamedEntitySharedPtr comp;
int index;
bool compareMaps(Map *m1, Map *m2)
{
NamedEntitySharedPtr c1 = m1->comp;
NamedEntitySharedPtr c2 = m2->comp;
return c1->getId() < c2->getId();
}
};
struct classcomp {
bool operator() (const Map *m1, const Map *m2) const
{
NamedEntitySharedPtr c1 = m1->comp;
NamedEntitySharedPtr c2 = m2->comp;
return c1->getId() < c2->getId();
}
};
class FecCalculator
{
private:
HypergraphSharedPtr MyHg;
HyperedgeSet getIncidentEdges(const VertexSet &chi, set<Map *, classcomp> &nodeToindexMap,
set<Map *> &edgeToIndexMap, vector<HyperedgeSharedPtr> &indexToEdgeMap) const;
void computeElements(const VertexSet &, std::set<Map *, classcomp>&,
const HyperedgeSet &, std::set<Map *>&, double *) const;
public:
FecCalculator(const HypergraphSharedPtr &hg);
virtual ~FecCalculator();
FractionalEdgeCover computeFEC(const VertexSet &chi, double &weight) const;
};
#endif // !defined(CLS_FEC_CALCULATOR)