#NEWLINE# def test_junction_tree_single_clique( self ) : #NEWLINE# #INDENT# self . graph . add_edges_from ( [ ( 'x1' , 'x2' ) , ( 'x2' , 'x3' ) , ( 'x1' , 'x3' ) ] ) #NEWLINE# phi = [ Factor ( edge , [ 2 , 2 ] , np . random . rand ( 4 ) ) for edge in self . graph . edges ( ) ] #NEWLINE# self . graph . add_factors ( * phi ) #NEWLINE# junction_tree = self . graph . to_junction_tree ( ) #NEWLINE# self . assertListEqual ( hf . recursive_sorted ( junction_tree . nodes ( ) ) , [ [ 'x1' , 'x2' , 'x3' ] ] ) #NEWLINE# factors = junction_tree . get_factors ( ) #NEWLINE# self . assertEqual ( factors [ 0 ] , factor_product ( * edge ) )