GTSAM
4.0.2
C++ library for smoothing and mapping (SAM)
|
#include <DSF.h>
Public Types | |
typedef DSF< KEY > | Self |
typedef std::set< KEY > | Set |
typedef BTree< KEY, KEY > | Tree |
typedef std::pair< KEY, KEY > | KeyLabel |
Public Member Functions | |
DSF (const Tree &tree) | |
DSF (const std::list< KEY > &keys) | |
DSF (const std::set< KEY > &keys) | |
Self | makeSet (const KEY &key) const |
void | makeSetInPlace (const KEY &key) |
KEY | findSet (const KEY &key) const |
Self | makeUnion (const KEY &key1, const KEY &key2) const |
void | makeUnionInPlace (const KEY &key1, const KEY &key2) |
Self | makePair (const KEY &key1, const KEY &key2) const |
Self | makeList (const std::list< KEY > &keys) const |
DSF | flatten () const |
DSF | map (std::function< KEY(const KEY &)> func) const |
size_t | numSets () const |
size_t | size () const |
std::map< KEY, Set > | sets () const |
std::map< KEY, Set > | partition (const std::list< KEY > &keys) const |
Set | set (const KEY &label) const |
bool | operator== (const Self &t) const |
bool | operator!= (const Self &t) const |
void | print (const std::string &name="DSF") const |
Protected Types | |
typedef std::pair< KEY, KEY > | value_type |
typedef const_iterator | iterator |
Protected Member Functions | |
KEY | findSet_ (const KEY &key) |
bool | empty () const |
BTree | add (const value_type &xd) const |
BTree | add (const KEY &x, const KEY &d) const |
bool | mem (const KEY &x) const |
bool | same (const BTree &other) const |
bool | operator== (const BTree &other) const |
bool | operator!= (const BTree &other) const |
const value_type & | min () const |
BTree | remove_min () const |
BTree | remove (const KEY &x) const |
size_t | height () const |
const KEY & | find (const KEY &k) const |
void | iter (std::function< void(const KEY &, const KEY &)> f) const |
BTree< KEY, TO > | map (std::function< TO(const KEY &, const KEY &)> f) const |
ACC | fold (std::function< ACC(const KEY &, const KEY &, const ACC &)> f, const ACC &a) const |
const_iterator | begin () const |
const_iterator | end () const |
Static Protected Member Functions | |
static BTree | merge (const BTree &t1, const BTree &t2) |
Disjoint Set Forest class
Quoting from CLR: A disjoint-set data structure maintains a collection S = {S_1,S_2,...} of disjoint dynamic sets. Each set is identified by a representative, which is some member of the set.
|
inlineinherited |
add a key-value pair
|
inlineinherited |
add a key-value pair
|
inlineinherited |
return iterator
|
inlineinherited |
Check whether tree is empty
|
inlineinherited |
return iterator
|
inlineinherited |
find a value given a key, throws exception when not found Optimized non-recursive version as [find] is crucial for speed
|
inlineprotected |
same as findSet except with path compression: After we have traversed the path to the root, each parent pointer is made to directly point to it
|
inlineinherited |
t.fold(f,a) computes [(f kN dN ... (f k1 d1 a)...)], where [k1 ... kN] are the keys of all bindings in [m], and [d1 ... dN] are the associated data. The associated values are passed to [f] in reverse sort order
|
inlineinherited |
Return height of the tree, 0 if empty
|
inlineinherited |
iterate over tree
|
inlineinherited |
map key-values in tree over function f that computes a new value
|
inlineinherited |
member predicate
|
inlinestaticinherited |
merge two trees
|
inlineinherited |
minimum key binding
|
inline |
inequality
|
inline |
equality
|
inlineinherited |
Check whether trees are structurally the same, i.e., contain the same values in same tree-structure.
|
inlineinherited |
remove a key-value pair
|
inlineinherited |
remove minimum key binding
|
inlineinherited |
Check whether trees are exactly the same (occupy same memory)