class_docstr: Init method for the base class of Elimination Orders.
  
  Parameters
  ----------
  model: BayesianNetwork instance
      The model on which we want to compute the elimination orders.
docstr: Returns the optimal elimination order based on the cost function.
  The node having the least cost is removed first.
  
  Parameters
  ----------
  nodes: list, tuple, set (array-like)
      The variables which are to be eliminated.
  
  Examples
  --------
  >>> import numpy as np
  >>> from pgmpy.models import BayesianNetwork
  >>> from pgmpy.factors.discrete import TabularCPD
  >>> from pgmpy.inference.EliminationOrder import WeightedMinFill
  >>> model = BayesianNetwork([('c', 'd'), ('d', 'g'), ('i', 'g'),
  ...                          ('i', 's'), ('s', 'j'), ('g', 'l'),
  ...                        ('l', 'j'), ('j', 'h'), ('g', 'h')])
  >>> cpd_c = TabularCPD('c', 2, np.random.rand(2, 1))
  >>> cpd_d = TabularCPD('d', 2, np.random.rand(2, 2),
  ...                   ['c'], [2])
  >>> cpd_g = TabularCPD('g', 3, np.random.rand(3, 4),
  ...                   ['d', 'i'], [2, 2])
  >>> cpd_i = TabularCPD('i', 2, np.random.rand(2, 1))
  >>> cpd_s = TabularCPD('s', 2, np.random.rand(2, 2),
  ...                   ['i'], [2])
  >>> cpd_j = TabularCPD('j', 2, np.random.rand(2, 4),
  ...                   ['l', 's'], [2, 2])
  >>> cpd_l = TabularCPD('l', 2, np.random.rand(2, 3),
  ...                   ['g'], [3])
  >>> cpd_h = TabularCPD('h', 2, np.random.rand(2, 6),
  ...                   ['g', 'j'], [3, 2])
  >>> model.add_cpds(cpd_c, cpd_d, cpd_g, cpd_i, cpd_s, cpd_j,
  ...                cpd_l, cpd_h)
  >>> WeightedMinFill(model).get_elimination_order(['c', 'd', 'g', 'l', 's'])
  ['c', 's', 'l', 'd', 'g']
  >>> WeightedMinFill(model).get_elimination_order(['c', 'd', 'g', 'l', 's'])
  ['c', 's', 'l', 'd', 'g']
  >>> WeightedMinFill(model).get_elimination_order(['c', 'd', 'g', 'l', 's'])
  ['c', 's', 'l', 'd', 'g']
