loom.visualizer.circuit_visualizer
Copyright (c) Entropica Labs Pte Ltd 2025.
Use, distribution and reproduction of this program in its source or compiled form is prohibited without the express written consent of Entropica Labs Pte Ltd.
- loom.visualizer.circuit_visualizer.hierarchy_layout(graph, root=None, x_spacing=1.0, y_spacing=1.5)[source]
Pure-Python replacement for graphviz_layout (hierarchical layout).
- Parameters:
graph (nx.DiGraph) – Directed acyclic graph to layout.
root (node or None) – Optional root node. If None, the first node with in-degree 0 is used.
x_spacing (float) – Horizontal spacing between sibling nodes.
y_spacing (float) – Vertical spacing between levels.
- Returns:
Mapping of node -> (x, y) positions.
- Return type:
dict
- loom.visualizer.circuit_visualizer.plot_circuit_tree(circuit, max_layer=None, layer_colors=None, layer_labels=None, num_layers_with_text=1)[source]
Plot the tree structure of a Circuit object.
- Parameters:
circuit (Circuit) – Circuit which should be plotted
max_layer (int | None) – Maximum layer up to which the tree should be plotted. If None is provided, all layers are plotted.
layer_colors (list[str] | None) – Array of colors for the markers in different layers.
layer_labels (list[str] | None) – Array of labels for the different layers. If None is provided, they are labeled by their number.
num_layers_with_text (int | None) – Number of layers where their name is written on top of the markers
- Returns:
Interactive go.Figure object for the circuit tree
- Return type:
go.Figure