Node definition

<< Click to Display Table of Contents >>

Navigation:  Using SMILE Wrappers > Networks, nodes and arcs > Nodes >

Node definition

The node definition specifies how a node interacts with other nodes in the network. It is stored as part of the network when the network is saved to a file or serialized. Equation nodes are defined by their equation (see the Equation-based nodes section for details), while other node types, such as discrete chance nodes and utility nodes, have a definition that includes numeric data. Use the following methods to read or write the numeric part of a node definition:

Python

set_node_definition(node: int | str, node_definition: List[float]) -> None

get_node_definition(node: int | str) -> List[float]

Java

void setNodeDefinition(int nodeHandle, double[] definition);

void setNodeDefinition(String nodeId, double[] definition);

double[] getNodeDefinition(int nodeHandle);

double[] getNodeDefinition(String nodeId);

C#

void SetNodeDefinition(int nodeHandle, double[] definition);

void SetNodeDefinition(string nodeId, double[] definition);

double[] GetNodeDefinition(int nodeHandle);

double[] GetNodeDefinition(string nodeId);

R

setNodeDefinition(nodeIdOrHandle)

nodedef <- getNodeDefinition(nodeIdOrHandle)
 

The numeric data stored in the node definition is internally represented as a flattened multidimensional array, where each dimension corresponds to one discrete parent node plus the node itself. For more details on the storage and indexing of these arrays, see the Multidimensional arrays section.

For discrete nodes (including general chance nodes), the definition also includes a list of outcomes representing the possible states of the node. Outcomes can be defined in one of four ways:

1.Identifiers only – each outcome has a unique string label within the node. Note that different nodes may use the same outcome identifiers.

2.Identifiers with numeric intervals – each outcome has a string label and an associated numeric interval.

3.Numeric intervals only – outcomes are defined purely by numeric intervals without identifiers.

4.Identifiers with numeric point values – each outcome has a string label and a numeric point value (point values cannot exist without identifiers).

For more details on discrete nodes and the use of numeric domains, see the Discrete nodes and numeric domains section.

Outcomes can be added, deleted, or renamed regardless of how they are defined.

Python

get_outcome_count(node: int | str) -> int

add_outcome(node: int | str, outcome_id: str) -> None

insert_outcome(node: int | str, position: int, outcome_id: str) -> None

delete_outcome(node: int | str, outcome: int | str) -> None

set_outcome_id(node: int | str, outcome_index: int, id: str) -> None

get_outcome_id(node: int | str, outcome_index: int) -> str

get_outcome_ids(node: int | str) -> List[str)

Java

int getOutcomeCount(int nodeHandle);

int getOutcomeCount(String nodeId);

void addOutcome(int nodeHandle, String outcomeId);

void addOutcome(String nodeId, String outcomeId);

void insertOutcome(int nodeHandle, int position, String outcomeId);

void insertOutcome(String nodeId, int position, String outcomeId);

void deleteOutcome(int nodeHandle, int outcomeIndex);

void deleteOutcome(String nodeId, int outcomeIndex);

void deleteOutcome(int nodeHandle, String outcomeId);

void deleteOutcome(String nodeId, String outcomeId);

void setOutcomeId(int nodeHandle, int outcomeIndex, String id);

void setOutcomeId(String nodeId, int outcomeIndex, String id);

String getOutcomeId(int nodeHandle, int outcomeIndex);

String getOutcomeId(String nodeId, int outcomeIndex);

String[] getOutcomeIds(int nodeHandle);

String[] getOutcomeIds(String nodeId);

C#

int GetOutcomeCount(int nodeHandle);

int GetOutcomeCount(string nodeId);

void AddOutcome(int nodeHandle, string outcomeId);

void AddOutcome(string nodeId, string outcomeId);

void InsertOutcome(int nodeHandle, int position, string outcomeId);

void InsertOutcome(string nodeId, int position, string outcomeId);

void DeleteOutcome(int nodeHandle, int outcomeIndex);

void DeleteOutcome(string nodeId, int outcomeIndex);

void DeleteOutcome(int nodeHandle, string outcomeId);

void DeleteOutcome(string nodeId, string outcomeId);

void SetOutcomeId(int nodeHandle, int outcomeIndex, string id);

void SetOutcomeId(string nodeId, int outcomeIndex, string id);

string GetOutcomeId(int nodeHandle, int outcomeIndex);

string GetOutcomeId(string nodeId, int outcomeIndex);

string[] GetOutcomeIds(int nodeHandle);

string[] GetOutcomeIds(string nodeId);

R

outcomeCount <- getOutcomeCount(nodeIdOrHandle)

addOutcome(nodeIdOrHandle, outcomeId)

insertOutcome(nodeIdOrHandle, position, outcomeId)

deleteOutcome(nodeIdOrHandle, outcomeIndexOrId)

setOutcomeId(nodeIdOrHandle, outcomeIndex, id)

outcomeId <- getOutcomeId(nodeIdOrHandle, outcomeIndex)

outcomeIds <- getOutcomeIds(nodeIdOrHandle)