NetworkNodeSets {RNetica}R Documentation

Returns a list of node sets associated with a Netica network.

Description

A node set is a character label associated with a node which provides information about its role in the models. This function returns the complete list of node sets associated with any node in the network.

Usage

NetworkNodeSets(net, incSystem = FALSE)

Arguments

net

An active NeticaBN object representing the network.

incSystem

A logical flag. If TRUE then built-in Netica node sets are returned as well as the user defined ones.

Details

Netica node sets are a collection of string labels that can be associated with various nodes in a network using the function NodeSets(). 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 NetworkNodeSets(net) returns the node sets that are currently associated with any node in net. If incSystem=TRUE, then the internal Netica system node sets will be included as well. These begin with a colon (‘:’). This value cannot be set directly, only indirectly through the use of NodeSets.

Value

A character vector giving the node sets used by the network.

Note

Node sets cannot be destroyed, only created. An empty node set has no effect.

Author(s)

Russell Almond

References

http://norsys.com/onLurl/Manual/index.html: GetAllNodesets_bn()

See Also

NeticaNode, NodeSets(), NetworkSetPriority(), NetworkNodesInSet(), NetworkNodeSetColor()

Examples

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(NetworkNodeSets(nsnet)) == 0, ## Nothing set yet
  length(NetworkNodeSets(nsnet,TRUE)) == 22 ## Number of system states
)

NodeSets(Ability) <- "ReportingVariable"
stopifnot(
  NetworkNodeSets(nsnet) == "ReportingVariable"
)
NodeSets(EssayScore) <- "Observable"
stopifnot(
  setequal(NetworkNodeSets(nsnet),c("Observable","ReportingVariable"))
)
## Changing spelling of name adds new set, doesn't delete the old one.
NodeSets(EssayScore) <- "Observables"
stopifnot(
  setequal(NetworkNodeSets(nsnet),
           c("Observables", "Observable","ReportingVariable"))
)
## Nor does deletion
NodeSets(Ability) <- character()
stopifnot(
  setequal(NetworkNodeSets(nsnet),
           c("Observables", "Observable","ReportingVariable"))
)

DeleteNetwork(nsnet)
stopSession(sess)

[Package RNetica version 0.7-3 Index]