.. image:: https://img.shields.io/pypi/v/dwave-networkx.svg :target: https://pypi.org/project/dwave-networkx
.. image:: https://readthedocs.com/projects/d-wave-systems-dwave-networkx/badge/?version=latest :target: https://docs.ocean.dwavesys.com/projects/dwave-networkx/en/latest/?badge=latest
.. image:: https://codecov.io/gh/dwavesystems/dwave-networkx/branch/main/graph/badge.svg :target: https://codecov.io/gh/dwavesystems/dwave-networkx
.. image:: https://circleci.com/gh/dwavesystems/dwave-networkx.svg?style=svg :target: https://circleci.com/gh/dwavesystems/dwave-networkx
D-Wave NetworkX is an extension of
NetworkX <https://networkx.org>_\ ---a
Python language package for exploration and analysis of networks and network
algorithms---for users of D-Wave Systems. It provides tools for working with
Chimera graphs and implementations of graph-theory algorithms on the D-Wave
system and other binary quadratic model samplers.
The example below generates a graph for a Chimera unit cell (eight nodes in a 4-by-2 bipartite architecture).
.. code: python
import dwave_networkx as dnx graph = dnx.chimera_graph(1, 1, 4)
See the documentation for more examples.
Installation from PyPi:
.. code-block:: bash
pip install dwave_networkx
Installation from source:
.. code-block:: bash
pip install -r requirements.txt python setup.py install
Released under the Apache License 2.0.
contributing guide <https://docs.ocean.dwavesys.com/en/stable/contributing.html>_
has guidelines for contributing to Ocean packages.
networkx dependency has been pinned at 2.4 for quite a while, which is quite outdated (currently v2.8.3). The Python support window is sliding, and
networkx2.4 officially supports py3.5 through py3.8;
networkx2.8.3 supports py3.8 through py3.10. The NetworkX deprecation policy is that breaking changes can be made over the course of two minor releases, so maintaining this pinned version may be accumulating a backlog of unnoticed deprecations. And, of course, we're missing out on performance improvements and bugfixes.
Updating this pin will require some coordination between
dimod; I'm sure that this list is incomplete. While there's no immediate need, it would be good to do this sooner rather than later.
Description Readme for dwave-networkx needs updating for other topologies (it only mentions Chimera)
To Reproduce Go to https://docs.ocean.dwavesys.com/en/stable/docs_dnx/sdk_index.html or readme of this repo
Expected behavior Should also mention Pegasus and Chimera in this sentence: "It provides tools for working with Chimera graphs and implementations of graph-theory algorithms on the D-Wave system and other binary quadratic model samplers."
draw_chimera function takes a NetworkX graph as input. The docstring says "Should be a Chimera graph or a subgraph of a Chimera graph" which can mean either that its edges must be a Chimera lattice subset or that the NetworkX graph must be generated by
chimera_graph, it's unclear which is the intention.
Assuming the former, if the NX graph is missing some
chimera_index attributes, the function returns the obscure
NetworkXError: Found infinite path length because the graph is not connected error because
draw_chimera tries to calculate the graph's diameter in https://github.com/dwavesystems/dwave-networkx/blob/a4a1eb6176399f6e2aaac8bf9b1b84815320a52d/dwave_networkx/generators/chimera.py#L272
G = nx.Graph() G.add_nodes_from([0, 3, 4, 7]) G.add_edges_from([(0, 4), (0, 5), (5, 13)]) dnx.draw_chimera(G, with_labels=True) ```
If I either add the
chimera_index to nodes in the two-tile NX graph or stick to the nodes of a single tile (due to https://github.com/dwavesystems/dwave-networkx/blob/a4a1eb6176399f6e2aaac8bf9b1b84815320a52d/dwave_networkx/generators/chimera.py#L288), the function works fine.
1. Clarify if
draw_chimera should accept any NX graph that is a subgraph of a Chimera lattice
2. If yes, either require that nodes have
chimera_index or add them without an error for more than two unit cells
3. If no, specify in the docstring that the NX graph must be produced by
Environment: - OS: WIN - Python version: 3.7.0
Normalizes node sizes across the board Makes yield plots easier to read Adds qubit-line plots
~needs a little more documentation~
I want to use dwave-networkx with
Specifically, I'm trying to pass a
dwave_networkx.traveling_salesperson but it does not seem to work. My DiGraph is complete and I believe does meet other requirements.
Is there already support for DiGraph? If not, I propose it be added.
DivergingNorm. See https://github.com/dwavesystems/dwave-networkx/issues/192
traveling_salesperson_qubo(). See https://github.com/dwavesystems/dwave-networkx/pull/205.
decoratorspackage. See https://github.com/dwavesystems/dwave-networkx/pull/213.
graph_partition_cqm(). See https://github.com/dwavesystems/dwave-networkx/pull/216.
cmapkeyword argument can now be correctly supplied to
draw_embedding(). See https://github.com/dwavesystems/dwave-networkx/pull/207.
coordinateskeyword argument to
D-Wave's Ocean software and other open-source projectsGitHub Repository Homepage