PsiQ / qref

Quantum Resource Estimate Format
https://psiq.github.io/qref/
Apache License 2.0
34 stars 3 forks source link

Add example with visualization #14

Closed mstechly closed 4 months ago

mstechly commented 6 months ago

We should have an example how to use rendering module somewhere in our docs. I'm thinking about a bit more polished version of the following:

import yaml
from qref import SchemaV1
from qref.experimental.rendering import to_graphviz

with open("alias_sampling_detailed_fixed_resources.yaml", "r") as f:
    data = yaml.safe_load(f)
program = SchemaV1.model_validate(data)
gv_object = to_graphviz(program)
gv_object.render("as.png")

CC: @dexter2206