public Cluster(JoinGraph.Node u, JoinGraph.Node v) { // Constructor for cluster_v(u) this.node = u; // add to the cluster all CPTs of the given node for (CPF cpf : u.functions) cpts.add(cpf.getDomainProduct()[0]); // add all incoming messages of n for (JoinGraph.Node nb : u.getNeighbors()) { if (!nb.equals(v)) { JoinGraph.Arc arc = u.arcs.get(nb); HashSet<MessageFunction> m = arc.getInMessage(u); if (!m.isEmpty()) functions.addAll(m); HashSet<BeliefNode> bn = arc.getCPTInMessage(u); if (!bn.isEmpty()) cpts.addAll(bn); } } }