Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to namespace package #185

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[run]
# omit virtualenv and test files
omit = venv/*, */tests/*
source=dwave_networkx
source=dwave_networkx, dwave/plugins/networkx

[report]
exclude_lines:
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ bipartite architecture).

.. code: python

>>> import dwave_networkx as dnx
>>> import dwave.plugins.networkx as dnx
>>> graph = dnx.chimera_graph(1, 1, 4)

See the documentation for more examples.
Expand All @@ -44,7 +44,7 @@ Installation

.. code-block:: bash

pip install dwave_networkx
pip install dwave-networkx

**Installation from source:**

Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
# |version| and |release|, also used in various other places throughout the
# built documents.
#
import dwave_networkx
import dwave.plugins.networkx
# The short X.Y version.
version = dwave_networkx.__version__
version = dwave.plugins.networkx.__version__
# The full version, including alpha/beta/rc tags.
release = dwave_networkx.__version__
release = dwave.plugins.networkx.__version__

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Below you can see how to create Chimera graphs implemented in the D-Wave 2X and

.. code:: python

import dwave_networkx as dnx
import dwave.plugins.networkx as dnx

# D-Wave 2X
C = dnx.chimera_graph(12, 12, 4)
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/algorithms/canonicalization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Canonicalization
****************

.. automodule:: dwave_networkx.algorithms.canonicalization
.. automodule:: dwave.plugins.networkx.algorithms.canonicalization

.. currentmodule:: dwave_networkx
.. currentmodule:: dwave.plugins.networkx

.. autosummary::
:toctree: generated/
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/algorithms/clique.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ such that for every two vertices in C there exists an edge connecting the two.
:align: center
:scale: 40 %

.. automodule:: dwave_networkx.algorithms.clique
.. automodule:: dwave.plugins.networkx.algorithms.clique

.. currentmodule:: dwave_networkx
.. currentmodule:: dwave.plugins.networkx

.. autosummary::
:toctree: generated/
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/algorithms/coloring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ border (represented by an edge of the graph) have different colors.

Coloring a map of Canada with four colors.

.. automodule:: dwave_networkx.algorithms.coloring
.. automodule:: dwave.plugins.networkx.algorithms.coloring
.. autosummary::
:toctree: generated/

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/algorithms/cover.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set.
(the horizontal tile of the Chimera unit cell) and the red set
(vertical tile) connect to all 16 edges of the graph.

.. automodule:: dwave_networkx.algorithms.cover
.. automodule:: dwave.plugins.networkx.algorithms.cover
.. autosummary::
:toctree: generated/

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/algorithms/elimination_ordering.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ whose neighborhood induces a clique. A perfect elimination ordering is an
ordering of vertices :math:`1..n` such that any vertex :math:`i` is simplicial
for the subset of vertices :math:`i..n`.

.. automodule:: dwave_networkx.algorithms.elimination_ordering
.. automodule:: dwave.plugins.networkx.algorithms.elimination_ordering
.. autosummary::
:toctree: generated/

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/algorithms/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Algorithms
Implementations of graph-theory algorithms on the D-Wave system and other
binary quadratic model samplers.

.. currentmodule:: dwave_networkx
.. currentmodule:: dwave.plugins.networkx

.. toctree::
:maxdepth: 2
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/algorithms/markov.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Markov Networks
***************

.. automodule:: dwave_networkx.algorithms.markov
.. automodule:: dwave.plugins.networkx.algorithms.markov
.. autosummary::
:toctree: generated/

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/algorithms/matching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A matching is a subset of graph edges in which no vertex occurs more than once.
A matching for a Chimera unit cell: no vertex is incident to more than one
edge in the set of blue edges

.. automodule:: dwave_networkx.algorithms.matching
.. automodule:: dwave.plugins.networkx.algorithms.matching
.. autosummary::
:toctree: generated/

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/algorithms/max_cut.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ between this subset and the remaining vertices is as large as possible.
{4, 5, 6, 7} cuts 16 edges; adding or removing a node decreases
the number of edges between the two complementary subsets of the graph.

.. automodule:: dwave_networkx.algorithms.max_cut
.. automodule:: dwave.plugins.networkx.algorithms.max_cut
.. autosummary::
:toctree: generated/

Expand Down
6 changes: 3 additions & 3 deletions docs/reference/algorithms/packing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ of its member pairs.
(vertical tile) are independent sets of the graph, with no blue node adjacent
to another blue node and likewise for red nodes.

.. automodule:: dwave_networkx.algorithms.independent_set
.. automodule:: dwave.plugins.networkx.algorithms.independent_set

.. currentmodule:: dwave_networkx
.. currentmodule:: dwave.plugins.networkx

.. autosummary::
:toctree: generated/
Expand All @@ -30,7 +30,7 @@ of its member pairs.
Helper Functions
----------------

.. currentmodule:: dwave_networkx.algorithms.independent_set
.. currentmodule:: dwave.plugins.networkx.algorithms.independent_set

.. autosummary::
:toctree: generated/
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/algorithms/social.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ friendly/hostile interactions between vertices.
be cleanly divided into two subsets, {Bob, Eve} and {Alice}, with friendly
relations within each subset and only hostile relations between the subsets.

.. automodule:: dwave_networkx.algorithms.social
.. automodule:: dwave.plugins.networkx.algorithms.social
.. autosummary::
:toctree: generated/

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/algorithms/tsp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ graph.

A traveling salesperson route of [2, 1, 0, 3].

.. automodule:: dwave_networkx.algorithms.tsp
.. automodule:: dwave.plugins.networkx.algorithms.tsp
.. autosummary::
:toctree: generated/

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/default_sampler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Default sampler
***************

.. currentmodule:: dwave_networkx.default_sampler
.. currentmodule:: dwave.plugins.networkx.default_sampler

.. automodule:: dwave_networkx.default_sampler
.. automodule:: dwave.plugins.networkx.default_sampler

Functions
---------
Expand Down
10 changes: 5 additions & 5 deletions docs/reference/drawing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ Drawing

Tools to visualize topologies of D-Wave QPUs and weighted graph problems on them.

.. currentmodule:: dwave_networkx
.. currentmodule:: dwave.plugins.networkx

.. note:: Some functionality requires `NumPy <http://scipy.org>`_ and/or
`Matplotlib <https://matplotlib.org>`_\ .

Chimera Graph Functions
-----------------------

.. automodule:: dwave_networkx.drawing.chimera_layout
.. automodule:: dwave.plugins.networkx.drawing.chimera_layout

.. autosummary::
:toctree: generated/
Expand All @@ -32,7 +32,7 @@ positions on a Chimera unit cell.
.. code-block:: python

>>> import networkx as nx
>>> import dwave_networkx as dnx
>>> import dwave.plugins.networkx as dnx
>>> import matplotlib.pyplot as plt
>>> H = nx.Graph()
>>> H.add_nodes_from([0, 4, 5, 6, 7])
Expand Down Expand Up @@ -63,7 +63,7 @@ positions on a Chimera unit cell.
Pegasus Graph Functions
-----------------------

.. automodule:: dwave_networkx.drawing.pegasus_layout
.. automodule:: dwave.plugins.networkx.drawing.pegasus_layout

.. autosummary::
:toctree: generated/
Expand All @@ -81,7 +81,7 @@ of nodes of a simple 5-node graph on a small Pegasus lattice.

.. code-block:: python

>>> import dwave_networkx as dnx
>>> import dwave.plugins.networkx as dnx
>>> import matplotlib.pyplot as plt
>>> G = dnx.pegasus_graph(2)
>>> H = dnx.pegasus_graph(2, node_list=[4, 40, 41, 42, 43],
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/generators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Graph Generators

Generators for graphs, such the graphs (topologies) of D-Wave System QPUs.

.. currentmodule:: dwave_networkx
.. currentmodule:: dwave.plugins.networkx

D-Wave Systems
--------------
Expand All @@ -26,7 +26,7 @@ the `find_chimera()` function to determine the Chimera indices.
.. code-block:: python

>>> import networkx as nx
>>> import dwave_networkx as dnx
>>> import dwave.plugins.networkx as dnx
>>> G = dnx.chimera_graph(1, 1, 4)
>>> chimera_indices = dnx.find_chimera_indices(G)
>>> print chimera_indices
Expand Down
10 changes: 5 additions & 5 deletions docs/reference/utilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
Utilities
*********

.. automodule:: dwave_networkx.utils
.. currentmodule:: dwave_networkx.utils
.. automodule:: dwave.plugins.networkx.utils
.. currentmodule:: dwave.plugins.networkx.utils

Decorators
----------
.. automodule:: dwave_networkx.utils.decorators
.. automodule:: dwave.plugins.networkx.utils.decorators
.. autosummary::
:toctree: generated/

binary_quadratic_model_sampler

.. currentmodule:: dwave_networkx
.. currentmodule:: dwave.plugins.networkx

.. toctree::
:hidden:
Expand Down Expand Up @@ -53,7 +53,7 @@ Pegasus

Exceptions
----------
.. automodule:: dwave_networkx.exceptions
.. automodule:: dwave.plugins.networkx.exceptions
.. autosummary::
:toctree: generated/

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/utilities/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Coordinates Conversion
**********************

.. automodule:: dwave_networkx
.. automodule:: dwave.plugins.networkx

.. autoclass:: chimera_coordinates

Expand Down
16 changes: 16 additions & 0 deletions dwave/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2020 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
16 changes: 16 additions & 0 deletions dwave/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2020 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
37 changes: 37 additions & 0 deletions dwave/plugins/networkx/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2018 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import dwave.plugins.networkx.generators
from dwave.plugins.networkx.generators import *

import dwave.plugins.networkx.algorithms
from dwave.plugins.networkx.algorithms import *

import dwave.plugins.networkx.utils

import dwave.plugins.networkx.exceptions
from dwave.plugins.networkx.exceptions import *

import dwave.plugins.networkx.default_sampler
from dwave.plugins.networkx.default_sampler import *

import dwave.plugins.networkx.drawing
from dwave.plugins.networkx.drawing import *

from dwave.plugins.networkx.package_info import (
__version__,
__author__,
__authoremail__,
__description__,
)
25 changes: 25 additions & 0 deletions dwave/plugins/networkx/algorithms/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2018 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from dwave.plugins.networkx.algorithms.independent_set import *
from dwave.plugins.networkx.algorithms.canonicalization import *
from dwave.plugins.networkx.algorithms.clique import *
from dwave.plugins.networkx.algorithms.cover import *
from dwave.plugins.networkx.algorithms.matching import *
from dwave.plugins.networkx.algorithms.social import *
from dwave.plugins.networkx.algorithms.elimination_ordering import *
from dwave.plugins.networkx.algorithms.coloring import *
from dwave.plugins.networkx.algorithms.max_cut import *
from dwave.plugins.networkx.algorithms.markov import *
from dwave.plugins.networkx.algorithms.tsp import *
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import math

from dwave_networkx.generators.chimera import chimera_coordinates
from dwave.plugins.networkx.generators.chimera import chimera_coordinates

__all__ = ['canonical_chimera_labeling']

Expand Down
Loading