Skip to content

Commit

Permalink
🎨 pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Nov 22, 2024
1 parent 40b7c5f commit d5d1a25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
11 changes: 3 additions & 8 deletions src/mqt/qao/karp/karp_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ def clique_cover(
unique_vertices = set(graph.nodes())

unique_vertices = sorted(unique_vertices)


degree = {v: 0 for v in unique_vertices}
degree = dict.fromkeys(unique_vertices, 0)
for u, v in edges:
degree[u] += 1
degree[v] += 1
Expand Down Expand Up @@ -589,7 +588,6 @@ def vertex_cover(
unique_vertices = set(graph.nodes())

unique_vertices = sorted(unique_vertices)


problem = Problem()
variables = Variables()
Expand Down Expand Up @@ -947,8 +945,7 @@ def hamiltonian_path(
edges = set(graph.edges())
unique_vertices = set(graph.nodes())

unique_vertices = sorted(unique_vertices)

unique_vertices = sorted(unique_vertices)

problem = Problem()
variables = Variables()
Expand Down Expand Up @@ -1295,7 +1292,7 @@ def travelling_salesman(
parsed_pairs = [(int(key.split("_")[1]), int(key.split("_")[2])) for key in set_variables]
sorted_pairs = sorted(parsed_pairs, key=operator.itemgetter(1))
sorted_vertices = [vertex for vertex, time_step in sorted_pairs]

total_cost = 0
formatted_result = []
for i in range(len(sorted_vertices) - 1):
Expand Down Expand Up @@ -1633,7 +1630,6 @@ def max_cut(
unique_vertices = set(graph.nodes())

unique_vertices = sorted(unique_vertices)


problem = Problem()
variables = Variables()
Expand Down Expand Up @@ -1759,7 +1755,6 @@ def directed_feedback_vertex_set(
a = b * 3.0

unique_vertices = sorted(unique_vertices)


variables = Variables()
y_vars = {v: variables.add_binary_variable(f"y_{v}") for v in unique_vertices}
Expand Down
3 changes: 1 addition & 2 deletions src/mqt/qao/karp/karp_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def set_cover(
len(unique_elements)

unique_elements = sorted(unique_elements)

problem = Problem()
variables = Variables()
constraints = Constraints()
Expand Down Expand Up @@ -815,7 +815,6 @@ def exact_cover(
len(unique_elements)

unique_elements = sorted(unique_elements)


problem = Problem()
variables = Variables()
Expand Down

0 comments on commit d5d1a25

Please sign in to comment.