private List<BayesNetNode> markovBlanket(BayesNetNode node,
List<BayesNetNode> soFar)
{
// parents
List<BayesNetNode> parents = node.getParents();
foreach (BayesNetNode parent in parents)
{
if (!soFar.Contains(parent))
{
soFar.Add(parent);
}
}
// children
List<BayesNetNode> children = node.getChildren();
foreach (BayesNetNode child in children)
{
if (!soFar.Contains(child))
{
soFar.Add(child);
List<BayesNetNode> childsParents = child.getParents();
foreach (BayesNetNode childsParent in childsParents)
{
;
if ((!soFar.Contains(childsParent))
&& (!(childsParent.Equals(node))))
{
soFar.Add(childsParent);
}
}// childsParents
}// end contains child
}// end child
return soFar;
}