chooseNode: Randomly selects an attributed node in an attributed node...

View source: R/derivationTrees.R

chooseNodeR Documentation

Randomly selects an attributed node in an attributed node list.

Description

chooseNode() returns a random attributed node from an attributed node list.

Usage

chooseNode(ANL)

Arguments

ANL

Attributed node list.

Details

An attributed node has the following elements:

  • ID

  • NonTerminal

  • Pos

  • Depth

  • Rdepth

  • subtreedepth

  • Index

These elements can be used e.g.

  • for inserting and extracting subtrees (Pos or node$Index),

  • for checking the feasibility of subtree substitution (ID),

  • for checking depth bounds (Depth, RDepth, and subtreedepth), ...

Value

An attributed node.

See Also

Other Random Choice: chooseRule()

Examples

g<-compileBNF(booleanGrammar())
a<-randomDerivationTree(g$Start, g)
b<-treeANL(a, g$ST)
c<-chooseNode(b$ANL)


xegaDerivationTrees documentation built on April 16, 2025, 5:11 p.m.