Clique#

class Clique(graph, size=None)[source]#

Bases: GraphOptimizationApplication

Optimization application for the "clique" [1] problem based on a NetworkX graph.

References

[1]: "Clique (graph theory)", https://en.wikipedia.org/wiki/Clique_(graph_theory)

প্যারামিটার:
  • graph (Graph | ndarray | List) -- A graph representing a problem. It can be specified directly as a NetworkX graph, or as an array or list format suitable to build out a NetworkX graph.

  • size (int | None) -- The size of the clique. When it's None, the default, this class makes an optimization model for a maximal clique instead of the specified size of a clique.

Attributes

graph#

Getter of the graph

রিটার্নস:

A graph for a problem

size#

Getter of size

রিটার্নস:

The size of the clique, None when maximal clique

Methods

draw(result=None, pos=None)#

Draw a graph with the result. When the result is None, draw an original graph without colors.

প্যারামিটার:
interpret(result)[source]#

Interpret a result as a list of node indices

প্যারামিটার:

result (OptimizationResult | ndarray) -- The calculated result of the problem

রিটার্নস:

The list of node indices whose corresponding variable is 1

রিটার্ন টাইপ:

List[int]

static sample_most_likely(state_vector)#

Compute the most likely binary string from state vector.

প্যারামিটার:

state_vector (QuasiDistribution | Statevector | ndarray | Dict) -- state vector or counts or quasi-probabilities.

রিটার্নস:

binary string as numpy.ndarray of ints.

রেইজেস:

ValueError -- if state_vector is not QuasiDistribution, Statevector, np.ndarray, or dict.

রিটার্ন টাইপ:

ndarray

to_quadratic_program()[source]#

Convert a clique problem instance into a QuadraticProgram. When "size" is None, this makes an optimization model for a maximal clique instead of the specified size of a clique.

রিটার্নস:

The QuadraticProgram created from the clique problem instance.

রিটার্ন টাইপ:

QuadraticProgram