get_flame_graph_data#
View source on GitHub
|
Get the flame graph data for visualizing T-costs distribution of a sequence of bloqs.
qualtran.drawing.flame_graph.get_flame_graph_data(
*bloqs,
file_path: Union[None, pathlib.Path, str] = None,
keep: Optional[Callable[['Bloq'], bool]] = _keep_if_small,
**kwargs
) -> List[str]
For each bloq in the input, this will do a DFS ordering over all edges in the DAG and
add an entry corresponding to each leaf node in the call graph. The string representation
added for a leaf node encodes the entire path taken from the root node to the leaf node
and is repeated a number of times that’s equivalent to the weight of that path. Thus, the
length of the output would be roughly equal to the number of T-gates in the Bloq and can be
very high. If you want to limit the output size, consider specifying a keep predicate where
the leaf nodes are higher level Bloqs with a larger T-count weight.
Args
bloqsBloqs to plot the flame graph for
file_pathIf specified, the output is stored at the file.
keepA predicate to determine the leaf nodes in the call graph. The flame graph would use these Bloqs as leaf nodes and thus would not contain decompositions for these nodes.
**kwargsAdditional arguments to be passed to
bloq.call_graph, like generalizers etc.
View source on GitHub