dwave-networkx icon indicating copy to clipboard operation
dwave-networkx copied to clipboard

Zephyr layout coords fix

Open mahdiehmalekian opened this issue 1 year ago • 1 comments

A bug in zephyr_layout in the file dwave-networkx/drawing/zephyr_layout.py is fixed so that if scale = scale, all positions fit within [0, scale] on the x-axis and [-scale, 0] on the y-axis.

A couple of tests are added to tests/test_zephyr_layout.py that would fail before fixing the bug. These test the range of x value and y-value produced by zephyr_layout for the default scale=1 and scale=10.

Similarly, for pegasus_layout and test_pegasus_layout.py

mahdiehmalekian avatar May 22 '24 21:05 mahdiehmalekian

Codecov Report

Attention: Patch coverage is 6.45161% with 29 lines in your changes missing coverage. Please review.

Project coverage is 75.05%. Comparing base (deb095f) to head (e0ccc6f). Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
dwave_networkx/drawing/pegasus_layout.py 6.25% 15 Missing :warning:
dwave_networkx/drawing/zephyr_layout.py 6.66% 14 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #236      +/-   ##
==========================================
- Coverage   75.96%   75.05%   -0.91%     
==========================================
  Files          31       31              
  Lines        2184     2213      +29     
==========================================
+ Hits         1659     1661       +2     
- Misses        525      552      +27     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features:

codecov[bot] avatar May 22 '24 21:05 codecov[bot]

@randomir - can you assign myself and @AndyZzzZzzZzz as reviewers?

jackraymond avatar Oct 21 '24 22:10 jackraymond

@randomir Is this ready to be merged?

mahdiehmalekian avatar Nov 16 '24 02:11 mahdiehmalekian

You're correct that the plots don't look different before and after this PR. However the document says scale=1 gives values in [0,1], and this is a feature that was relied on in the layout algorithm (in dnx_layout in layout.py) and the bug in this code caused the layout algorithm to give poor results.

mahdiehmalekian avatar Nov 17 '24 19:11 mahdiehmalekian

@randomir Could you advise on numpy import?

mahdiehmalekian avatar Nov 18 '24 00:11 mahdiehmalekian