dwave_networkx.is_clique#
- is_clique(G, clique_nodes)[source]#
Determines whether the given nodes form a clique.
A clique is a subset of nodes of an undirected graph such that every two distinct nodes in the clique are adjacent.
- Parameters:
G (NetworkX graph) – The graph on which to check the clique nodes.
clique_nodes (list) – List of nodes that form a clique, as determined by the given sampler.
- Returns:
is_clique – True if clique_nodes forms a clique.
- Return type:
Example
This example checks two sets of nodes, both derived from a single Chimera unit cell, for an independent set. The first set is the horizontal tile’s nodes; the second has nodes from the horizontal and verical tiles.
>>> import dwave_networkx as dnx >>> G = dnx.chimera_graph(1, 1, 4) >>> dnx.is_clique(G, [0, 1, 2, 3]) False >>> dnx.is_clique(G, [0, 4]) True