PnetFindNode | R Documentation |
The function PnetFindNode
finds a node in a
Pnet
with the given name. If no node with the
specified name found, it will return NULL
.
The function PnetPnodes
returns nodes which have
been marked as pnodes, that is nodes that have “pnodes” in their
PnodeLabels
.
## S4 method for signature 'NeticaBN'
PnetFindNode(net, name)
## S4 method for signature 'NeticaBN'
PnetPnodes(net)
## S4 replacement method for signature 'NeticaBN'
PnetPnodes(net) <- value
net |
The |
name |
A character vector giving the name or names of the desired nodes.
Names must follow the |
value |
A list of |
Although each Pnode
belongs to a single network, a
network contains many nodes. Within a network, a node is uniquely
identified by its name. However, nodes can be renamed (see
NodeName()
).
A NeticaNode
is also a Pnode
if it has the label (node set) “pnodes”.
The function PnetPnodes()
returns all the Pnodes in the
network, however, the order of the nodes in the network could be
different in different calls to this function.
The form PnetPnodes(net)<-value
sets the list of nodes in
value
to be the set of Pnodes; removing nodes which are not in
the value
from the set of Pndoes.
The Pnodes are not necesarily all of the nodes in the Netica network.
The complete list of ndoes can be found through the
RNetica::NetworkAllNodes
function.
The Pnode
object or list of Pnode
objects corresponding to names
, or a list of all node objects for
PnetPnodes()
. In the latter case, the names will be set
to the node names.
NeticaNode
objects do not survive the life of a
Netica session (or by implication an R session). So the safest way to
"save" a NeticaNode
object is to recreate it using
PnetFindNode()
after the network is reloaded.
Russell Almond
http://norsys.com/onLineAPIManual/index.html, GetNodeNamed_bn(), GetNetNodes_bn()
Generic functions:
PnetPnodes()
, PnetFindNode()
,
Related functions in RNetica package:
NetworkFindNode
,
NetworkAllNodes
sess <- NeticaSession()
startSession(sess)
tnet <- CreateNetwork("TestNet",sess)
nodes <- NewDiscreteNode(tnet,c("A","B","C"))
nodeA <- PnetFindNode(tnet,"A")
stopifnot (nodeA==nodes[[1]])
nodeBC <- PnetFindNode(tnet,c("B","C"))
stopifnot(nodeBC[[1]]==nodes[[2]])
stopifnot(nodeBC[[2]]==nodes[[3]])
allnodes <- PnetPnodes(tnet)
stopifnot(length(allnodes)==0)
## Need to mark nodes a Pnodes before they will be seen.
nodes <- lapply(nodes,as.Pnode)
allnodes <- PnetPnodes(tnet)
stopifnot(length(allnodes)==3)
stopifnot(any(sapply(allnodes,"==",nodeA))) ## NodeA in there somewhere.
DeleteNetwork(tnet)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.