You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 12, 2026. It is now read-only.
qiskit_optimization.applications.max_cut.Maxcut cannot work along with the graph non-consecutive nodes (e.g. V={0, 1, 4, 5}). This may result in minor inconvenience when we create graph and then remove nodes, such as isolated nodes. Obviously, it is not necessary to keep isolated nodes (i.e., nodes not connected to any other nodes) for max-cut problem and waste qubits.
Solution
Simply replace line 44 in file qiskit_optimization.applications.max_cut.py in current git version (2b5c37b) from
It is so simple that it does not require testing. This is also the reason why I made issue instead of pull request; only a single line changed. However, it is bugging me that I have to inherit the well-made Maxcut class every time to insert this feature.
It would be great to add this line of code to this repo to be feasible with non-consecutive nodes.
What should we add?
Problem
qiskit_optimization.applications.max_cut.Maxcutcannot work along with the graph non-consecutive nodes (e.g.V={0, 1, 4, 5}). This may result in minor inconvenience when we create graph and then remove nodes, such as isolated nodes. Obviously, it is not necessary to keep isolated nodes (i.e., nodes not connected to any other nodes) for max-cut problem and waste qubits.Solution
Simply replace line 44 in file
qiskit_optimization.applications.max_cut.pyin current git version (2b5c37b) fromto
See my forked repo
Test
It is so simple that it does not require testing. This is also the reason why I made issue instead of pull request; only a single line changed. However, it is bugging me that I have to inherit the well-made
Maxcutclass every time to insert this feature.It would be great to add this line of code to this repo to be feasible with non-consecutive nodes.