forked from TUfischl/newdetkdecomp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDecompComponent.h
executable file
·39 lines (28 loc) · 1.21 KB
/
DecompComponent.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
#if !defined(CLS_DECOMPCOMP)
#define CLS_DECOMPCOMP
#include <list>
#include "Hypergraph.h"
#include "BaseSeparator.h"
#pragma once
class DecompComponent
{
HyperedgeVector MyComp;
VertexSet MyConnector;
BaseSeparatorSharedPtr MySep;
public:
DecompComponent(const BaseSeparatorSharedPtr &sep) : MySep{ sep } {};
DecompComponent() {};
~DecompComponent();
void add(const HyperedgeSharedPtr &edge);
auto size() const { return MyComp.size(); }
bool contains(const HyperedgeSharedPtr &edge) const { return find(MyComp.begin(),MyComp.end(),edge) != MyComp.end(); }
HyperedgeSharedPtr containsOneOf(const list<HyperedgeSharedPtr> &edges) const;
// Labels the component with label and the seperator and connector with -1
void label(int label, int sepLabel = -1) const;
HyperedgeSharedPtr first() const { if (MyComp.size() > 0) return *(MyComp.begin()); else return HyperedgeSharedPtr(nullptr); }
const HyperedgeVector &component() const { return MyComp; }
const VertexSet &connector() const { return MyConnector; }
HyperedgeSharedPtr& operator[](std::size_t idx) { return MyComp[idx]; }
const HyperedgeSharedPtr& operator[](std::size_t idx) const { return MyComp[idx]; }
};
#endif