NodeNet {RNetica}R Documentation

Finds which Netica network a node comes from.

Description

Each active NeticaNode object lives inside of a NeticaBN object. This function finds the network corresponding to a node.

Usage

NodeNet(node, internal=FALSE)

Arguments

node

A NeticaNode object.

internal

A logical scalar. If true, the actual Netica object will be consulted, if false, a cached value in the R object will be used.

Details

Two nodes with the same details in different networks are not identical inside of Netica. Nodes are always constructed inside of nets, and the Net field of a node cannot be changed. (See CopyNodes for copying a node to a new network.)

Starting with RNetica version 0.5, a NeticaNode object can figure out its network in two different ways. First the field node$Net has the NeticaBN object associated with this node. The second is by going into the Netica node object, finding the corresponding network and then looking it up by name in the NeticaSession object. With the option internal=TRUE this is what is done to check the node.

The node must be active. If is.active(node) returns false, this function will return NULL. Note that the expression node$Net will return the (possible inactive) NeticaBN object that the node used to belong to.

The functions NetworkAllNodes() and NetworkFindNode() provide pseudo-inverses for this function.

Value

A NeticaBN object which contains node, or NULL if node is not active and the internal method was selected.

Author(s)

Russell Almond

References

http://norsys.com/onLineAPIManual/index.html: GetNodeNet_bn()

See Also

NeticaBN, NeticaNode, is.active(), NetworkAllNodes(), NetworkFindNode()

Examples

sess <- NeticaSession()
startSession(sess)
neta <- CreateNetwork("Net_A", session=sess)
netb <- CreateNetwork("Net_B", session=sess)

nodea <- NewContinuousNode(neta,"Node")
nodeb <- NewContinuousNode(netb,"Node")

stopifnot(NodeNet(nodea)==neta)
stopifnot(NodeNet(nodeb)==netb)

stopifnot(NodeNet(nodea)==NodeNet(nodea,internal=TRUE))

## Note
stopifnot(nodea != nodeb)
## But:
stopifnot(nodea$Name == nodeb$Name)

DeleteNodes(nodeb)
stopifnot(is.null(NodeNet(nodeb)))
stopifnot(nodeb$Net==netb)

DeleteNodes(nodea)

DeleteNetwork(list(neta,netb))
stopSession(sess)


[Package RNetica version 0.7-1 Index]