Description Usage Arguments Details Value Author(s)
This function visits each node in a tree-like object in an order
determined by the relationOf
function. The function given by
tfun
is called for each set of nodes and the function
nfun
determines which nodes to test next optionally making use
of the result of the previous test.
1 2 3 | tree_visitor(g, start, tfun, nfun, relationOf)
topdown_tree_visitor(g, start, tfun, nfun)
bottomup_tree_visitor(g, start, tfun, nfun)
|
g |
A tree-like object that supports the method given by
|
start |
The set of nodes to start the computation (can be a list of siblings), but the nodes should all belong to the same level of the tree (same path length to root node). |
tfun |
The test function applied to each list of siblings at each
level starting with |
nfun |
A function with signature |
relationOf |
The method used to traverse the tree. For example
|
The tree_visitor
function is intended to allow developers to
quickly prototype different statistical testing paradigms on trees.
It may be possible to extend this to work for DAGs.
The visit begins by calling tfun
with the nodes provided by
start
. The result of each call to tfun
is stored in an
environment. The concept is visitation by tree level and so each
result is stored using a key representing the level (this isn't quite
right since the nodes in start
need not be first level, but
they will be assigned key "1". After storing the result, nfun
is used to obtain a vector of accepted node labels. The idea is that
the user should have a way of determining which nodes in the next
level of the tree are worth testing. The next start
set is
determined by start <- relationOf(g, accepted)
where accepted
is unique(nfun(ans, g))
.
A list. See the return value of cb_test
to get an idea. Each
element of the list represents a call to tfun
at a given level
of the tree.
Seth Falcon
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.