Visualization
Graph construction and Plotly rendering for quantum-robot networks.
- qrobot_visualization.build_network(source: object | None = None, status_dict: Mapping[str, str] | None = None) DiGraph[source]
Build a directed qBrain graph from configured units or live status.
Configured units describe the architecture without needing to be running. A status mapping can build the network from recorded values or add runtime values to an architecture built from configured units.
- Parameters:
source (object, optional) – Unit, nested collection of units, or mapping of published unit attributes. Unit inputs determine the edges between nodes.
status_dict (collections.abc.Mapping[str, str], optional) – Published unit attributes to add to the configured architecture. When
sourceis omitted, this mapping defines the complete network.
- Returns:
Directed network containing units as nodes and input couplings as edges.
- Return type:
networkx.DiGraph
Examples
Build a network from published unit attributes:
>>> from qrobot_visualization import build_network >>> status = { ... "sensor class": "SensorialUnit", ... "processor class": "QUnit", ... "processor in_qunits": '{"0": "sensor"}', ... } >>> network = build_network(status) >>> list(network.edges) [('sensor', 'processor')]
- qrobot_visualization.draw(graph: Graph) Figure[source]
Render a qBrain network as an interactive Plotly figure.
Arrange sensorial units, qBrain layers, and actuator units from left to right. Node and edge colors identify their architectural roles, while directed arrows show the configured flow of information.
- Parameters:
graph (networkx.Graph) – Network whose nodes contain the attributes produced by
qrobot_visualization.build_network().- Returns:
Interactive architecture figure that can be displayed directly or embedded with Plotly’s
to_htmlmethod.- Return type:
plotly.graph_objects.Figure
Examples
>>> from qrobot_visualization import build_network, draw >>> network = build_network(status_dict={"sensor class": "SensorialUnit"}) >>> figure = draw(network)