
from __future__ import annotations

import random

# Adjacency list representation of this graph:
# https://en.wikipedia.org/wiki/File:Single_run_of_Karger%E2%80%99s_Mincut_algorithm.svg
__magic_name__  :  Dict     			=   {
    '1': ['2', '3', '4', '5'],
    '2': ['1', '3', '4', '5'],
    '3': ['1', '2', '4', '5', '10'],
    '4': ['1', '2', '3', '5', '6'],
    '5': ['1', '2', '3', '4', '7'],
    '6': ['7', '8', '9', '10', '4'],
    '7': ['6', '8', '9', '10', '5'],
    '8': ['6', '7', '9', '10'],
    '9': ['6', '7', '8', '10'],
    '10': ['6', '7', '8', '9', '3'],
}





def        lowerCAmelCase       (				snake_case__   :      dict[str, list[str]] )->			set[tuple[str, str]]:
    A_								=					{node: {node} for node in graph}

    A_								=					{node: graph[node][:] for node in graph}

    while len(snake_case__ ) > 2:
        # Choose a random edge.
        A_								=					random.choice(list(graph_copy.keys() ) )
        A_								=					random.choice(graph_copy[u] )

        # Contract edge (u, v) to new node uv
        A_								=					u + v
        A_								=					list(set(graph_copy[u] + graph_copy[v] ) )
        uv_neighbors.remove(snake_case__ )
        uv_neighbors.remove(snake_case__ )
        A_								=					uv_neighbors
        for neighbor in uv_neighbors:
            graph_copy[neighbor].append(snake_case__ )

        A_								=					set(contracted_nodes[u].union(contracted_nodes[v] ) )

        # Remove nodes u and v.
        del graph_copy[u]
        del graph_copy[v]
        for neighbor in uv_neighbors:
            if u in graph_copy[neighbor]:
                graph_copy[neighbor].remove(snake_case__ )
            if v in graph_copy[neighbor]:
                graph_copy[neighbor].remove(snake_case__ )

    # Find cutset.
    A_								=					[contracted_nodes[node] for node in graph_copy]
    return {
        (node, neighbor)
        for node in groups[0]
        for neighbor in graph[node]
        if neighbor in groups[1]
    }


if __name__ == "__main__":
     print(partition_graph(TEST_GRAPH))








import math

import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute





def        lowerCAmelCase       (				snake_case__   :      int = 1				,					snake_case__   :      int = 1 )->			qiskit.result.counts.Counts:
    if isinstance(snake_case__				,					snake_case__ ) or isinstance(snake_case__				,					snake_case__ ):
        raise TypeError("inputs must be integers." )
    if (bit_a < 0) or (bit_a < 0):
        raise ValueError("inputs must be positive." )
    if (math.floor(snake_case__ ) != bit_a) or (math.floor(snake_case__ ) != bit_a):
        raise ValueError("inputs must be exact integers." )
    if (bit_a > 1) or (bit_a > 1):
        raise ValueError("inputs must be less or equal to 1." )

    # build registers
    A_								=					QuantumRegister(2				,					"qr" )
    A_								=					ClassicalRegister(2				,					"cr" )

    A_								=					QuantumCircuit(snake_case__				,					snake_case__ )

    # entanglement the qubits
    quantum_circuit.h(1 )
    quantum_circuit.cx(1				,					0 )

    # send the information
    A_								=					str(snake_case__ ) + str(snake_case__ )

    if c_information == "11":
        quantum_circuit.x(1 )
        quantum_circuit.z(1 )
    elif c_information == "10":
        quantum_circuit.z(1 )
    elif c_information == "01":
        quantum_circuit.x(1 )
    else:
        quantum_circuit.i(1 )

    # unentangled the circuit
    quantum_circuit.cx(1				,					0 )
    quantum_circuit.h(1 )

    # measure the circuit
    quantum_circuit.measure(snake_case__				,					snake_case__ )

    A_								=					Aer.get_backend("aer_simulator" )
    A_								=					execute(snake_case__				,					snake_case__				,					shots=1000 )

    return job.result().get_counts(snake_case__ )


if __name__ == "__main__":
     print(f"""Counts for classical state send: {superdense_coding(1,1)}""")






