def check_protocol(protocol):
    """
    Check if a given protocol works by computing the qubit excitation probabilities
    """
    qubit_weight = {}
    qubit_weight[protocol[0][0][0]] = 1.0
    for pair_set in protocol:
        for i, j, p in pair_set:
            qubit_weight[j] = qubit_weight[i] * (1.0 - p)
            qubit_weight[i] *= p

    return qubit_weight