NodeSets {RNetica} | R Documentation |
A node set is a character label associated with a node which provides information about its role in the models. This function returns or sets the labels associated with a node.
NodeSets(node, incSystem = FALSE) NodeSets(node) <- value AddNodeToSets(node,sets) RemoveNodeFromSets(node,sets)
node |
An active |
incSystem |
A logical flag. If |
value |
A character vector containing the names of the node sets that
node should be associated with. These names must follow the
|
sets |
A character vector containing the names of the node sets that
node should (or should not) be associated with. These names
must follow the |
Netica node sets are a collection of string labels that can be
associated with various nodes in a network. Node sets do not have any
meaning to Netica: node set membership only affect the way the node
is displayed (see NetworkNodeSetColor()
). One
purpose of node sets is to label a set of nodes that play a similar
role in the model. For example, "ReportingVariable"
or
"Observable"
.
The expression NodeSets(node)
returns the node sets currently
associated with node. If incSystem=TRUE
, then the
internal Netica system node sets will be included as well. These
begin with a colon (‘:’).
The expression NodeSets(node)<-value
removes any node sets
previously associated with node and adds node to the node sets
named in value. The elements of value need not
correspond to existing node sets, new node sets will be created for
new values. (Warning: this implies that if the name of the node set
is spelled incorrectly in one of the calls, this will create a new
node set. For example, "Observable"
and "Observables"
would be two distinct node sets.) Setting the node set associated
with a node only affects user-defined node sets, the Netica system
node sets cannot be set using NodeSet
.
The functions AddNodeToSets
and RemoveNodeFromSets
operate on the current node set in the expected way.
A character vector giving the names of the node sets node is
associated with. The setter form, AddNodeToSets
and
RemoveNodeFromSets
return node.
Russell Almond
http://norsys.com/onLineAPIManual/index.html: AddNodeToNodeset_bn(), RemoveNodeFromNodeset_bn(), IsNodeInNodeset_bn()
NeticaNode
, NodeKind()
,
NetworkNodeSets()
, NetworkSetPriority()
,
NetworkNodesInSet()
, NetworkNodeSetColor()
,
is.IDname()
sess <- NeticaSession() startSession(sess) nsnet <- CreateNetwork("NodeSetExample", session=sess) Ability <- NewContinuousNode(nsnet,"Ability") EssayScore <- NewDiscreteNode(nsnet,"EssayScore",paste("level",5:0,sep="_")) Value <- NewContinuousNode(nsnet,"Value") NodeKind(Value) <- "Utility" Placement <- NewDiscreteNode(nsnet,"Placement", c("Advanced","Regular","Remedial")) NodeKind(Placement) <- "Decision" stopifnot( length(NodeSets(Ability)) == 0, ## Nothing set yet setequal(NodeSets(Ability,TRUE), c(":Continuous", ":Nature", ":TableIncomplete", ":Parentless", ":Childless", ":Node")), !is.na(match(":Utility",NodeSets(Value,TRUE))), !is.na(match(":Decision",NodeSets(Placement,TRUE))) ) NodeSets(Ability) <- "ReportingVariable" stopifnot( NodeSets(Ability) == "ReportingVariable" ) NodeSets(EssayScore) <- "Observable" stopifnot( NodeSets(EssayScore) == "Observable" ) ## Make EssayScore a reporting variable, too NodeSets(EssayScore) <- c("ReportingVariable",NodeSets(EssayScore)) stopifnot( setequal(NodeSets(EssayScore),c("Observable","ReportingVariable")) ) ## Clear out the node set NodeSets(Ability) <- character() stopifnot( length(NodeSets(Ability)) == 0 ) NodeSets(Ability) <- c("Set1","Set2") AddNodeToSets(Ability,c("Set2","Set3")) stopifnot( length(NodeSets(Ability)) == 3, setequal(NodeSets(Ability),c("Set1","Set2","Set3")) ) RemoveNodeFromSets(Ability,c("Set1","Set4")) stopifnot( length(NodeSets(Ability)) == 2, setequal(NodeSets(Ability),c("Set2","Set3")) ) DeleteNetwork(nsnet) stopSession(sess)