Nodes are one of the fundamental objects used in the construction of Bayesian networks and LIMIDs. More...
Public Member Functions | |
void | addParent (Node *parent) |
Add parent as a new parent of this node. | |
void | addToInputs () |
Add this Node to the list of input nodes in this Class. | |
void | addToOutputs () |
Add this Node to the list of output nodes in this Class. | |
virtual Node * | clone () const =0 |
Clone this Node object. | |
void | deleteAttribute (const std::string &key) |
Delete the specified attribute from the attribute list of this Node. | |
void | generateTable () |
Generate the table for this Node as it is specified by the model (i.e., the expressions). | |
std::string | getAttribute (const std::string &key) const |
Return the value associated with key in the attribute list of this node. | |
AttributeList | getAttributes () const |
Returns a vector of attributes associated with this Node. | |
virtual Category | getCategory () const =0 |
Return the node category. | |
NodeList | getChildren () const |
Return a NodeList containing the children of this node. | |
Domain * | getDomain () const |
Return the Domain this Node belongs to. | |
Constraint | getEdgeConstraint (Node *bNode) const |
Retrieve the learning constraint specified for the edge. | |
Class * | getHomeClass () const |
Get the class in which this node is placed. | |
Domain * | getHomeDomain () const |
Get the Domain in which this node is placed. | |
Node * | getInstance () const |
Returns the InstanceNode containing this (cloned) output node. | |
JunctionTree * | getJunctionTree () const |
Return the JunctionTree to which this node belongs. | |
virtual Kind | getKind () const =0 |
Return the node kind. | |
std::string | getLabel () const |
Get the label of this node. | |
Node * | getMaster () const |
Returns the "master" of this (cloned) output Node of an InstanceNode (i.e., the Node cloned to get this output Node). | |
Model * | getModel () const |
Return the Model of this Node. | |
std::string | getName () |
Retrieve the name of this Node. | |
NodeList | getParents () const |
Return a NodeList containing the parents of this node. | |
std::pair< int, int > | getPosition () const |
Return the position of the node. | |
NodeList | getSource () const |
Returns a NodeList of Class nodes that identifies this Domain node. | |
Table * | getTable () |
Return the table associated with this Node. | |
void * | getUserData () const |
Return the value stored within the user data slot of this node. | |
bool | hasAttribute (const std::string &key) const |
Test if this Node has an attribute with the specified key. | |
void | removeFromInputs () |
Remove this Node from the list of input nodes in the Class. | |
void | removeFromOutputs () |
Remove this Node from the list of output nodes in the Class. | |
void | removeParent (Node *parent) |
Remove the directed link between parent and this node. | |
void | setAttribute (const std::string &key, const std::string &value) |
Insert the key/value pair in the attribute list of this Node. | |
void | setEdgeConstraint (Node *bNode, Constraint C) |
Specify constraint for the edge. | |
void | setLabel (const std::string &label) |
Set the node label. | |
void | setLabel (const char *label) |
Set the node label. | |
void | setName (const std::string &name) |
Create a copy of name and assign it to this node. | |
void | setName (const char *name) |
Create a copy of name and assign it to this node. | |
void | setPosition (const std::pair< int, int > &pos) |
Set the position of the node. | |
void | setPosition (int x, int y) |
Set the position of the node. | |
void | setUserData (void *data) |
The Hugin API provides a data slot within each Node object. | |
void | switchParent (Node *oldParent, Node *newParent) |
Substitute a new parent for an old parent. | |
virtual | ~Node () throw () |
Delete Node. |
Nodes are one of the fundamental objects used in the construction of Bayesian networks and LIMIDs.
All nodes need a NetworkModel (i.e., a Class or a Domain); that is, the network must exist before its nodes can be created.
virtual HAPI::Node::~Node | ( | ) | throw () [virtual] |
Delete Node.
The node is deleted from its domain. If the domain was compiled, the corresponding compiled structure is deleted. All references and pointers to the node become invalid.
void HAPI::Node::addParent | ( | Node * | parent | ) |
Add parent as a new parent of this node.
That is, add a directed link from parent to this node.
void HAPI::Node::addToInputs | ( | ) |
void HAPI::Node::addToOutputs | ( | ) |
virtual Node* HAPI::Node::clone | ( | ) | const [pure virtual] |
Clone this Node object.
Implemented in HAPI::LabelledDCNode, HAPI::NumberedDCNode, HAPI::BooleanDCNode, HAPI::IntervalDCNode, HAPI::ContinuousChanceNode, HAPI::LabelledDDNode, HAPI::NumberedDDNode, HAPI::BooleanDDNode, HAPI::IntervalDDNode, HAPI::UtilityNode, HAPI::FunctionNode, and HAPI::InstanceNode.
void HAPI::Node::deleteAttribute | ( | const std::string & | key | ) |
Delete the specified attribute from the attribute list of this Node.
If the key doesn't exist, no action is taken.
void HAPI::Node::generateTable | ( | ) |
Generate the table for this Node as it is specified by the model (i.e., the expressions).
If one or more expressions are illegal in one way or the other, an expression is thrown.
std::string HAPI::Node::getAttribute | ( | const std::string & | key | ) | const |
Return the value associated with key in the attribute list of this node.
Domain* HAPI::Node::getDomain | ( | ) | const |
Domain* HAPI::Node::getHomeDomain | ( | ) | const |
Get the Domain in which this node is placed.
This function is equivalent to getDomain, and is only here for consistency with getHomeClass.
Node* HAPI::Node::getInstance | ( | ) | const |
Returns the InstanceNode containing this (cloned) output node.
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.
Node* HAPI::Node::getMaster | ( | ) | const |
Returns the "master" of this (cloned) output Node of an InstanceNode (i.e., the Node cloned to get this output Node).
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.
std::string HAPI::Node::getName | ( | ) |
Retrieve the name of this Node.
If this node has not previously been assigned a name, a valid name will automatically be assigned.
NodeList HAPI::Node::getSource | ( | ) | const |
Returns a NodeList of Class nodes that identifies this Domain node.
The createDomain method of the Class class unfolds an object-oriented (nested) specification of a Bayesian network or a LIMID into a regular Domain object.
Nodes in this Domain which originates from nodes residing in nested sub-networks (via InstanceNodes) can be uniquely related to a sequence of InstanceNodes and an ordinary Node of the object-oriented network.
Table* HAPI::Node::getTable | ( | ) |
Return 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.
void* HAPI::Node::getUserData | ( | ) | const [inline] |
Return 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, that pointers are accessed correctly, etc. Also note that when you delete a node, Hugin does not attempt to delete the data pointed to by the user data slot. It is the responsibility of the user.
void HAPI::Node::removeFromInputs | ( | ) |
void HAPI::Node::removeFromOutputs | ( | ) |
void HAPI::Node::removeParent | ( | Node * | parent | ) |
Remove the directed link between parent
and this node.
The table (if any) is updated such that the updated table contains the portion of the old table that corresponds to parent
being in its first state (if parent
is discrete).
parent | Pointer to the parent Node that will be removed. |
void HAPI::Node::setAttribute | ( | const std::string & | key, | |
const std::string & | value | |||
) |
Insert the key/value pair in the attribute list of this Node.
If the key is already defined, the value is updated.
void HAPI::Node::setName | ( | const std::string & | name | ) |
Create a copy of name and assign it to this node.
name must be a valid name, i.e., it must follow the rules that govern the validity of C identifiers, and no other node in the domain to which *this
node belongs can have the same name.
name | the desired name of the node. |
void HAPI::Node::setName | ( | const char * | name | ) |
Create a copy of name and assign it to this node.
name must be a valid name, i.e., it must follow the rules that govern the validity of C identifiers, and no other node in the domain to which *this
node belongs can have the same name.
name | A pointer to a zero-terminated string containing the desired name of the node. |
void HAPI::Node::setPosition | ( | int | x, | |
int | y | |||
) |
Set the position of the node.
x | The desired x coordinate of the node. | |
y | The desired y coordinate of the node. |
void HAPI::Node::setUserData | ( | void * | data | ) | [inline] |
The Hugin API provides a data slot within each Node object.
This data slot is for use exclusively by the user/application. This slot can hold a pointer to arbitrary data, such as a file, a display window, an input buffer from hardware sensors, etc. Please note that Hugin does not do anything to the user data. Data is not even copied. Only the pointer to the data is stored.
data | Pointer to user-defined data associated with this node. |