Class Node
Nodes are the fundamental objects used in the construction of Bayesian networks and influence diagrams.
Implements
Inherited Members
Namespace: HAPI
Assembly: hugincs-9.7-netstandard2.0-x64.dll
Syntax
public abstract class Node : ICloneable
Remarks
All nodes "belong to" a NetworkModel (i.e., a Class or a Domain). This implies that the network must exist before its nodes can be created.
Methods
AddParent(Node)
Adds a node as a new parent of this Node.
Declaration
public void AddParent(Node newParent)
Parameters
| Type | Name | Description |
|---|---|---|
| Node | newParent | The new parent Node. |
Remarks
Adds a node as a new parent of this Node. That is, it adds a directed link from the new parent to this Node.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
AddToInputs()
Makes this Node become an input node of its Class.
Declaration
public void AddToInputs()
Remarks
The node must not already be an input or output node of its Class, it must not be an output clone associated with an InstanceNode, and, most importantly, it must not have parents.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
AddToOutputs()
Makes this Node become an output node of its Class.
Declaration
public void AddToOutputs()
Remarks
The Node must not already be an output or input Node of its Class.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
Clone()
Clones this node.
Declaration
public object Clone()
Returns
| Type | Description |
|---|---|
| object |
Remarks
Creates a new object (of the correct type) that is a clone of this Node.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
CreateTemporalClone()
Constructs a temporal clone of this Node object.
Declaration
public Node CreateTemporalClone()
Returns
| Type | Description |
|---|---|
| Node | A Node. |
Remarks
This node (known as the "master" node) must not be an instance node, or a temporal or an output clone, and the node must belong to a class without input and output nodes. Moreover, this class must not be instantiated. Only one temporal clone can be created for each master node.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
Delete()
Deletes this Node.
Declaration
public void Delete()
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
EvidenceIsEntered()
Tests if evidence is entered.
Declaration
public bool EvidenceIsEntered()
Returns
| Type | Description |
|---|---|
| bool | Returns |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
EvidenceIsPropagated()
Tests if evidence if propagated.
Declaration
public bool EvidenceIsPropagated()
Returns
| Type | Description |
|---|---|
| bool | Returns |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
EvidenceToPropagate()
Tests if the entered and the propagated evidence differ.
Declaration
public bool EvidenceToPropagate()
Returns
| Type | Description |
|---|---|
| bool | Returns |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetAttribute(string)
Returns the value associated with a particular attribute in the attribute list for this Node.
Declaration
public string GetAttribute(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | A String identifying the attribute in question. |
Returns
| Type | Description |
|---|---|
| string | A String containing the attribute value. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetAttributes()
Returns a List of attributes associated with this Node.
Declaration
public List<Attribute> GetAttributes()
Returns
| Type | Description |
|---|---|
| List<Attribute> |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetCategory()
Returns the Category of this Node
Declaration
public abstract Node.Category GetCategory()
Returns
| Type | Description |
|---|---|
| Node.Category |
GetChildren()
Returns a NodeList with the child Nodes of this Node.
Declaration
public NodeList GetChildren()
Returns
| Type | Description |
|---|---|
| NodeList |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetEdgeConstraint(Node)
Returns the constraint between this node and node.
Declaration
public NetworkModel.Constraint GetEdgeConstraint(Node node)
Parameters
| Type | Name | Description |
|---|---|---|
| Node | node | The second node in the constraint. |
Returns
| Type | Description |
|---|---|
| NetworkModel.Constraint | The NetworkModel.Constraint set between the two nodes. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetHome()
Returns the Class or Domain containing this Node.
Declaration
public NetworkModel GetHome()
Returns
| Type | Description |
|---|---|
| NetworkModel | The NetworkModel containing this Node. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetHomeClass()
Returns the Class containing this Node. Returns null if
the Node belongs to a Domain.
Declaration
public Class GetHomeClass()
Returns
| Type | Description |
|---|---|
| Class | The Class containing this Node. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetHomeDomain()
Returns the Domain containing this Node. Returns
null if the Node belongs to a Class.
Declaration
public Domain GetHomeDomain()
Returns
| Type | Description |
|---|---|
| Domain | The Domain containing this Node. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetInstance()
Returns the InstanceNode containing this (cloned) output node.
Declaration
public Node GetInstance()
Returns
| Type | Description |
|---|---|
| Node | The InstanceNode containing this output clone. |
Remarks
Note that we clone all output nodes when we create an InstanceNode. This is done in order to make it possible to specify conditional probability tables involving output nodes from InstanceNode's.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetJunctionTree()
Returns the JunctionTree to which this Node belongs.
Declaration
public JunctionTree GetJunctionTree()
Returns
| Type | Description |
|---|---|
| JunctionTree | A JunctionTree. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetKind()
Returns the Kind of this Node.
Declaration
public abstract Node.Kind GetKind()
Returns
| Type | Description |
|---|---|
| Node.Kind | The Node.Kind value. |
GetLabel()
Returns the label of this Node.
Declaration
public string GetLabel()
Returns
| Type | Description |
|---|---|
| string |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetMaster()
Returns the "master" of this (cloned) output Node of an InstanceNode (i.e., the Node cloned to get this output Node).
Declaration
public Node GetMaster()
Returns
| Type | Description |
|---|---|
| Node | The "master" of this Node if it is an output clone;
otherwise, the method returns |
Remarks
Note that "master" belongs to another Class object. Note also that we clone all output nodes when we create an InstanceNode. This is done in order to make it possible to specify conditional probability tables involving output nodes from InstanceNode's.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetModel()
Returns the Model for this Node.
Declaration
public Model GetModel()
Returns
| Type | Description |
|---|---|
| Model | A Model object. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetName()
Returns the name of this Node.
Declaration
public string GetName()
Returns
| Type | Description |
|---|---|
| string | The name of this node. |
Remarks
If this node has not previously been assigned a name, a valid name will automatically be assigned.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetParents()
Returns a NodeList with the parent Nodes of this Node.
Declaration
public NodeList GetParents()
Returns
| Type | Description |
|---|---|
| NodeList | A NodeList containing the parent Nodes of this Node. |
Remarks
If no parents exist, an empty NodeList is returned.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetPosition()
Returns the position of this Node.
Declaration
public Point GetPosition()
Returns
| Type | Description |
|---|---|
| Point |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetSource()
Returns a NodeList of Class nodes that identifies this Domain node.
Declaration
public NodeList GetSource()
Returns
| Type | Description |
|---|---|
| NodeList | An ordered NodeList with the InstanceNodes and the ordinary Node identifying the source of this Node that must belong to a Domain. |
Remarks
The CreateDomain() method of the Class class unfolds an object-oriented (nested) specification of a Bayesian network or an influence diagram into a regular Domain object.
Nodes in this Domain which originates from nodes residing in nested subnetworks (via InstanceNodes) can be uniquely related to a sequence of InstanceNodes and an ordinary Node of the object-oriented network.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetTable()
Returns the table associated with this Node.
Declaration
public Table GetTable()
Returns
| Type | Description |
|---|---|
| Table | A Table. |
Remarks
Returns the table associated with this Node. If the node is a DiscreteChanceNode, the table is the conditional probability table for the node given its parents. If the node is a UtilityNode, the table represents a utility function of the parents of the node. The set of nodes associated with the table will be the (discrete) parents of the Node in unspecified order followed by the node itself.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetTemporalClone()
Returns the "temporal clone" of this Node.
Declaration
public Node GetTemporalClone()
Returns
| Type | Description |
|---|---|
| Node | A Node. |
Remarks
If this Node doesn't have a temporal clone, null is
returned.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetTemporalMaster()
Returns the "temporal master" of this Node.
Declaration
public Node GetTemporalMaster()
Returns
| Type | Description |
|---|---|
| Node | A Node. |
Remarks
If this Node is not a temporal clone, null is returned.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
GetUserData()
Returns the value stored within the user data slot of this node.
Declaration
public object GetUserData()
Returns
| Type | Description |
|---|---|
| object | The user data Object stored within this Node. |
Remarks
Returns the value stored within the user data slot of this
Node. If the stored value is null, or if no value has
been stored, null is returned. It is the
responsibility of the application programmer to ensure that
the data is valid. Also note that when you delete a node,
Hugin does not attempt to delete the Object referenced by
the user data slot. It is the responsibility of the user.
IsAlive()
Is this Node object alive?
Declaration
public bool IsAlive()
Returns
| Type | Description |
|---|---|
| bool |
LikelihoodIsEntered()
Tests if the evidence potential, currently registered with this Node, is a likelihood.
Declaration
public bool LikelihoodIsEntered()
Returns
| Type | Description |
|---|---|
| bool | Returns |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
LikelihoodIsPropagated()
Tests if the evidence potential for this Node, incorporated within the current junction tree potentials, is a likelihood.
Declaration
public bool LikelihoodIsPropagated()
Returns
| Type | Description |
|---|---|
| bool | Returns |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
RemoveFromInputs()
Removes this Node from the set of input nodes of its class.
Declaration
public void RemoveFromInputs()
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
RemoveFromOutputs()
Removes this Node from the set of output nodes of its Class.
Declaration
public void RemoveFromOutputs()
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
RemoveParent(Node)
Removes the directed link between a parent and this Node.
Declaration
public void RemoveParent(Node parent)
Parameters
| Type | Name | Description |
|---|---|---|
| Node | parent | The parent Node that will be removed. |
Remarks
The table (if any) of the Node will be updated such that the updated table will be the portion of the old table that corresponds to the parent being in its first state.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
ReverseEdge(Node)
Reverses the edge between this Node and the specified neighbor.
Declaration
public void ReverseEdge(Node node)
Parameters
| Type | Name | Description |
|---|---|---|
| Node | node | the neighbor in question. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SetAttribute(string, string)
Sets a value for a particular attribute in the attribute list for this Node.
Declaration
public void SetAttribute(string key, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | A String identifying the attribute in question. |
| string | value | a String containing the attribute value. |
Remarks
If value is null, the attribute is removed.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SetAttributes(List<Attribute>)
Sets the attributes of this Node to attributes.
Declaration
public void SetAttributes(List<Attribute> attributes)
Parameters
| Type | Name | Description |
|---|---|---|
| List<Attribute> | attributes | List of Attributes. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SetEdgeConstraint(Node, Constraint)
Sets a constraint between this Node and another Node.
Declaration
public void SetEdgeConstraint(Node node, NetworkModel.Constraint constraint)
Parameters
| Type | Name | Description |
|---|---|---|
| Node | node | the second node in the constraint. |
| NetworkModel.Constraint | constraint | the NetworkModel.Constraint to be set. |
Remarks
The constraint must be an instance of NetworkModel.Constraint.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SetLabel(string)
Sets the label of this Node.
Declaration
public void SetLabel(string label)
Parameters
| Type | Name | Description |
|---|---|---|
| string | label | the label |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SetName(string)
Sets the name of this Node.
Declaration
public void SetName(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | the name of the Node (a String). |
Remarks
The name must be valid, i.e., it must follow the rules that govern the validity of C identifiers, and no other node in the network to which this Node belongs must have the same name.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SetPosition(Point)
Sets the position of this Node.
Declaration
public void SetPosition(Point position)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | position | The desired (x,y) coordinates of the Node. |
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |
SetUserData(object)
Sets some user-defined data for this Node.
Declaration
public void SetUserData(object data)
Parameters
| Type | Name | Description |
|---|---|---|
| object | data | An Object contaning the user-defined data associated with this Node. |
Remarks
Sets the user data field of this Node. The Hugin API provides a slot within each Node for use exclusively by the user/application. This slot can hold an instance of type Object, such as a String, a List{T}, etc. Please note that Hugin does not do anything to the user data. Data is not even copied. Only a reference to the data is stored.
SwitchParent(Node, Node)
Replace the given parent node with the new node.
Declaration
public void SwitchParent(Node oldParent, Node newParent)
Parameters
| Type | Name | Description |
|---|---|---|
| Node | oldParent | The old parent |
| Node | newParent | The new parent |
Remarks
The old and new parent must be compatible. That is, they must be of the same class, and have an identical state set.
Exceptions
| Type | Condition |
|---|---|
| ExceptionHugin |