# A Graph-Based Approach for Modelling Quantum Circuits
## 1 Introduction
The integration of solutions in the nascent field of model-driven quantum software development together with utilities for model-to-model transformations, is essential to support the adoption of the new computing paradigm. The definition of ontologies for QC, the development of cross-platform compilers as well as reverse engineering facilities to extract models from already implemented solutions will be the focus of particular attention in the coming years in Software Engineering, as evidenced by recent work where some researchers are demonstrating that this is the effective approach to develop quantum software in a systematic and disciplined manner. The development of a metamodel for quantum circuits and its integration into a Model-Driven Engineering process offers several significant advantages [9], such as (i) models can be reused across projects, reducing duplication of effort, (ii) automatic code generation from models to quantum programming frameworks, such as Qiskit, streamlines the implementation process, (iii) model-based analysis and validation helps identify errors and optimizations early on, and (iv) integration with existing tools leverages their capabilities for modelling, analysis, and code generation, improving the efficiency and quality of quantum circuit designs. In this context, this paper reflects on modelling abstractions for the unitary circuit model of QC, given the results available in the literature and the structure and behaviour of said computational model. We describe a unified metamodel that supports at least five modelling strategies that cover the practices identified in the related work. We also provide a deep study of said metamodel by (i) providing OCL constraints that check whether models are valid, (ii) providing OCL query functions to identify the modelling strategy employed by a model, (iii) outlining model-to-model transformations between the strategies, (iv) outlining a model transformation to reduce the number of modelling elements required to model a quantum circuit, and (v) providing an OCL query function to identify whether said transformation has been applied to a model. From the perspective of the usefulness for the creation of new metamodels, the identification of the strategies presented in this work, together with their suitability for performing model manipulations (navigation, transformations, etc. ), should serve as a guide for developers to choose one strategy over others, and to make this decision before starting to develop the different tools. Our aim is to contribute with a single metamodel that can accommodate and make different ways of modelling quantum circuits compatible, so that the QC community can \"speak and understand\" the same language, while at the same time supporting some local variations. The rest of this paper is organized as follows. Section 2 outlines the related work of applying model-driven engineering techniques to QC. Section 3 describes the main characteristics of the unitary circuit model for QC that are needed to understand it and that justify the metamodel proposed in this paper. Section 4 describes the proposed metamodel, together with five approaches in which it can be employed to model quantum circuits and an example problem that shows the feasibility of the proposal. Section 5 describes the constraints and model transformations mentioned above, which complete the proposal for a core set of tools to model quantum circuits. Section 6 is devoted to further discussion of the properties and suitability of each modelling strategy performing usual tasks in a model-driven development environment, such as editing models and developing model transformations. There is also a discussion of other aspects related to the work being presented, such as the role of domain-specific languages, the integration of the proposal into a hybrid classical-quantum development environment, as well as the applicability of the proposed approach to other quantum computing models. Lastly, concluding remarks are given in Section 7.