import qiskit.tools.jupyter
import matplotlib as ml
from GenerateRandomCircuit import *

backends_dict={}

backendname_sim = 'qasm_simulator'
backends_dict[backendname_sim] = Aer.get_backend(backendname_sim)

#load IBMQ account
#IBMQ.save_account('yourAPItoken')
IBMQ.load_account()
provider = IBMQ.get_provider(hub='ibm-q')

for backendname in ['ibmq_16_melbourne', 'ibmqx2']:
    backends_dict[backendname] = provider.get_backend(backendname)

G_qasm_simulator=createGraph(backends_dict['qasm_simulator'],5)
nx.draw_networkx(G_qasm_simulator)

G_ibmqx2=createGraph(backends_dict['ibmqx2'])
nx.draw_networkx(G_ibmqx2)

G_melbourne=createGraph(backends_dict['ibmq_16_melbourne'])
nx.draw_networkx(G_melbourne)

circ = randomCircuit(G_ibmqx2)
circ.draw(output='mpl')

circ = randomCircuit(G_ibmqx2, cnots=9)
circ.draw(output='mpl')

circ = randomCircuit(G_ibmqx2, depth=10)
circ.draw(output='mpl')

circ = randomCircuit(G_ibmqx2, cnots=13, depth=2)
circ.draw(output='mpl')

circ = randomCircuit(G_ibmqx2, cnots=3, depth=9)
circ.draw(output='mpl')

circ = randomCircuit(G_ibmqx2, cnots=14, depth=9)
circ.draw(output='mpl')

circ = randomCircuit(G_ibmqx2, cnots=14, depth=9, barrier=True)
circ.draw(output='mpl')

circ = randomCircuit(G_ibmqx2, cnots=16, depth=33)
circ.draw(output='mpl')

circ = randomCircuit(G_qasm_simulator, depth=10)
circ.draw(output='mpl')

circ = randomCircuit(G_melbourne, depth=10)
circ.draw(output='mpl')