docstr: Cost function for WeightedMinFill.
  The cost of eliminating a node is the sum of weights of the edges that need to
  be added to the graph due to its elimination, where a weight of an edge is the
  product of the weights, domain cardinality, of its constituent vertices.
docstr_tok: ["Cost","function","for","WeightedMinFill",".","The","cost","of","eliminating","a","node","is","the","sum","of","weights","of","the","edges","that","need","to","be","added","to","the","graph","due","to","its","elimination",",","where","a","weight","of","an","edge","is","the","product","of","the","weights",",","domain","cardinality",",","of","its","constituent","vertices","."]
code: def cost(self, node):
      """
      Cost function for WeightedMinFill.
      The cost of eliminating a node is the sum of weights of the edges that need to
      be added to the graph due to its elimination, where a weight of an edge is the
      product of the weights, domain cardinality, of its constituent vertices.
      """
      edges = combinations(self.moralized_model.neighbors(node), 2)
      return sum(
          [
              self.bayesian_model.get_cardinality(edge[0])
              * self.bayesian_model.get_cardinality(edge[1])
              for edge in edges
          ]
      )
  
imports: from abc import abstractmethod
  from itertools import combinations
  import numpy
  from tqdm.auto import tqdm
  from pgmpy import config
  from pgmpy.models import BayesianNetwork
label_desc: Use image node_id 1 for calling the WeightedMinFill obj's underlying member method code with example usage: obj.cost(node) and returns: sum