def start(self): """ Starts the evidence distribution. """ self.start_clique.mark() for sep_set_id in self.join_tree.get_neighbors(self.start_clique.id): sep_set = self.join_tree.get_node(sep_set_id) for clique_id in self.join_tree.get_neighbors(sep_set_id): y = self.join_tree.get_node(clique_id) if not y.is_marked(): PotentialUtil.pass_single_message(self.join_tree, self.start_clique, sep_set, y) self.__walk__(self.start_clique, sep_set, y)
def start(self): """ Starts the evidence distribution. """ self.start_clique.mark() sepsets, cliques = self.__get_neighboring_cliques__( self.join_tree, self.start_clique) for clique in cliques: clique[1].mark() for s, c in zip(sepsets, cliques): PotentialUtil.pass_single_message(self.join_tree, self.start_clique, s[1], c[1]) self.__walk__(self.start_clique, s[1], c[1])
def __walk__(self, x, s, y): """ Walks away from the specified x clique. :param x: Clique. :param s: Separation-set. :param y: Clique. """ y.mark() for sep_set_id in self.join_tree.get_neighbors(y.id): sep_set = self.join_tree.get_node(sep_set_id) for clique_id in self.join_tree.get_neighbors(sep_set_id): clique = self.join_tree.get_node(clique_id) if not clique.is_marked(): self.__walk__(y, sep_set, clique) PotentialUtil.pass_single_message(self.join_tree, y, s, x)
def __walk__(self, x, s, y): """ Walks away from the specified node y. :param x: Clique. :param s: Separation-set. :param y: Clique. """ sepsets, cliques = self.__get_neighboring_cliques__(self.join_tree, y) s_arr = [] c_arr = [] for sep, cli in zip(sepsets, cliques): if not cli[1].is_marked(): cli[1].mark() s_arr.append(sep) c_arr.append(cli) for sep, cli in zip(s_arr, c_arr): PotentialUtil.pass_single_message(self.join_tree, y, sep[1], cli[1]) self.__walk__(y, sep[1], cli[1])