9 binomial_embedding::binomial_embedding(
int size,
int root)
10 : _size(size), _root(root) { }
14 return (rank - _root + _size) % _size;
18 return (rank + _root) % _size;
29 for (
int mask = 0x1; mask < _size; mask <<= 1) {
30 if ((mask & relrank) != 0) {
31 return ((relrank & (~ mask)) + _root) % _size;
int reverse_relative_rank(int rank) const
Reverse rank permutation.
std::vector< int > children(int rank) const
Same as get_children, but returns vector.
int parent(int rank) const
Get the parent of a particular rank.
int relative_rank(int rank) const
This permutes ranks in case the root is not zero.
void get_children(int rank, OutputIterator o) const
This allows you to putting children into any structure that supports output iterators.