Skip to content

Commit

Permalink
fix: Support no weight attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Elscrux committed Sep 3, 2024
1 parent f676552 commit 42cd354
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion solvers/qiskit/max-cut/maxCut_qiskit.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
for j in range(n):
temp = G.get_edge_data(i, j, default=0)
if temp != 0:
w[i, j] = temp["weight"]
weight = temp["weight"]
w[i, j] = 1 if weight is None else weight

max_cut = Maxcut(w)
qp = max_cut.to_quadratic_program()
Expand Down

0 comments on commit 42cd354

Please sign in to comment.