node_bn* NewNode_bn ( const char*  name,   int  num_states,   net_bn*  net )

Creates and returns a new node for net.

If the node is for a discrete variable, pass the number of states it has for num_states.

If the node is for a variable which is continuous in the real world, pass 0 for num_states, even if you plan to later discretize it to a certain number of states (see SetNodeLevels_bn for more details).

name will be the name of the new node. It must be different from the names of all other nodes in net (by case-sensitive comparison), and it must be a legal IDname, which means it must have NAME_MAX_ns (30) or fewer characters, all of which are letters, digits or underscores, and it must start with a letter. If name ends with an asterisk (*), then Netica will replace the * with an integer to make a unique name for the node; you can discover what name was picked using GetNodeName_bn after the node is formed.

The node will start off as a nature node (kind = NATURE_NODE), but it may be changed by calling SetNodeKind_bn.

Netica will make a copy of name; it won't modify or free the passed string.

See also:

DeleteNode_bn    (reverse operation) Removes the node from its net and frees memory it uses
CopyNodes_bn    Creates nodes by duplicating them, even from another net
SetNodeKind_bn    Set what kind of node it is (nature, decision, utility, etc.)
SetNodeLevels_bn    The way to set the number of states if the node is for a continuous variable being discretized
SetNodeName_bn    Later change the name
SetNodeTitle_bn    Label the node without the IDname restriction
GetNodeType_bn    Determine if it was created as a continuous variable node
GetNodeNumberStates_bn    Retrieve num_states
GetNodeName_bn    Retrieve name
AddLink_bn    Link the new node with others
NewNet_bn    Create a net for adding nodes

Example:

See SetNodeLevels_bn for creating a discretized node for a continuous variable.