Combinatorial Optimization Generators tools

Generators used to solve combinatorial problems could return a parsed result. This parsed result is a class containing:

  • the raw Result found by the execution

  • the raw best Sample

  • a parsed version of the best Sample, that could be displayed

class qat.opt.results.GraphPartitioningResult(graph, *args, **kwargs)

Class describing a graph partitioning. This class allows for the representation of a solution of a graph combinatorial optimization problem under the form of a networkx graph to provide a visual display to the solution

display(with_figure=False, figsize=(6.4, 4.8), node_size=300, font_size=12, **kwargs)

Display the partitions using the draw_networkx method from networkx

Parameters
  • with_figure (bool, optional) – wrap the displayed in a matplotlib.pyplot figure

  • figsize (tuple, optional) – the size of the matplotlib.pyplot figure, only used if with_figure is True

  • node_size (int, optional) – the size of the node in the diagram passed to the draw_networkx function

  • font_size (int, optional) – the font size in the diagram passed to the draw_networkx function

K-Clique result

Generator KCliqueGenerator will cast the Result returned by the QPU into a KCliqueResult (which is a subclass of GraphPartitioningResult)

class qat.opt.results.KCliqueResult(graph, *args, **kwargs)

Result of a KClique problem. This class adds an attribute clique used to extract the clique found

property clique

Extract the nodes in the graph that forms the clique

Vertex cover result

Generator VertexCoverGenerator will cast the Result returned by the QPU into a VertexCoverResult (which is a subclass of GraphPartitioningResult)

class qat.opt.results.VertexCoverResult(graph, *args, **kwargs)

Result of a VertexCover problem. This class adds an attribute cover used to extract the vertex cover

property cover

Extract the nodes in the graph that forms the cover