Registry / data / dwave-networkx

dwave-networkx

JSON →
library0.8.19pypypi✓ verified 85d ago

A NetworkX extension providing graphs and algorithms relevant to working with the D-Wave System. Current version: 0.8.18. Release cadence: roughly quarterly.

pip install dwave-networkx
INSTALL
IMPORT
SIG · DWAVE-NETWORKX
D
dwave-networkx
datapythonv0.8.19
Install
5.3s avg
Import
870ms
Disk
153MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.8.19 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 5.3s · import 0.870s · 149MB
153MB installed
● package 153MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

dwave_networkx
import dwave_networkx as dnx
import dwave_networkx.dwave_networkx as dnx
dwave_networkx is a top-level package, not a submodule of itself.
chimera_graph
from dwave_networkx import chimera_graph
Correct import for Chimera graph generator.
draw_chimera
from dwave_networkx import draw_chimera
import dwave_networkx.draw.draw_chimera
Drawing functions are exposed at the top level.

Basic usage: create a D-Wave graph and solve a problem using dwave-networkx algorithms.

import networkx as nx import dwave_networkx as dnx import dimod # Create a Chimera graph (hardware graph) G = dnx.chimera_graph(1, 1, 4) print(f"Nodes: {len(G.nodes)}, Edges: {len(G.edges)}") # Example: maximum independent set (QUBO formulation) from dimod import ExactSolver # Solve maximum independent set on a small graph H = nx.path_graph(3) qubo, offset = dnx.algorithms.independent_set.maximum_independent_set_qubo(H) sampler = ExactSolver() sampleset = sampler.sample_qubo(qubo) solution = dnx.algorithms.independent_set.maximum_independent_set(H, sampler) print(f"Maximum independent set: {solution}")
Debug
Known issues
breakingVersion 0.8.14 dropped support for Python 3.7 and earlier. If you are using Python 3.7 or below, you must use an older version (<=0.8.13).
fix
Upgrade Python to 3.9+ or pin dwave-networkx to 0.8.13.
affects: <0.8.14
breakingVersion 0.8.12 removed dependency on dwave-preprocessing. If your code relied on dwave-preprocessing being installed implicitly, you need to add it explicitly.
fix
Run 'pip install dwave-preprocessing' if you use its features directly.
affects: >=0.8.12
deprecatedThe dwave-networkx package uses some deprecated NetworkX APIs that may be removed in future NetworkX versions. For example, the use of `nx.MultiGraph` in certain graph constructors may need updating.
fix
Monitor NetworkX deprecation warnings. Use `import warnings; warnings.filterwarnings('ignore', category=DeprecationWarning)` if needed.
affects: all
gotchaDrawing functions (e.g., `draw_chimera`, `draw_zephyr`) require Matplotlib to be installed. They will raise an ImportError if Matplotlib is missing.
fix
Install Matplotlib: 'pip install matplotlib'.
affects: all
gotchaThe `maximum_independent_set` algorithm uses `dimod.ExactSolver()` by default, which is only suitable for very small graphs. For larger graphs, provide a different sampler.
fix
Pass a sampler like `dwave.system.DWaveSampler()` to the algorithm.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'dwave_networkx'
Package not installed or installed in wrong environment.
fix
Run 'pip install dwave-networkx' in the correct Python environment.
ImportError: cannot import name 'chimera_graph'
Using incorrect import path (e.g., from dwave_networkx.generators import chimera_graph instead of from dwave_networkx import chimera_graph).
fix
Use 'from dwave_networkx import chimera_graph'.
AttributeError: module 'dwave_networkx' has no attribute 'draw_chimera'
Matplotlib is not installed, or using an old version of dwave-networkx before drawing functions were added.
fix
Install Matplotlib: 'pip install matplotlib'. If that doesn't work, update dwave-networkx to >=0.8.10.
ValueError: The graph is not bipartite?
Using a graph not compatible with the expected topology (e.g., trying to embed a non-bipartite graph into a Chimera structure).
fix
Ensure the input graph matches the topology requirements. Check the documentation for the specific algorithm.
Upgrade
Version history
0.8.19latest on PyPI · released Jun 16, 2026
Audit
Dependencies
networkxrequiredCore dependency: extends NetworkX with D-Wave specific graph topologies and algorithms.
dimodrequiredRequired for QUBO formulations and converting to binary quadratic models used by D-Wave systems.
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
dwave-networkx — pip install dwave-networkx · libregistry