void GetRelatedNodes_bn ( nodelist_bn*  related_nodes,   const char*  relation,   const node_bn*  node )

Finds all the Nodes that bear the relationship relation with node and puts them in related_nodes.

relation should be one of "parents", "children", "ancestors", "descendents", "connected", "markov_blanket", "d_connected", or the singular version of any of the above (which does the same thing - see IsNodeRelated_bn for singular versions), or any of the above with various modifiers appended.

Modifiers may be appended (with comma seperators) in any order to the string containing the relation. The allowed modifiers are:
append    add to the list that is passed in (otherwise, that list is first emptied).
union    add to the list that is passed in and remove all duplicates.
intersection    reduce the passed-in list to only the nodes that are in both the original passed-in list and the relation.
subtract    take the nodes that are in the relation away from the passed-in list.
include_evidence_nodes    Note: only relevant for "markov_boundary" and "d_connected".
Without it the relation list will not contain any nodes with findings.
exclude_self    Note: only relevant for: "ancestors", "descendents", "connected", and "d_connected".
Without it the relation list will also include node (it being generation 0).

Note: The definition of "ancestor", "descendent", "connected", and "d_connected" is such that a node is considered a level-0 "ancestor", "descendent", etc. of itself. Append "exclude_self" (e.g., "ancestor,exclude_self") if you only wish to start from level-1.

If you wish to pass a list of nodes, instead of a single node, for node, then use the function GetRelatedNodesMult_bn instead.

Version:

Versions 3.05 and later have this function.

See also:

GetRelatedNodesMult_bn    Same, but for all members of a nodelist
IsNodeRelated_bn    Tests relationship of two nodes
GetNodeParents_bn    Specialized form for 'parents'
GetNodeChildren_bn    Specialized form for 'children'
GetNetNodes_bn    Get all nodes in the net

Example:

//Find all the descendants of a node, excluding the node itself.
nodelist_bn* descendants = NewNodeList2_bn (0, GetNodeNet_bn (node));
GetRelatedNodes_bn (descendants, "descendants,exclude_self", node);