dwavesystems / dwavesystems/dwave-graphs
Issue with chimera_layout mistaking single tile for multiple tiles.
- Dominant language
- Python
- Stars
- 95
- Forks
- 62
- Avg merge
- 7d 18h
- Merged PRs (30d)
- 1
Description
**Description**
The chimera_layout function uses the networkx function diameter, which can be > 2 for some configurations of our chimera graphs.
**To Reproduce**
The example on the demo page is working:
https://docs.ocean.dwavesys.com/projects/dwave-networkx/en/latest/reference/drawing.html
However the following modification will cause an error in which the code mistakes the connected graph for being from two connected tiles:
`import networkx as nx
import dwave_networkx as dnx
import matplotlib.pyplot as plt
H = nx.Graph()
H.add_nodes_from([0, 1, 4, 5, 6, 7])
H.add_edges_from([(0, 4), (0, 5), (0, 6), (0, 7)])
H.add_edges_from([(1, 4)])
pos = dnx.chimera_layout(H)
G = dnx.chimera_graph(1,1,4)
ind = dnx.find_chimera_indices(G)
dnx.draw_chimera(G)
dnx.draw_chimera(H, node_color='b', node_shape='*', style='dashed', edge_color='b', width=3)
dnx.chimera_layout(H, scale=1., center=None, dim=2)
plt.show()`
There are a few similar issues, so it might be a good idea to check a few different cases.
This one draws as if 2 is 1.
`H.add_nodes_from([0, 2, 4, 5, 6, 7])
H.add_edges_from([(0, 4), (0, 5), (0, 6), (0, 7)])
H.add_edges_from([(2, 4), (2, 5), (2, 6), (2, 7)])`
**Expected behavior**
Partial chimera graphs should draw correctly.
The first example should draw an extra dashed line from node 1 to node 4.
The second example should produce a chimera graph tile with the 0 node and the 2 node fully connected.
**Environment:**
- OS: Windows 10 Pro
- Python version: 3.7.1
**Additional context**
This issue showed up from a user trying to run the example in drawing chimera graph functions:
https://github.com/dwavesystems/dwave_networkx/issues/90
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.