void GetRelatedNodesMult_bn ( nodelist_bn*  related_nodes,   const char*  relation,   const nodelist_bn*  nodes )

Finds all the Nodes that bear the relationship relation with any member of nodes and puts them in related_nodes.

Otherwise it works the same as GetRelatedNodes_bn; see that function for more information.

Note: It is okay if related_nodes = nodes (i.e., the list gets modified in-place).

On entry, nodes must not contain duplicates (but related_nodes may).

Tip: A handy and efficient way to remove the duplicates from any node list is to call this function with the node list as related_nodes, an empty list for nodes, and "parents,union" as the relation.

Version:

Versions 3.05 and later have this function.

See also:

GetRelatedNodes_bn    Same, but for a single node
IsNodeRelated_bn    Tests relationship of two nodes
GetNetNodes_bn    Get all nodes in the net

Example:

//find all the parents of all the children of a node
nodelist_bn* children =  GetNodeChildren_bn (node);
nodelist_bn* parentsOfChildren = NewNodeList2_bn (0, GetNodeNet_bn (node));
GetRelatedNodesMult_bn (parentsOfChildren, "parents", children);
Example 2:
//find all the descendants of the children of a node, excluding the children themselves.
//I.e., find grand-children, great-grandchildren, great-great-grandchildren, ...
nodelist_bn* children =  GetNodeChildren_bn (node);
nodelist_bn* descendants = NewNodeList2_bn (0, GetNodeNet_bn (node));
GetRelatedNodesMult_bn (descendants, "descendants,exclude_self", children);