QuantumGraphVisualizer¶
- class lsst.pipe.base.quantum_graph.visualization.QuantumGraphVisualizer¶
Bases:
Generic[_G,_Q,_D]A base class for exporting quantum graphs to graph-visualization languages.
Notes
This base class is not intended to support implementations for every possible visualization language, but it does neatly unify common logic for at least GraphViz and Mermaid.
Methods Summary
render_dataset(dataset_id, data)Return the representation of a dataset in a graph visualization.
render_edge(a, b, data)Return the representation of an edge a graph visualization.
render_footer(qg, is_bipartite)Return the ending of a graph visualization.
render_header(qg, is_bipartite)Return the beginning of a graph visualization.
render_quantum(quantum_id, data, is_bipartite)Return the representation of a quantum in a graph visualization.
write_bipartite(qg, stream)Write a visualization for graph with both quantum and dataset nodes.
write_quantum_only(qg, stream)Write a visualization for graph with only quantum nodes.
Methods Documentation
- abstract render_dataset(dataset_id: UUID, data: _D) str¶
Return the representation of a dataset in a graph visualization.
- Parameters:
- dataset_id
uuid.UUID ID of the dataset.
- data
DatasetInfo Mapping with additional information about the dataset.
- dataset_id
- Returns:
- rendered
str String that represents the dataset. May contain newlines, but an additional newline will automatically be added after the string, before the next node or edge.
- rendered
- abstract render_edge(a: UUID, b: UUID, data: BipartiteEdgeInfo | None) str¶
Return the representation of an edge a graph visualization.
- Parameters:
- a
uuid.UUID ID of the quantum or dataset for which this is an outgoing edge.
- b
uuid.UUID ID of the quantum or dataset for which this is an incoming edge.
- data
BipartiteEdgeInfo Mapping with additional information about the dataset.
- a
- Returns:
- rendered
str String that represents the edge. May contain newlines, but an additional newline will automatically be added after the string, before the next edge.
- rendered
Return the ending of a graph visualization.
- Parameters:
- qg
BaseQuantumGraph Quantum graph to visualize.
- is_bipartite
bool Whether a bipartite graph visualization is being requested.
- qg
- Returns:
- rendered
str String that ends the visualization. May contain newlines, but an additional newline will automatically be added after the string, at the end of the file.
- rendered
- abstract render_header(qg: _G, is_bipartite: bool) str¶
Return the beginning of a graph visualization.
- Parameters:
- qg
BaseQuantumGraph Quantum graph to visualize.
- is_bipartite
bool Whether a bipartite graph visualization is being requested.
- qg
- Returns:
- rendered
str String that starts the visualization. May contain newlines, but an additional newline will automatically be added after the string, before the first node.
- rendered
- abstract render_quantum(quantum_id: UUID, data: _Q, is_bipartite: bool) str¶
Return the representation of a quantum in a graph visualization.
- Parameters:
- quantum_id
uuid.UUID ID of the quantum.
- data
QuantumInfo Mapping with additional information about the quantum.
- is_bipartite
bool Whether a bipartite graph visualization is being requested.
- quantum_id
- Returns:
- rendered
str String that represents the quantum. May contain newlines, but an additional newline will automatically be added after the string, before the next node or edge.
- rendered