int AddLink_bn ( node_bn*  parent,   node_bn*  child )

Adds a link from node parent to node child, and returns the index of the added link.

This index will be one greater than that of the previously added link, and the existing links will maintain their same indexes.

If child has a table (CPT or function table), its entries are initially duplicated so its values are the same for each possible state of the new parent. In other words, they are independent of the new parent, so that the link from parent to child has no effect on probability computations until the table is changed.

parent must be in the same net as child, or an error will be generated, and no action taken.

A warning will be generated if there is already a link from parent to child, or if the added link creates a cycle, but the link will be successfully added. If you don't remove one of the offending links, and later try to compile the net or do node absorption, an error will be generated.


This function is available in all versions.

See also:

DeleteLink_bn    Removes the link between two nodes
SwitchNodeParent_bn    Switches parents without changing conditional probabilities
CopyNodes_bn    Also duplicates all the links between them