TeamGraphix / graphix

measurement-based quantum computing (MBQC) compiler and simulator
https://graphix.readthedocs.io
Apache License 2.0
55 stars 20 forks source link

[Bug]: visualizing with gflow #97

Closed shinich1 closed 6 months ago

shinich1 commented 7 months ago

Describe the bug singular matrix error occurs with visualisation tool when drawing graph with gflow.

To Reproduce https://github.com/TeamGraphix/graphix/blob/9661708be39903b7431dc49daff0270afd0f865a/examples/qnn.py (note - I have done temporary docs fix by adding manual visualisation in the latest commit on master)

Expected behavior

Environment (please complete the following information):

Additional context

masa10-f commented 7 months ago

Supplementary information

graph structure output

and

gflow = {23: {23}, 25: {25}, 28: {27, 28}, 33: {33}, 22: {27}, 31: {27, 31}, 21: {28}, 30: {35}, 20: {20, 21}, 29: {30}, 5: {5}, 7: {7}, 13: {13}, 15: {15}, 4: {20, 28}, 12: {28}, 3: {4}, 11: {12}}.

The error occurred in visualization.py l.211

nx.draw_networkx_edges(self.G, pos, edgelist=[edge], edge_color="black", arrowstyle="->", arrows=True)
shinich1 commented 7 months ago

cc: @d1ssk

d1ssk commented 7 months ago

I found that the issue is in the get_figsize() function, which returns a height of zero when the input_nodes attribute of the pattern is None. The plot below illustrates the resource state of the qnn after Pauli measurements, incorporating a quick bug fix. I plan to commit changes after addressing the following issues:

スクリーンショット 2023-11-14 8 22 59
shinich1 commented 7 months ago

perhaps off topic for this issue, but another thing to consider: add two more node edge colors to express measurement planes?