docstr_tok: ["Returns","the","optimal","elimination","order","based","on","the","cost","function",".","The","node","having","the","least","cost","is","removed","first",".","Parameters","--","--","--","--","--","nodes",":","list",",","tuple",",","set","(","array-like",")","The","variables","which","are","to","be","eliminated",".","Examples","--","--","--","--",">",">",">","import","numpy","as","np",">",">",">","from","pgmpy.models","import","BayesianNetwork",">",">",">","from","pgmpy.factors.discrete","import","TabularCPD",">",">",">","from","pgmpy.inference.EliminationOrder","import","WeightedMinFill",">",">",">","model","=","BayesianNetwork","(","[","(","'","c","'",",","'d","'",")",",","(","'d","'",",","'","g","'",")",",","(","'","i","'",",","'","g","'",")",",","...","(","'","i","'",",","'s","'",")",",","(","'s","'",",","'","j","'",")",",","(","'","g","'",",","'","l","'",")",",","...","(","'","l","'",",","'","j","'",")",",","(","'","j","'",",","'","h","'",")",",","(","'","g","'",",","'","h","'",")","]",")",">",">",">","cpd_c","=","TabularCPD","(","'","c","'",",","2",",","np.random.rand","(","2",",","1",")",")",">",">",">","cpd_d","=","TabularCPD","(","'d","'",",","2",",","np.random.rand","(","2",",","2",")",",","...","[","'","c","'","]",",","[","2","]",")",">",">",">","cpd_g","=","TabularCPD","(","'","g","'",",","3",",","np.random.rand","(","3",",","4",")",",","...","[","'d","'",",","'","i","'","]",",","[","2",",","2","]",")",">",">",">","cpd_i","=","TabularCPD","(","'","i","'",",","2",",","np.random.rand","(","2",",","1",")",")",">",">",">","cpd_s","=","TabularCPD","(","'s","'",",","2",",","np.random.rand","(","2",",","2",")",",","...","[","'","i","'","]",",","[","2","]",")",">",">",">","cpd_j","=","TabularCPD","(","'","j","'",",","2",",","np.random.rand","(","2",",","4",")",",","...","[","'","l","'",",","'s","'","]",",","[","2",",","2","]",")",">",">",">","cpd_l","=","TabularCPD","(","'","l","'",",","2",",","np.random.rand","(","2",",","3",")",",","...","[","'","g","'","]",",","[","3","]",")",">",">",">","cpd_h","=","TabularCPD","(","'","h","'",",","2",",","np.random.rand","(","2",",","6",")",",","...","[","'","g","'",",","'","j","'","]",",","[","3",",","2","]",")",">",">",">","model.add_cpds","(","cpd_c",",","cpd_d",",","cpd_g",",","cpd_i",",","cpd_s",",","cpd_j",",","...","cpd_l",",","cpd_h",")",">",">",">","WeightedMinFill","(","model",")",".get_elimination_order","(","[","'","c","'",",","'d","'",",","'","g","'",",","'","l","'",",","'s","'","]",")","[","'","c","'",",","'s","'",",","'","l","'",",","'d","'",",","'","g","'","]",">",">",">","WeightedMinFill","(","model",")",".get_elimination_order","(","[","'","c","'",",","'d","'",",","'","g","'",",","'","l","'",",","'s","'","]",")","[","'","c","'",",","'s","'",",","'","l","'",",","'d","'",",","'","g","'","]",">",">",">","WeightedMinFill","(","model",")",".get_elimination_order","(","[","'","c","'",",","'d","'",",","'","g","'",",","'","l","'",",","'s","'","]",")","[","'","c","'",",","'s","'",",","'","l","'",",","'d","'",",","'","g","'","]"]
code: def get_elimination_order(self, nodes=None, show_progress=True):
      """
      Returns the optimal elimination order based on the cost function.
      The node having the least cost is removed first.
  
      Parameters
      ----------
      nodes: list, tuple, set (array-like)
          The variables which are to be eliminated.
  
      Examples
      --------
      >>> import numpy as np
      >>> from pgmpy.models import BayesianNetwork
      >>> from pgmpy.factors.discrete import TabularCPD
      >>> from pgmpy.inference.EliminationOrder import WeightedMinFill
      >>> model = BayesianNetwork([('c', 'd'), ('d', 'g'), ('i', 'g'),
      ...                          ('i', 's'), ('s', 'j'), ('g', 'l'),
      ...                        ('l', 'j'), ('j', 'h'), ('g', 'h')])
      >>> cpd_c = TabularCPD('c', 2, np.random.rand(2, 1))
      >>> cpd_d = TabularCPD('d', 2, np.random.rand(2, 2),
      ...                   ['c'], [2])
      >>> cpd_g = TabularCPD('g', 3, np.random.rand(3, 4),
      ...                   ['d', 'i'], [2, 2])
      >>> cpd_i = TabularCPD('i', 2, np.random.rand(2, 1))
      >>> cpd_s = TabularCPD('s', 2, np.random.rand(2, 2),
      ...                   ['i'], [2])
      >>> cpd_j = TabularCPD('j', 2, np.random.rand(2, 4),
      ...                   ['l', 's'], [2, 2])
      >>> cpd_l = TabularCPD('l', 2, np.random.rand(2, 3),
      ...                   ['g'], [3])
      >>> cpd_h = TabularCPD('h', 2, np.random.rand(2, 6),
      ...                   ['g', 'j'], [3, 2])
      >>> model.add_cpds(cpd_c, cpd_d, cpd_g, cpd_i, cpd_s, cpd_j,
      ...                cpd_l, cpd_h)
      >>> WeightedMinFill(model).get_elimination_order(['c', 'd', 'g', 'l', 's'])
      ['c', 's', 'l', 'd', 'g']
      >>> WeightedMinFill(model).get_elimination_order(['c', 'd', 'g', 'l', 's'])
      ['c', 's', 'l', 'd', 'g']
      >>> WeightedMinFill(model).get_elimination_order(['c', 'd', 'g', 'l', 's'])
      ['c', 's', 'l', 'd', 'g']
      """
      if nodes is None:
          nodes = self.bayesian_model.nodes()
      nodes = set(nodes)
  
      ordering = []
      if show_progress and config.SHOW_PROGRESS:
          pbar = tqdm(total=len(nodes))
          pbar.set_description("Finding Elimination Order: ")
  
      while nodes:
          scores = {node: self.cost(node) for node in nodes}
          min_score_node = min(scores, key=scores.get)
          ordering.append(min_score_node)
          nodes.remove(min_score_node)
          self.bayesian_model.remove_node(min_score_node)
          self.moralized_model.remove_node(min_score_node)
  
          if show_progress and config.SHOW_PROGRESS:
              pbar.update(1)
      return ordering
  
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 3 for calling the BaseEliminationOrder obj's underlying member method code with example usage: obj.get_elimination_order(nodes, show_progress) and returns: ordering