43 typedef std::set<KEY>
Set;
76 return this->
add(key, key);
82 *
this = this->
add(key, key);
88 return parent == key ? key :
findSet(parent);
119 for(
const KeyLabel& pair: (Tree)t)
120 t.findSet_(pair.first);
127 for(
const KeyLabel& pair: (Tree)*
this)
135 for(
const KeyLabel& pair: (Tree)*
this)
136 if (pair.first == pair.second)
147 std::map<KEY, Set>
sets()
const {
148 std::map<KEY, Set>
sets;
149 for(
const KeyLabel& pair: (Tree)*
this)
150 sets[
findSet(pair.second)].insert(pair.first);
156 std::map<KEY, Set> partitions;
163 Set
set(
const KEY& label)
const {
165 for(
const KeyLabel& pair: (Tree)*
this) {
166 if (pair.second == label ||
findSet(pair.second) == label)
174 return (Tree) *
this == (
Tree) t;
179 return (Tree) *
this != (
Tree) t;
184 std::cout <<
name << std::endl;
185 for(
const KeyLabel& pair: (Tree)*
this)
186 std::cout << (std::string) pair.first <<
" " << (std::string) pair.second
202 *
this = this->
add(key, label);
BTree add(const value_type &xd) const
DSF map(boost::function< KEY(const KEY &)> func) const
Self makePair(const KEY &key1, const KEY &key2) const
KEY findSet(const KEY &key) const
DSF(const std::set< KEY > &keys)
void makeSetInPlace(const KEY &key)
void print(const std::string &name="DSF") const
purely functional binary tree
std::pair< KEY, KEY > KeyLabel
bool operator==(const Self &t) const
Self makeSet(const KEY &key) const
bool mem(const KEY &x) const
KEY findSet_(const KEY &key)
const Symbol key1('v', 1)
DSF(const std::list< KEY > &keys)
std::map< KEY, Set > partition(const std::list< KEY > &keys) const
Self makeList(const std::list< KEY > &keys) const
void makeUnionInPlace(const KEY &key1, const KEY &key2)
bool operator!=(const Self &t) const
const KEY & find(const KEY &k) const
const Symbol key2('v', 2)
Annotation for function names.
int EIGEN_BLAS_FUNC() copy(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Self makeUnion(const KEY &key1, const KEY &key2) const
std::map< KEY, Set > sets() const