Browse Source

Remove adj_list()

master
Pete Shadbolt 7 years ago
parent
commit
e398d39aae
2 changed files with 10 additions and 10 deletions
  1. +0
    -10
      abp/graphstate.py
  2. +10
    -0
      tests/test_measurement.py

+ 0
- 10
abp/graphstate.py View File

@@ -191,16 +191,6 @@ class GraphState(object):
output[a][b] = "I"
return output

def adj_list(self):
""" For comparison with Anders and Briegel's C++ implementation """
rows = []
for key, node in self.node.items():
adj = " ".join(map(str, sorted(self.adj[key])))
vop = clifford.get_name(node["vop"])
s = "Vertex {}: VOp {}, neighbors {}".format(key, vop, adj)
rows.append(s)
return " \n".join(rows) + " \n"

def __eq__(self, other):
""" Check equality between graphs """
return self.adj == other.adj and self.node == other.node

+ 10
- 0
tests/test_measurement.py View File

@@ -1,4 +1,5 @@
from abp import GraphState
from anders_briegel import graphsim

def test_z_measurement():
g = GraphState([0])
@@ -6,5 +7,14 @@ def test_z_measurement():
assert g.measure_z(0, 1) == 1


def test_z_measurement_against_ab():
a = graphsim.GraphRegister(1)
b = GraphState()
b.add_node(0)

print a.measure(0, graphsim.lco_Z)
print b.measure_z(0)





Loading…
Cancel
Save