Skip to content

Commit

Permalink
adding documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
EliasLF committed Oct 19, 2023
1 parent 90f3fc5 commit 80e9307
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
32 changes: 31 additions & 1 deletion docs/source/Mapping.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,35 @@
"\n",
"qc_mapped_w_teleport.draw(output=\"mpl\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Visualizing search graphs\n",
"\n",
"For deeper insight into a specific mapping process one can visualize the search graphs generated during heuristic mapping."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from mqt import qmap\n",
"\n",
"visualizer = qmap.visualization.SearchVisualizer()\n",
"qc_mapped, res = qmap.compile(qc, arch, method=\"heuristic\", visualizer=visualizer)\n",
"visualizer.visualize_search_graph()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"There exist a wide range of customizations for these visualizations. Please refer to the API reference for details."
]
}
],
"metadata": {
Expand All @@ -280,7 +309,8 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3"
"pygments_lexer": "ipython3",
"version": "3.9.13"
}
},
"nbformat": 4,
Expand Down
1 change: 1 addition & 0 deletions docs/source/library/Library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Library
Subarchitectures
Synthesis
SynthesisResults
Visualization
16 changes: 16 additions & 0 deletions docs/source/library/Visualization.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Visualization
===========================

All visualization functionality is bundled in the sub-module :code:`mqt.qmap.visualization`.

Search graph visualization
############################

The recommended way to visualize search graphs of a mapping process is via a :code:`SearchVisualizer` object, which can be passed to the :code:`compile` function when mapping a circuit to enable data logging during mapping, after which this data can be visualized by calling the method :code:`visualize_search_graph` of the :code:`SearchVisualizer` object.
Closing the :code:`SearchVisualizer` object will cleanup the data logged during mapping, which will however also be done automatically when the python process terminates (if not custom data logging path is used).

.. note::
:code:`visualize_search_graph` returns an IPython display object and therefore requires to be executed in a jupyter notebook or jupyter lab environment.

.. currentmodule:: mqt.qmap.visualization
.. autoclass:: SearchVisualizer

0 comments on commit 80e9307

Please sign in to comment.