# Computational cost of a circuit in Qiskit

I would like to see, in terms of complexity, the cost of a circuit. For example: I have written two algorithm that does the same thing, but in one of them I initialize data differently, so I would like to compare them.

I've seen that there is a function called count_ops() , but it return only the number of each gate and I think it is not useful for my purpose, because is not an appropriate metric (i.e it is possible that one circuit is computationally more expensive but has less gate than the other). I am wondering if there is a function which calculate the complexity, given the gate, or something like that.

Thanks very much.

• Hi Dylan! You will have to define more clearly what you mean by "complexity", "cost of a circuit" and "computationally more expensive" here. Complexity is a theoretical behaviour when the inputs of the algorithm becomes larger and larger, "cost of a circuit" can literally be a dozen of different things and "computationally more expensive" depends on the "cost of a circuit" you pick. Aug 7, 2022 at 10:55
• Hi! you're right, I'm sorry. In any case, Ohad gave me a very well describing of the problem. Thanks anyway :). Aug 7, 2022 at 11:58

In qiskit a QuantumCircuit object has a method called depth() (Just like the count_ops() method that you have mentioned) - So you can easily test the circuit depth of any circuit.