The static tree case is the case where the whole tree of
The uniform sampling problem consisting in selecting a random node (and position) in the tree with uniform probability.
Uniformly sampling a static tree is straightforward, with
to sample the index space.
Both operations are
Sampling can be done while descending through the tree, where each child subtree
is sampled with a probability proportional to it's subtree weight, and the current
node with a probability proportional to 1. The array of probability for a node with
an arity of
The overhead of sampling is still
The biased sampling problem consist in sampling some subtrees with increased probability with respect to the rest of the tree. Please note that biasing sampling of a specific node of the tree is a different problem.
In order to bias sampling of the subtree starting at node
In order to bias sampling of the subtree starting at $node
- multiplying the weight of the subtree leading to
$n_i$ by a factor of$x$ in$n_i$ 's parent, - updating the weight of the subtrees leading to
$n_i$ by taking into account the subtree updated weight. This is a$\mathcal{O}(k \log_k n)$ time operation on average, where$k$ is the mean arity of the tree.
Biasing sampling of a specific node is also possible, and requires updating a single weight in the global sampling strategy
(still an
The hierarchical sampling strategy is a bit more complex, but can be achieved if the biases of subtrees are stored on the node at the base of the subtree. The complexity is the same as biasing a subtree,
Lets consider a tree, potentially infinite, where only a subset of nodes are known.
We add the constraint that the arity of known nodes is also known and is noted
Exploring an unknown node
Uniform sampling through the reachable nodes can be done using both strategy given above.
Nonetheless the cost of updating the different sampling strategy, as new nodes are explored is not the same.
The global sampling strategy would require traversing the tree every time a new node becomes known and it's arity discovered this is an
Biased sampling works the same way as in the static case for both strategy and incur the same cost.