TeamGraphix / graphix

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

Resource state visualization #78

Closed d1ssk closed 9 months ago

d1ssk commented 10 months ago

Before submitting, please check the following:

Then, please fill in below:

Context (if applicable):

Description of the change: Implement a GraphVisualizer class within visualization.py and add a view_graph() method to the Pattern class, which invokes methods from the GraphVisualizer class.

Related issue:

47

also see that checks (github actions) pass. If lint check keeps failing, try installing black==22.8.0 as behavior seems to vary across versions.

d1ssk commented 10 months ago

Thank you for the quick review! I was just wondering how to set the position of nodes in the case of gflow and your suggestion looks great! I will use nx.multipartite_layout() for visualization of both flow and gflow.

pafloxy commented 10 months ago

Sure! I'll be happy to discuss if you want.

However in my experience, time to time the nx.multipartite_layout does behave weirdly in placing the graph nodes which I think we will need to take care of it somehow in the post-processing.

For eg, see image the nodes 7, 28, 21 are unnecessarily pushed out of line.

The figure is from a code I wrote for the visualisations but ofcourse it isn't even closely sophisticated compared to your implementation :sweat_smile:
d1ssk commented 10 months ago

Thank you for the valuable information! I would like to reproduce this example to consider a countermeasure, could you give me the code that generates this pattern?

pafloxy commented 10 months ago

Sure, you will find a fucntion called pretty_plot_pattern() defined in this notebook It has the required implementation. Though it isn't really a good peice of programming.