-
Notifications
You must be signed in to change notification settings - Fork 1
/
tree.H
33 lines (25 loc) · 797 Bytes
/
tree.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
#ifndef INCLUDED_TREE_H
#define INCLUDED_TREE_H
#include "candidates.H"
#include <map>
struct Edge : public CandidateList {
inline Edge (unsigned head, unsigned C, unsigned R)
: CandidateList(), head(head), C(C), R(R) { }
const unsigned head;
const unsigned C;
const unsigned R;
};
struct Node : public CandidateList {
inline Node () : CandidateList(), outgoing() { }
std::vector<Edge> outgoing;
void print(unsigned i, unsigned depth = 0);
};
struct Tree : std::vector<Node> {
Tree (unsigned n) : std::vector<Node>(n), root (0, 0, 1), library() { }
void compute_candidates (Edge &e);
void compute_candidates(Node &n);
void search(std::map<unsigned, unsigned> &output, unsigned n_id, unsigned c_id) const;
Edge root;
std::vector<Buffer> library;
};
#endif