qlauncher.problems.optimization.graph_coloring#

This module contains the Graph Coloring class.

Summary#

Classes:

GraphColoring

Class for Graph Coloring Problem which is a combinatorial problem involving assigning labels to vertices of the graph such that no two adjacent vertices share the same label.

Reference#

class qlauncher.problems.optimization.graph_coloring.GraphColoring(instance: Graph, num_colors: int, instance_name: str = 'unnamed')[source]#

Bases: Problem

Class for Graph Coloring Problem which is a combinatorial problem involving assigning labels to vertices of the graph such that no two adjacent vertices share the same label.

instance#

The graph for which the coloring problem is to be solved.

Type:

nx.Graph

property setup: dict#
static from_preset(instance_name: Literal['default', 'small'], **kwargs) GraphColoring[source]#
classmethod from_file(path: str) Problem[source]#
visualize(solution: list[int] | None = None) None[source]#
static generate_graph_coloring_instance(num_vertices: int, edge_probability: int, num_colors: int) GraphColoring[source]#
static randomly_choose_a_graph(num_colors: int) GraphColoring[source]#
to_hamiltonian(constraints_weight: float = 1, costs_weight: float = 1) Hamiltonian[source]#
to_bqm() BQM[source]#

Returns BQM

to_qubo() QUBO[source]#