Example #1
0
        def assemble_edges() -> Set[EDGE]:
            """Creates list of edges for initial state.

            Returns:
              List of all possible edges.
            """
            nodes_set = set(self._c)
            edges = set()
            for n in self._c:
                if above(n) in nodes_set:
                    edges.add(self._normalize_edge((n, above(n))))
                if right_of(n) in nodes_set:
                    edges.add(self._normalize_edge((n, right_of(n))))
            return edges
Example #2
0
        def assemble_edges() -> Set[EDGE]:
            """Creates list of edges for initial state.

            Returns:
              List of all possible edges.
            """
            nodes_set = set(self._c)
            edges = set()
            for n in self._c:
                if above(n) in nodes_set:
                    edges.add(self._normalize_edge((n, above(n))))
                if right_of(n) in nodes_set:
                    edges.add(self._normalize_edge((n, right_of(n))))
            return edges
Example #3
0
def test_qubit_not_mutated():
    qubit = GridQubit(0, 0)

    above(qubit)
    assert qubit == GridQubit(0, 0)

    below(qubit)
    assert qubit == GridQubit(0, 0)

    right_of(qubit)
    assert qubit == GridQubit(0, 0)

    left_of(qubit)
    assert qubit == GridQubit(0, 0)
Example #4
0
def test_qubit_not_mutated():
    qubit = GridQubit(0, 0)

    above(qubit)
    assert qubit == GridQubit(0, 0)

    below(qubit)
    assert qubit == GridQubit(0, 0)

    right_of(qubit)
    assert qubit == GridQubit(0, 0)

    left_of(qubit)
    assert qubit == GridQubit(0, 0)
Example #5
0
def test_neighbours():
    qubit = GridQubit(0, 0)
    assert above(qubit) == GridQubit(0, -1)
    assert below(qubit) == GridQubit(0, 1)
    assert right_of(qubit) == GridQubit(1, 0)
    assert left_of(qubit) == GridQubit(-1, 0)
Example #6
0
def test_neighbours():
    qubit = GridQubit(0, 0)
    assert above(qubit) == GridQubit(0, -1)
    assert below(qubit) == GridQubit(0, 1)
    assert right_of(qubit) == GridQubit(1, 0)
    assert left_of(qubit) == GridQubit(-1, 0)