class_docstr: Base class for representing Cluster Graph.
  
  Cluster graph is an undirected graph which is associated with a subset of variables. The graph contains undirected
  edges that connects clusters whose scopes have a non-empty intersection.
  
  Formally, a cluster graph is  :math:`\mathcal{U}` for a set of factors :math:`\Phi` over :math:`\mathcal{X}` is an
  undirected graph, each of whose nodes :math:`i` is associated with a subset :math:`C_i \subseteq X`. A cluster
  graph must be family-preserving - each factor :math:`\phi \in \Phi` must be associated with a cluster C, denoted
  :math:`\alpha(\phi)`, such that :math:`Scope[\phi] \subseteq C_i`. Each edge between a pair of clusters :math:`C_i`
  and :math:`C_j` is associated with a sepset :math:`S_{i,j} \subseteq C_i \cap C_j`.
  
  Parameters
  ----------
  data: input graph
      Data to initialize graph. If data=None (default) an empty graph is created. The data is an edge list
  
  Examples
  --------
  Create an empty ClusterGraph with no nodes and no edges
  
  >>> from pgmpy.models import ClusterGraph
  >>> G = ClusterGraph()
  
  G can be grown by adding clique nodes.
  
  **Nodes:**
  
  Add a tuple (or list or set) of nodes as single clique node.
  
  >>> G.add_node(('a', 'b', 'c'))
  >>> G.add_nodes_from([('a', 'b'), ('a', 'b', 'c')])
  
  **Edges:**
  
  G can also be grown by adding edges.
  
  >>> G.add_edge(('a', 'b', 'c'), ('a', 'b'))
  
  or a list of edges
  
  >>> G.add_edges_from([(('a', 'b', 'c'), ('a', 'b')),
  ...                   (('a', 'b', 'c'), ('a', 'c'))])
class_docstr_tok: ["Base","class","for","representing","Cluster","Graph",".","Cluster","graph","is","an","undirected","graph","which","is","associated","with","a","subset","of","variables",".","The","graph","contains","undirected","edges","that","connects","clusters","whose","scopes","have","a","non-empty","intersection",".","Formally",",","a","cluster","graph","is",":","math",":","`","\\mathcal","{","U","}","`","for","a","set","of","factors",":","math",":","`","\\Phi","`","over",":","math",":","`","\\mathcal","{","X","}","`","is","an","undirected","graph",",","each","of","whose","nodes",":","math",":","`","i","`","is","associated","with","a","subset",":","math",":","`","C_i","\\subseteq","X","`",".","A","cluster","graph","must","be","family-preserving","-","each","factor",":","math",":","`","\\phi","\\in","\\Phi","`","must","be","associated","with","a","cluster","C",",","denoted",":","math",":","`","\\alpha","(","\\phi",")","`",",","such","that",":","math",":","`","Scope","[","\\phi","]","\\subseteq","C_i","`",".","Each","edge","between","a","pair","of","clusters",":","math",":","`","C_i","`","and",":","math",":","`","C_j","`","is","associated","with","a","sepset",":","math",":","`","S_","{","i",",","j","}","\\subseteq","C_i","\\cap","C_j","`",".","Parameters","--","--","--","--","--","data",":","input","graph","Data","to","initialize","graph",".","If","data=None","(","default",")","an","empty","graph","is","created",".","The","data","is","an","edge","list","Examples","--","--","--","--","Create","an","empty","ClusterGraph","with","no","nodes","and","no","edges",">",">",">","from","pgmpy.models","import","ClusterGraph",">",">",">","G","=","ClusterGraph","(",")","G","can","be","grown","by","adding","clique","nodes",".","*","*","Nodes",":","*","*","Add","a","tuple","(","or","list","or","set",")","of","nodes","as","single","clique","node",".",">",">",">","G.add_node","(","(","'","a","'",",","'","b","'",",","'","c","'",")",")",">",">",">","G.add_nodes_from","(","[","(","'","a","'",",","'","b","'",")",",","(","'","a","'",",","'","b","'",",","'","c","'",")","]",")","*","*","Edges",":","*","*","G","can","also","be","grown","by","adding","edges",".",">",">",">","G.add_edge","(","(","'","a","'",",","'","b","'",",","'","c","'",")",",","(","'","a","'",",","'","b","'",")",")","or","a","list","of","edges",">",">",">","G.add_edges_from","(","[","(","(","'","a","'",",","'","b","'",",","'","c","'",")",",","(","'","a","'",",","'","b","'",")",")",",","...","(","(","'","a","'",",","'","b","'",",","'","c","'",")",",","(","'","a","'",",","'","c","'",")",")","]",")"]
docstr: Add a single node to the cluster graph.
  
  Parameters
  ----------
  node: node
      A node should be a collection of nodes forming a clique. It can be
      a list, set or tuple of nodes
  
  Examples
  --------
  >>> from pgmpy.models import ClusterGraph
  >>> G = ClusterGraph()
  >>> G.add_node(('a', 'b', 'c'))
docstr_tok: ["Add","a","single","node","to","the","cluster","graph",".","Parameters","--","--","--","--","--","node",":","node","A","node","should","be","a","collection","of","nodes","forming","a","clique",".","It","can","be","a","list",",","set","or","tuple","of","nodes","Examples","--","--","--","--",">",">",">","from","pgmpy.models","import","ClusterGraph",">",">",">","G","=","ClusterGraph","(",")",">",">",">","G.add_node","(","(","'","a","'",",","'","b","'",",","'","c","'",")",")"]
code: def add_node(self, node, **kwargs):
      """
      Add a single node to the cluster graph.
  
      Parameters
      ----------
      node: node
          A node should be a collection of nodes forming a clique. It can be
          a list, set or tuple of nodes
  
      Examples
      --------
      >>> from pgmpy.models import ClusterGraph
      >>> G = ClusterGraph()
      >>> G.add_node(('a', 'b', 'c'))
      """
      if not isinstance(node, (list, set, tuple)):
          raise TypeError(
              "Node can only be a list, set or tuple of nodes forming a clique"
          )
  
      node = tuple(node)
      super(ClusterGraph, self).add_node(node, **kwargs)
  
file_path: pgmpy/pgmpy/models/ClusterGraph.py
imports: from collections import defaultdict
  import numpy
  from pgmpy.base import UndirectedGraph
  from pgmpy.factors import factor_product
label_desc: Use image node_id 2 for calling the ClusterGraph obj's underlying member method code with example usage: obj.add_node(node) without return types