-
Notifications
You must be signed in to change notification settings - Fork 56
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
Layout overhaul #214
base: main
Are you sure you want to change the base?
Layout overhaul #214
Conversation
A giant run of sample images: import dwave_networkx as dnx
import networkx as nx
from minorminer import find_embedding
import random
import gc
from matplotlib import pyplot as plt
import os
from itertools import chain
os.system("rm yield*.png")
for dpi in (100,):
for i,(m, t) in enumerate([(2, 1), (2, 4), (2,8), (4,4), (4,8), (8,6), (6,8), (15,4), (15,8), (2, 2), (2, 1), (4, 1), (8, 1)]):
z = dnx.zephyr_graph(m,t,coordinates=True)
z.remove_nodes_from(random.sample([*z], len(z)//10))
z.remove_edges_from(random.sample([*z.edges], len(z.edges)//10))
emb = {}
hits = set()
for _ in range(10):
emb_ = find_embedding(nx.complete_graph(8), z.subgraph(z.nodes - hits), tries=1, max_no_improvement=1, chainlength_patience=0)
for c in emb_.values():
hits.update(c)
emb[len(emb)] = c
if not emb_: break
fig, ax = plt.subplots(2, 2, figsize=(20,20), dpi=dpi)
dnx.draw_zephyr(z, node_color = range(len(z)), ax=ax[0][0])
dnx.draw_zephyr(z, node_color = range(len(z)), edge_color=range(len(z.edges)), ax=ax[0][1], line_plot=True)
dnx.draw_zephyr_embedding(z, emb, ax=ax[1][0], line_plot=True)
dnx.draw_zephyr_yield(z, fault_shape='o', ax=ax[1][1], line_plot=True)
fig.tight_layout()
plt.savefig(f'yield{i}z{dpi}.png', bbox_inches='tight')
plt.close()
gc.collect()
for i,(m,crosses) in enumerate([(2,0), (2, 1), (4,0), (6,1), (8,0), (16,1)]):
z = dnx.pegasus_graph(m,coordinates=True)
z.remove_nodes_from(random.sample([*z], len(z)//10))
z.remove_edges_from(random.sample([*z.edges], len(z.edges)//10))
emb = {}
hits = set()
for _ in range(10):
emb_ = find_embedding(nx.complete_graph(8), z.subgraph(z.nodes - hits), tries=1, max_no_improvement=1, chainlength_patience=0)
for c in emb_.values():
hits.update(c)
emb[len(emb)] = c
if not emb_: break
fig, ax = plt.subplots(2, 2, figsize=(20,20), dpi=dpi)
dnx.draw_pegasus(z, ax=ax[0][0], crosses=crosses)
dnx.draw_pegasus(z, ax=ax[0][1], crosses=not crosses, line_plot=True)
dnx.draw_pegasus_embedding(z, emb, ax=ax[1][0], crosses=crosses, line_plot=True)
dnx.draw_pegasus_yield(z, fault_shape='o', ax=ax[1][1], crosses=crosses)
fig.tight_layout()
plt.savefig(f'yield{i}p{dpi}.png', bbox_inches='tight')
plt.close()
gc.collect()
for i,(m, n, t) in enumerate([(2, 2, 2), (2,2,4), (2,2,8), (4,4,8), (4,4,4), (8,4,8), (8,8,4), (16,16,4), (16, 16,8)]):
z = dnx.chimera_graph(m,n,t,coordinates=True)
z.remove_nodes_from(random.sample([*z], len(z)//10))
z.remove_edges_from(random.sample([*z.edges], len(z.edges)//10))
emb = {}
hits = set()
for _ in range(1):
emb_ = find_embedding(nx.complete_graph(8), z.subgraph(z.nodes - hits), tries=1, max_no_improvement=1, chainlength_patience=0)
for c in emb_.values():
hits.update(c)
emb[len(emb)] = c
if not emb_: break
fig, ax = plt.subplots(2, 2, figsize=(20*n/m,20), dpi=dpi)
dnx.draw_chimera(z, ax=ax[0][0])
dnx.draw_chimera(z, ax=ax[0][1], line_plot=True)
dnx.draw_chimera_embedding(z, emb, ax=ax[1][0], line_plot=False)
dnx.draw_chimera_yield(z, fault_shape='o', ax=ax[1][1], line_plot=False)
fig.tight_layout()
plt.savefig(f'yield{i}c{dpi}.png', bbox_inches='tight')
plt.close()
gc.collect() |
9288684
to
96f586a
Compare
070454a
to
f110c95
Compare
Codecov Report
@@ Coverage Diff @@
## main #214 +/- ##
==========================================
- Coverage 74.42% 69.20% -5.22%
==========================================
Files 29 29
Lines 2045 2205 +160
==========================================
+ Hits 1522 1526 +4
- Misses 523 679 +156
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments from a first scan: if I have time, I'd like to try using the new functionality a bit and then returning to this.
Lovely addition!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will you be adding the https://github.com/dwavesystems/dwave-networkx/blob/main/dwave_networkx/drawing/qubit_layout.py functions to RST files (see comment below on __all__ = ['draw_qubit_graph']
)? If so, I'll render those docstrings and see how they look too.
@@ -51,6 +51,13 @@ def chimera_layout(G, scale=1., center=None, dim=2): | |||
Number of dimensions. When dim > 2, all extra dimensions are | |||
set to 0. | |||
|
|||
plot_kwargs : None or dict (default None) | |||
A dict of keyword arguments to be used in a plotting function (see | |||
:func:`networkx.draw` and :func:`draw_lineplot`), to scale node and edge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A dict of keyword arguments to be used in a plotting function (see | ||
:func:`networkx.draw` and :func:`draw_lineplot`), to scale node and edge | ||
sizes appropriately to the graph `G`. Optional keys in ``plot_kwargs`` | ||
are set to default values by the :func:`normalize_size_and_aspect` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
":func:normalize_size_and_aspect
" --> two issues:
- Needs to be something like :func:
~dwave_networkx.drawing.qubit_layout.normalize_size_and_aspect
- You can only link to this function once you add it to an RST file so it's rendered to the docs.
@@ -131,6 +138,13 @@ def chimera_node_placer_2d(m, n, t, scale=1., center=None, dim=2): | |||
Number of dimensions. When dim > 2, all extra dimensions are | |||
set to 0. | |||
|
|||
plot_kwargs : None or dict (default None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comments as in def chimera_layout() above
where two qubits overlap. In this drawing style, the interpretation of | ||
the ``width`` and ``node_size`` parameters (provided in ``kwargs``) | ||
determine the area of the circles and line widths respectively. See | ||
:func:`dwave_networkx.qubit_layout.draw_lineplot` for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefixing with a tilde (~) will be shorter, it might need a .drawing.
before the func name, and it needs to be rendered in the docs first.
Also appears in funcs below.
@@ -58,6 +58,13 @@ def pegasus_layout(G, scale=1., center=None, dim=2, crosses=False): | |||
rather than L configuration. Ignored if G is defined with | |||
``nice_coordinates=True``. | |||
|
|||
plot_kwargs : None or dict (default None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comments as in def chimera_layout() above
@@ -120,6 +129,13 @@ def pegasus_node_placer_2d(G, scale=1., center=None, dim=2, crosses=False): | |||
If True, :math:`K_{4,4}` subgraphs are shown in a cross | |||
rather than L configuration. | |||
|
|||
plot_kwargs : None or dict (default None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comments as in def chimera_layout() above
@@ -23,13 +23,16 @@ | |||
from networkx import draw | |||
|
|||
from dwave_networkx.drawing.distinguishable_colors import distinguishable_color_map | |||
from itertools import repeat, chain | |||
|
|||
from numbers import Number | |||
|
|||
__all__ = ['draw_qubit_graph'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about funcs draw_embedding
, draw_yield
, normalize_size_and_aspect
, draw_lineplot
? Shouldn't these be added? And added to the appropriate RST file?
@@ -52,6 +52,13 @@ def zephyr_layout(G, scale=1., center=None, dim=2): | |||
Number of dimensions. When dim > 2, all extra dimensions are | |||
set to 0. | |||
|
|||
plot_kwargs : None or dict (default None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above comments on func pathnames
25b0adc
to
553581c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still have two functions remaining that I'll do right after this but I'm submitting these proposed updates now because (1) I want to submit a separate comment on what looks like a bug and (2) I have a lot of work that would be lost if this review hits a snag
|
||
Generic Plotting Functions | ||
-------------------------- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. Caution:: | |
The following semi-public methods are intended to be used by public | |
functions such as :func:`.draw_chimera()`, not directly by the user. | |
We do something similar for such functions in dimod here
"""Draws the graph G with line segments representing nodes. | ||
|
||
This function is meant to be a drop-in replacement for :func:`networkx.drawing.nx_pylab.draw` | ||
where nodes are associated with line segments (specified as 2x2 matrices | ||
[[x0, y0], [x1, y1]]). This function makes significant assumptions about | ||
the edges of the graph G, that hold when G is a Chimera, Pegasus, or Zephyr | ||
graph and the line segments are provided by :func:`chimera_layout`, | ||
:func:`pegasus_layout` and :func:`zephyr_layout` respectively. These graphs | ||
have three classes of edges: | ||
|
||
* internal edges between qubits whose line segments are perpendicular | ||
and intersect at a point, drawn as a circle located at the point of | ||
intersection, | ||
* external edges between qubits whose line segments are colinear, drawn | ||
as a line segment between the nearest endpoints, and | ||
* odd edges between parallel qubits whose line segments are parallel and | ||
overlap in a perpendicular projection, drawn as a line segment between | ||
the midpoints of the respective perpendicular projections. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Draws the graph G with line segments representing nodes. | |
This function is meant to be a drop-in replacement for :func:`networkx.drawing.nx_pylab.draw` | |
where nodes are associated with line segments (specified as 2x2 matrices | |
[[x0, y0], [x1, y1]]). This function makes significant assumptions about | |
the edges of the graph G, that hold when G is a Chimera, Pegasus, or Zephyr | |
graph and the line segments are provided by :func:`chimera_layout`, | |
:func:`pegasus_layout` and :func:`zephyr_layout` respectively. These graphs | |
have three classes of edges: | |
* internal edges between qubits whose line segments are perpendicular | |
and intersect at a point, drawn as a circle located at the point of | |
intersection, | |
* external edges between qubits whose line segments are colinear, drawn | |
as a line segment between the nearest endpoints, and | |
* odd edges between parallel qubits whose line segments are parallel and | |
overlap in a perpendicular projection, drawn as a line segment between | |
the midpoints of the respective perpendicular projections. | |
"""Draws the given graph with line segments representing nodes. | |
This function is meant to be a drop-in replacement for the NetworkX | |
:func:`~networkx.drawing.nx_pylab.draw` function, where nodes are associated | |
with line segments specified as 2x2 matrices ``[[x0, y0], [x1, y1]]``. | |
The function makes significant assumptions about the edges of graph ``G``, | |
which hold when ``G`` is a Chimera, Pegasus, or Zephyr graph and the line | |
segments are generated by :func:`.chimera_layout`, :func:`.pegasus_layout` | |
and :func:`.zephyr_layout` functions respectively. These graphs have three | |
classes of edges: | |
* Internal edges between qubits whose line segments are perpendicular | |
and intersect at a point, drawn as a circle located at the point of | |
intersection. | |
* External edges between qubits whose line segments are colinear, drawn | |
as a line segment between the nearest endpoints. | |
* Odd edges between parallel qubits whose line segments are parallel and | |
overlap in a perpendicular projection, drawn as a line segment between | |
the midpoints of the respective perpendicular projections. |
Fixes the formatting problem with the bullets, separates the intro content into sections and formats the non-simple text
A graph constructed by :func:`chimera_layout`, :func:`pegasus_layout`, | ||
or :func:`zephyr_layout`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A graph constructed by :func:`chimera_layout`, :func:`pegasus_layout`, | |
or :func:`zephyr_layout`. | |
A graph constructed by :func:`.chimera_layout`, :func:`.pegasus_layout`, | |
or :func:.`zephyr_layout`. |
unused_node_color = [unused_color for v in nodelist] | ||
unused_edge_color = [unused_color for v in edgelist] | ||
layout : dict | ||
A dictionary with nodes as keys and 2x2 matrices [[x0, y0], [x1, y1]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A dictionary with nodes as keys and 2x2 matrices [[x0, y0], [x1, y1]] | |
A dictionary with nodes as keys and 2x2 matrices ``[[x0, y0], [x1, y1]]`` |
representing the line segments of nodes. | ||
|
||
ax : matplotlib.Axis | ||
The matplotlib Axis object to draw the graph on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The matplotlib Axis object to draw the graph on. | |
The `Matplotlib <https://matplotlib.org/>`_ Axis object to draw the graph on. |
A magic number used to scale node circles -- ignored and replaced with | ||
the number 50 when `kwargs["line_plot"]` is True. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A magic number used to scale node circles -- ignored and replaced with | |
the number 50 when `kwargs["line_plot"]` is True. | |
A magic number used to scale node circles; ignored and replaced with | |
the number 50 when ``kwargs["line_plot"]`` is ``True``. |
@@ -442,22 +487,35 @@ def draw_yield(G, layout, perfect_graph, unused_color=(0.9,0.9,0.9,1.0), | |||
perfect_graph : NetworkX graph |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameters G
and perfect_graph
need end-of-sentence periods.
Parameter layoutshould be updated to, "...
perfect_graph. Should be of the form
{node: coordinate, ...}``. Coordinates are ..."
A color to represent nodes absent from the graph G, and edges absent | ||
from the graph G which are not incident to faulty nodes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A color to represent nodes absent from the graph G, and edges absent | |
from the graph G which are not incident to faulty nodes. | |
A color to represent nodes absent from the graph ``G``, and edges absent | |
from the graph ``G`` which are not incident to faulty nodes. |
If line_plot is True, then qubits are drawn as line segments, and edges | ||
are drawn either as line segments between qubits, or as circles where | ||
two qubits overlap. In this drawing style, the interpretation the width | ||
and node_size parameters (provided in kwargs) determines the area of the | ||
circles, and line widths, respectively. Qubit line segments are given | ||
twice the width of edges. Layout should be a dict of the form | ||
{node: ((x0, y0), (y0, x0)), ...} -- instead of coordinates, the nodes | ||
are associated with endpoints of n-dimensional line segments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If line_plot is True, then qubits are drawn as line segments, and edges | |
are drawn either as line segments between qubits, or as circles where | |
two qubits overlap. In this drawing style, the interpretation the width | |
and node_size parameters (provided in kwargs) determines the area of the | |
circles, and line widths, respectively. Qubit line segments are given | |
twice the width of edges. Layout should be a dict of the form | |
{node: ((x0, y0), (y0, x0)), ...} -- instead of coordinates, the nodes | |
are associated with endpoints of n-dimensional line segments. | |
If ``line_plot`` is ``True``, qubits are drawn as line segments and edges | |
are drawn as either line segments between qubits or circles where | |
two qubits overlap. In this drawing style, the interpretation the ``width`` | |
and ``node_size`` parameters (provided in ``kwargs``) determines the area of the | |
circles, and line widths, respectively. Qubit line segments are given | |
twice the width of edges. Layout should be a dict of the form | |
``{node: ((x0, y0), (y0, x0)), ...}``; instead of coordinates, the nodes | |
are associated with endpoints of n-dimensional line segments. |
twice the width of edges. Layout should be a dict of the form | ||
{node: ((x0, y0), (y0, x0)), ...} -- instead of coordinates, the nodes | ||
are associated with endpoints of n-dimensional line segments. | ||
|
||
kwargs : optional keywords | ||
See networkx.draw_networkx() for a description of optional keywords, | ||
with the exception of the `pos` parameter which is not used by this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the exception of the `pos` parameter which is not used by this | |
with the exception of the ``pos`` parameter which is not used by this | |
function. If ``linear_biases`` or ``quadratic_biases`` are provided, | |
any provided ``node_color`` or ``edge_color`` arguments are ignored. | |
Examples | |
-------- | |
This example illustrates how functions such as :func:`.draw_pegasus` can make use of this internal function. | |
.. code-block:: python | |
import dwave_networkx as dnx | |
import matplotlib.pyplot as plt | |
from dwave_networkx.drawing.qubit_layout import draw_yield | |
G = dnx.chimera_graph(1) | |
layout = dnx.chimera_layout(G) | |
draw_yield(G.subgraph([0, 4, 5, 6, 7]), layout, G, unused_color="green", fault_color="red") | |
""" |
This one will need a minor edit for indent spaces and cleaning up the three lines below after being committed.
@@ -424,9 +469,9 @@ def unoverlapped_embedding(G, emb, interaction_edges): | |||
|
|||
|
|||
def draw_yield(G, layout, perfect_graph, unused_color=(0.9,0.9,0.9,1.0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@boothby, I'm seeing something weird with this function though it might be because I'm using it directly rather than through the public functions as intended, where it might not affect anything. The following code snippet,
import dwave_networkx as dnx
import matplotlib.pyplot as plt
from dwave_networkx.drawing.qubit_layout import draw_yield
G = dnx.chimera_graph(1)
layout = dnx.chimera_layout(G)
draw_yield(G.subgraph([0, 4, 5, 6, 7]), layout, G, unused_color="green", fault_color="red")
generates the nodes with/without faults correctly but the edges are offset from the nodes:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not reproducing that on my end (matplotlib 3.4.1, networkx 2.4). Can you try the public interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I finally managed to reproduce it through the public interface:
- It does not happen for matplotlib 3.4.1, networkx 2.4; it happens if you upgrade to matplotlib 3.6.3 (dwave-netwokx doesn't set a version requirement for Matplotlib so users might have more recent versions)
- We need to add
draw_chimera_yield
anddraw_pegasus_yield
to the docs, currently there's onlydraw_zephyr_yield
import dwave_networkx as dnx
import matplotlib.pyplot as plt
G = dnx.chimera_graph(1)
fig, ax = plt.subplots(figsize=(10, 5))
dnx.draw_chimera_yield(G.subgraph([0, 4, 5, 6, 7]), unused_color="green", fault_color="red", ax=ax)
plt.show()
Shows up once you zoom in as:
@boothby, what about updating the requirement on networkx to a minimum of version 2.8.6 to apply this fix there too? I'm hitting it on the NetworkX
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, these are great functionality additions.
There are still a few small changes (mostly formatting and an example) I'd like but because they're not on code lines directly updated in this PR it's messy to propose them here---I can submit a followup PR to you once this is merged.
twice the width of edges. Layout should be a dict of the form | ||
{node: ((x0, y0), (y0, x0)), ...} -- instead of coordinates, the nodes | ||
are associated with endpoints of n-dimensional line segments. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kwargs : optional keywords | |
See :func:`networkx.draw_networkx` for a description of optional keywords, | |
with the exception of the ``pos`` parameter which is not used by this | |
function. If ``linear_biases`` or ``quadratic_biases`` are provided, | |
any provided ``node_color`` or ``edge_color`` arguments are ignored. | |
Examples | |
-------- | |
This example illustrates how functions such as :func:`.draw_pegasus` can make use of this internal function. | |
.. code-block:: python | |
import dwave_networkx as dnx | |
import matplotlib.pyplot as plt | |
from dwave_networkx.drawing.qubit_layout import draw_embedding | |
G = dnx.chimera_graph(1) | |
layout = dnx.chimera_layout(G) | |
draw_embedding(G, layout, {0:[0, 4, 5], 1: [1, 6], 2: [2, 6], 3: [3, 7]}) | |
""" |
This one will need the deletion of lines 272-277 after committing.
line_plot : boolean (optional, default False) | ||
If line_plot is True, then qubits are drawn as line segments, and edges | ||
are drawn either as line segments between qubits, or as circles where | ||
two qubits overlap. In this drawing style, the interpretation the width | ||
and node_size parameters (provided in kwargs) determines the area of the | ||
circles, and line widths, respectively. Qubit line segments are given | ||
twice the width of edges. Layout should be a dict of the form | ||
{node: ((x0, y0), (y0, x0)), ...} -- instead of coordinates, the nodes | ||
are associated with endpoints of n-dimensional line segments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line_plot : boolean (optional, default False) | |
If line_plot is True, then qubits are drawn as line segments, and edges | |
are drawn either as line segments between qubits, or as circles where | |
two qubits overlap. In this drawing style, the interpretation the width | |
and node_size parameters (provided in kwargs) determines the area of the | |
circles, and line widths, respectively. Qubit line segments are given | |
twice the width of edges. Layout should be a dict of the form | |
{node: ((x0, y0), (y0, x0)), ...} -- instead of coordinates, the nodes | |
are associated with endpoints of n-dimensional line segments. | |
line_plot : boolean (optional, default False) | |
If ``line_plot`` is ``True``, qubits are drawn as line segments and edges | |
are drawn as either line segments between qubits or circles where | |
two qubits overlap. In this drawing style, the interpretation of the ``width`` | |
and ``node_size`` parameters (provided in ``kwargs``) determines the area of the | |
circles, and line widths, respectively. Qubit line segments are given | |
twice the width of edges. Layout should be a dict of the form | |
``{node: ((x0, y0), (y0, x0)), ...}``; instead of coordinates, the nodes | |
are associated with endpoints of n-dimensional line segments. |
If line_plot is True, then qubits are drawn as line segments, and edges | ||
are drawn either as line segments between qubits, or as circles where | ||
two qubits overlap. In this drawing style, the interpretation the width | ||
and node_size parameters (provided in kwargs) determines the area of the | ||
circles, and line widths, respectively. Qubit line segments are given | ||
twice the width of edges. Layout should be a dict of the form | ||
{node: ((x0, y0), (y0, x0)), ...} -- instead of coordinates, the nodes | ||
are associated with endpoints of n-dimensional line segments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If line_plot is True, then qubits are drawn as line segments, and edges | |
are drawn either as line segments between qubits, or as circles where | |
two qubits overlap. In this drawing style, the interpretation the width | |
and node_size parameters (provided in kwargs) determines the area of the | |
circles, and line widths, respectively. Qubit line segments are given | |
twice the width of edges. Layout should be a dict of the form | |
{node: ((x0, y0), (y0, x0)), ...} -- instead of coordinates, the nodes | |
are associated with endpoints of n-dimensional line segments. | |
If ``line_plot`` is ``True``, qubits are drawn as line segments and edges | |
are drawn as either line segments between qubits or circles where | |
two qubits overlap. In this drawing style, the interpretation of the ``width`` | |
and ``node_size`` parameters (provided in ``kwargs``) determines the area of the | |
circles, and line widths, respectively. Qubit line segments are given | |
twice the width of edges. Layout should be a dict of the form | |
``{node: ((x0, y0), (y0, x0)), ...}``; instead of coordinates, the nodes | |
are associated with endpoints of n-dimensional line segments. |
Normalizes node sizes across the board
Makes yield plots easier to read
Adds qubit-line plots
needs a little more documentation