View source: R/derivationTrees.R
filterANL | R Documentation |
filterANL()
deletes all nodes whose depth
node$Depth
is
less than minb
and larger than maxb
from the ANL.
However, if the resulting list is empty, the original
ANL is returned.
filterANL(ANL, minb = 1, maxb = 3)
ANL |
Attributed node list. |
minb |
Integer. |
maxb |
Integer. |
An attributed node
has the following elements:
$ID
: Id in the symbol table ST
.
$NonTerminal
: Is the symbol a non-terminal?
$Pos
: Position in the trail.
$Depth
: Depth of node.
$Rdepth
: Residual depth for expansion.
$subtreedepth
: Depth of subtree starting here.
$Index
: R index of the node in the derivation tree.
Allows fast tree extraction and insertion.
An attributed node list with nodes whose depths are in
minb:maxb
.
Each node is represented as a list of the following attributes:
Node$ID
: Id in the symbol table ST.
Node$NonTerminal
: Is the symbol a non-terminal?
Node$Pos
: Position in the trail.
Node$Depth
: Depth of node.
Node$Rdepth
: Residual depth for expansion.
Node$subtreedepth
: Depth of subtree starting here.
Node$Index
: R index of the node in the derivation tree.
Allows fast tree extraction and insertion.
Other Access Tree Parts:
filterANLid()
,
treeANL()
,
treeChildren()
,
treeRoot()
g<-compileBNF(booleanGrammar())
set.seed(111)
a<-randomDerivationTree(g$Start, g, maxdepth=10)
b<-treeANL(a, g$ST)
c<-filterANL(b, minb=1, maxb=3)
d<-filterANL(b, minb=3, maxb=5)
e<-filterANL(b, minb=14, maxb=15)
f<-filterANL(b, minb=13, maxb=15)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.