void DeleteNode_bn ( node_bn*  node )

Removes node from its net, and frees all resources (e.g., memory) it was using.

If node has children, they will end up with disconnected links for parents, and the names of these links (if they weren't already named) will become the name of node. If node has parents, then links from them will simply be removed.

If a complete net is to be disposed of, use DeleteNet_bn instead.

Version:

This function is available in all versions.

See also:

NewNode_bn  (Inverse operation) Creates a new node in a net
AbsorbNodes_bn  Maintains joint distribution while removing
DeleteNet_bn  Deletes all the nodes of a net

Example:

// Removes all of 'nodes' from their net, and deletes them and node list 'nodes'.
//
void DeleteNodes (nodelist_bn* nodes){
    int i, num = LengthNodeList_bn (nodes);
    for (i = 0;  i < num;  ++i){
        node_bn* node = NthNode_bn (nodes, i);
        SetNthNode_bn (nodes, i, NULL);  // so node list stays legal
        DeleteNode_bn (node);
    }
    DeleteNodeList_bn (nodes);
}