tqec.sketchup.block_graph.BlockGraph
- class BlockGraph(name: str)[source]
- __init__(name: str) None [source]
An undirected graph representation of a 3D spacetime defect diagram with the block structures explicitly defined.
Methods
__init__
(name)An undirected graph representation of a 3D spacetime defect diagram with the block structures explicitly defined.
add_cube
(position, cube_type)Add a cube to the graph.
add_pipe
(u, v, pipe_type)Add a pipe to the graph.
check_validity
([allow_virtual_node])Check the validity of the block structures represented by the graph.
display
([write_html_filepath, pipe_length])Display the block graph in 3D.
from_dae_file
(filename[, graph_name])Construct a block graph from a DAE file.
from_zx_graph
(zx_graph[, name])Construct a block graph from a ZX graph.
get_abstract_observables
()Get all the abstract observables from the block graph.
get_cube
(position)Get the cube by position.
get_pipe
(u, v)Get the pipe by its endpoint cube positions.
pipes_at
(position)Get the pipes connected to a cube.
to_dae_file
(filename[, pipe_length])Export the block graph to a DAE file.
to_zx_graph
([name])Convert the block graph to a ZX graph.
with_zero_min_z
()Shift the whole graph in the z direction to make the minimum z zero.
Attributes
cubes
Return a list of cubes in the graph.
name
The name of the graph.
num_cubes
The number of cubes in the graph.
num_open_ports
The number of open ports in the graph.
num_pipes
The number of pipes in the graph.
pipes
Return a list of pipes in the graph.