Check if the given nodes form a clique.

        Parameters
        ----------
        nodes: list, array-like
            List of nodes to check if they are a part of any clique.

        Examples
        --------
        >>> from pgmpy.base import UndirectedGraph
        >>> G = UndirectedGraph(ebunch=[('A', 'B'), ('C', 'B'), ('B', 'D'),
                                        ('B', 'E'), ('D', 'E'), ('E', 'F'),
                                        ('D', 'F'), ('B', 'F')])
        >>> G.is_clique(nodes=['A', 'B', 'C', 'D'])
        False
        >>> G.is_clique(nodes=['B', 'D', 'E', 'F'])
        True

        Since B, D, E and F are clique, any subset of these should also
        be clique.
        >>> G.is_clique(nodes=['D', 'E', 'B'])
        True

def is_clique(self, nodes):
        """
        Check if the given nodes form a clique.

        Parameters
        ----------
        nodes: list, array-like
            List of nodes to check if they are a part of any clique.

        Examples
        --------
        >>> from pgmpy.base import UndirectedGraph
        >>> G = UndirectedGraph(ebunch=[('A', 'B'), ('C', 'B'), ('B', 'D'),
                                        ('B', 'E'), ('D', 'E'), ('E', 'F'),
                                        ('D', 'F'), ('B', 'F')])
        >>> G.is_clique(nodes=['A', 'B', 'C', 'D'])
        False
        >>> G.is_clique(nodes=['B', 'D', 'E', 'F'])
        True

        Since B, D, E and F are clique, any subset of these should also
        be clique.
        >>> G.is_clique(nodes=['D', 'E', 'B'])
        True
        """
        for node1, node2 in itertools.combinations(nodes, 2):
            if not self.has_edge(node1, node2):
                return False
        return True