

"""simple docstring"""


import math

import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute



def   _A					(	_a	:						int = 3				):



      """simple docstring"""






      if isinstance(_a     ,   _a				):
            raise TypeError("""number of qubits must be a integer."""				)
      if number_of_qubits <= 0:
            raise ValueError("""number of qubits must be > 0."""				)
      if math.floor(_a				) != number_of_qubits:
            raise ValueError("""number of qubits must be exact integer."""				)
      if number_of_qubits > 1_0:
            raise ValueError("""number of qubits too large to simulate(>10)."""				)

      A				  =		QuantumRegister(_a     ,   """qr"""				)
      A				  =		ClassicalRegister(_a     ,   """cr"""				)

      A				  =		QuantumCircuit(_a     ,   _a				)

      A				  =		number_of_qubits

      for i in range(_a				):
            quantum_circuit.h(number_of_qubits - i - 1				)
            counter -= 1
            for j in range(_a				):
                  quantum_circuit.cp(np.pi / 2 ** (counter - j)     ,   _a     ,   _a				)

      for k in range(number_of_qubits // 2				):
            quantum_circuit.swap(_a     ,   number_of_qubits - k - 1				)

      # measure all the qubits
      quantum_circuit.measure(_a     ,   _a				)
      # simulate with 10000 shots
      A				  =		Aer.get_backend("""qasm_simulator"""				)
      A				  =		execute(_a     ,   _a     ,   shots=1_0_0_0_0				)

      return job.result().get_counts(_a				)


if __name__ == "__main__":
  print(
      f"""Total count for quantum fourier transform state is: \
    {quantum_fourier_transform(3)}"""
  )







"""simple docstring"""


class lowerCamelCase__   :



    '''simple docstring'''




    def __init__( self    )    ->      Union[str, Any]:
          A				  =		{}




    def UpperCamelCase__		( self    )    ->      None:
          print(self.vertex    )
          for i in self.vertex:
                print(lowerCamelCase_ ,""" -> """ ,""" -> """.join([str(lowerCamelCase_    ) for j in self.vertex[i]]    )    )




    def UpperCamelCase__		( self ,lowerCamelCase_ ,lowerCamelCase_    )    ->      None:
          # check if vertex is already present,
          if from_vertex in self.vertex:
                self.vertex[from_vertex].append(lowerCamelCase_    )
          else:
                # else make a new vertex
                A				  =		[to_vertex]




    def UpperCamelCase__		( self    )    ->      None:
          # visited array for storing already visited nodes
          A				  =		[False] * len(self.vertex    )

          # call the recursive helper function
          for i in range(len(self.vertex    )    ):
                if not visited[i]:
                      self.dfs_recursive(lowerCamelCase_ ,lowerCamelCase_    )




    def UpperCamelCase__		( self ,lowerCamelCase_ ,lowerCamelCase_    )    ->      None:
          # mark start vertex as visited
          A				  =		True

          print(lowerCamelCase_ ,end=""" """    )

          # Recur for all the vertices that are adjacent to this node
          for i in self.vertex:
                if not visited[i]:
                      self.dfs_recursive(lowerCamelCase_ ,lowerCamelCase_    )


if __name__ == "__main__":
  UpperCAmelCase													=Graph()
  g.add_edge(0, 1)
  g.add_edge(0, 2)
  g.add_edge(1, 2)
  g.add_edge(2, 0)
  g.add_edge(2, 3)
  g.add_edge(3, 3)

  g.print_graph()
  print("DFS:")
  g.dfs()

  # OUTPUT:
  # 0  ->  1 -> 2
  # 1  ->  2
  # 2  ->  0 -> 3
  # 3  ->  3
  # DFS:
  #  0 1 2 3




