Does the algorithm work?

Can I perform classification tasks using The Quantum Graph Recurrent Neural Network? If so, are there any more details, you know I’m a novice

Hey @zhong_Feng, welcome to the forum!

From our tutorial (The Quantum Graph Recurrent Neural Network | PennyLane Demos), this is the QGRNN:

def qgrnn(weights, bias, time=None):

    # Prepares the low energy state in the two registers
    qml.StatePrep(np.kron(low_energy_state, low_energy_state), wires=reg1 + reg2)

    # Evolves the first qubit register with the time-evolution circuit to
    # prepare a piece of quantum data
    state_evolve(ham_matrix, reg1, time)

    # Applies the QGRNN layers to the second qubit register
    depth = time / trotter_step  # P = t/Delta
    for _ in range(0, int(depth)):
        qgrnn_layer(weights, bias, reg2, new_ising_graph, trotter_step)

    # Applies the SWAP test between the registers
    swap_test(control, reg1, reg2)

    # Returns the results of the SWAP test
    return qml.expval(qml.PauliZ(control))

If you look at it far enough away, looks like a run-of-the-mill variational quantum circuit! So you can definitely use it for all sorts of applications so long as the inputs, outputs, etc., are interpreted or processed in a way that makes sense for the learning task you’re interested in (classification, in your case).

When using QGNN, if my topology graph structure has 39 nodes, do we have to have 39 quantum bits? Can it be run on a simulator? How much larger will the computational cost be?

I believe so, yes :slight_smile:. 39 qubits is quite a bit! If you’re going to try to simulate that, I definitely recommend using some of our performance libraries, like PennyLane lightning (Lightning plugins — Lightning 0.35.1 documentation) or Catalyst (Catalyst — Catalyst 0.5.0 documentation).