D-Wave Systems extension of the NetworkX Python package for graphs and graph algorithms.

dwavesystems, updated 🕥 2023-03-20 21:19:15

.. 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

.. inclusion-marker-do-not-remove

D-Wave NetworkX

.. index-start-marker

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.

.. index-end-marker

Installation

.. installation-start-marker

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

.. installation-end-marker

License

Released under the Apache License 2.0.

Contributing

Ocean's contributing guide <https://docs.ocean.dwavesys.com/en/stable/contributing.html>_ has guidelines for contributing to Ocean packages.

Issues

Plan to update `networkx` dependency?

opened on 2022-06-08 17:40:42 by boothby

The 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 dwave-networkx, minorminer, and 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.

Readme for dwave-networkx needs updating for other topologies (it only mentions Chimera)

opened on 2022-05-04 21:55:12 by fionahanington

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."

Unclear ``draw_chimera`` error message when nodes lack ``chimera_index`` attribute

opened on 2022-02-12 00:01:17 by JoelPasvolsky

Description The 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

To Reproduce

```

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.

Expected behavior 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 chimera_graph

Environment: - OS: WIN - Python version: 3.7.0

Layout overhaul

opened on 2021-12-07 16:14:02 by boothby

Normalizes node sizes across the board Makes yield plots easier to read Adds qubit-line plots

~needs a little more documentation~

Enumerate known QPU families/topologies

opened on 2021-11-03 16:05:52 by randomir

See https://github.com/dwavesystems/minorminer/pull/190#discussion_r741948893.

DiGraph support

opened on 2021-10-01 15:07:21 by rjcortese

Hello!

I want to use dwave-networkx with networkx.DiGraphs. Specifically, I'm trying to pass a networkx.DiGraph to 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.

Thanks!

Releases

0.8.13 2022-12-23 13:10:06

New Features

  • Add support for torus QPU graph variations. See https://github.com/dwavesystems/dwave-networkx/pull/225.

Fixes

  • Bug fix/documentation See https://github.com/dwavesystems/dwave-networkx/pull/223.

0.8.12 2022-03-02 22:28:10

New Features

  • No longer depend on dwave-preprocessing
  • Support dimod>=0.10.8,<0.13.0

Fixes

  • Fix reliance on Matplotlib's DivergingNorm. See https://github.com/dwavesystems/dwave-networkx/issues/192
  • Add missing decorator to weighted_maximum_cut()

Upgrades

  • Drop support for Python 3.6

0.8.11 2022-01-21 19:57:51

New Features

  • Add networkx.DiGraph support to traveling_salesperson_qubo(). See https://github.com/dwavesystems/dwave-networkx/pull/205.
  • No longer directly depend on the decorators package. See https://github.com/dwavesystems/dwave-networkx/pull/213.
  • Add graph relabeling and sub-lattice mappings. See https://github.com/dwavesystems/dwave-networkx/pull/211.
  • Add partition() and graph_partition_cqm(). See https://github.com/dwavesystems/dwave-networkx/pull/216.

Bug Fixes

  • cmap keyword argument can now be correctly supplied to draw_embedding(). See https://github.com/dwavesystems/dwave-networkx/pull/207.

0.8.10 2021-10-04 14:20:25

New Features

  • Add zephyr_elimination_order() function
  • Add coordinates keyword argument to chimera_elimination_order()
  • Add zephyr_coordinates() function
  • Add zephyr_layout(), draw_zephyr(), draw_zephyr_embedding(), and draw_zephyr_yield() functions
  • Add zephyr_graph() and zephyr_coordinates() functions

0.8.9 2021-09-09 21:30:55

New Features

  • Support dimod 0.10

Fixes

  • Fix broken documentation links

Changes

  • Drop support for python 3.4 and 3.5

0.8.8 2020-09-17 11:44:52

Fixes

  • Rearranged requirements files to follow Ocean style
D-Wave Systems Inc.

D-Wave's Ocean software and other open-source projects

GitHub Repository Homepage