View source: R/derivationTrees.R
compatibleSubtrees | R Documentation |
compatibleSubtrees()
tests the compatibility of two
subtrees.
compatibleSubtrees(n1, n2, maxdepth = 5, DepthBounded = TRUE)
n1 |
Attributed node of the root of subtree 1. |
n2 |
Attributed node of the root of subtree 2. |
maxdepth |
Integer. Maximal derivation depth. |
DepthBounded |
|
compatibleSubtrees()
tests the compatibility of two
subtrees:
The root symbol of the two subtrees must be identical:
(n1$ID==n2$ID)
.
The depth restrictions must hold:
depth(n1) + depth(subtree2) <= maxdepth+maxSPT
depth(n2) + depth(subtree1) <= maxdepth+maxSPT
maxSPT is the maximal number of derivations needed to generate a complete derivation tree.
TRUE
or FALSE
Other Tree Operations:
treeExtract()
,
treeInsert()
g<-compileBNF(booleanGrammar())
t1<-randomDerivationTree(g$Start, g)
t1anl<-treeANL(t1, g$ST)
t2<-randomDerivationTree(g$Start, g)
t2anl<-treeANL(t2, g$ST)
n1<-chooseNode(t1anl$ANL)
n2<-chooseNode(t2anl$ANL)
compatibleSubtrees(n1, n2)
compatibleSubtrees(n1, n2, maxdepth=1)
compatibleSubtrees(n1, n2, DepthBounded=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.