Learn R Programming

xegaDerivationTrees (version 1.0.0.6)

treeNodes: Measures the number of inner nodes in a derivation tree.

Description

treeNodes() returns the number of non-terminal symbols in a derivation tree.

Usage

treeNodes(tree, ST)

Value

Integer. Number of non-terminal symbols in a derivation tree.

Arguments

tree

Derivation tree.

ST

Symbol table.

See Also

Other Measures of Tree Attributes: treeLeaves(), treeListDepth(), treeProbability(), treeSize()

Examples

Run this code
g<-compileBNF(booleanGrammar())
a<-randomDerivationTree(g$Start, g)
treeNodes(a, g$ST) 

Run the code above in your browser using DataLab