Browse Source

Fix small things

master
Pete Shadbolt 8 years ago
parent
commit
d3e93ca550
2 changed files with 5 additions and 6 deletions
  1. +3
    -4
      abp/graphstate.py
  2. +2
    -2
      tests/test_nxgraphstate.py

+ 3
- 4
abp/graphstate.py View File

@@ -17,13 +17,12 @@ class GraphState(NXGraph):
self.adj, self.node = {}, {}
self.add_nodes(nodes)

def add_node(self, v, position = None, meta = {}):
def add_node(self, v, **kwargs):
""" Add a node """
assert not v in self.node
self.adj[v] = {}
self.node[v] = {"vop": clifford.by_name["hadamard"],
"position": position}
self.node[v].update(meta)
self.node[v] = {"vop": clifford.by_name["hadamard"]}
self.node[v].update(kwargs)

def add_nodes(self, nodes):
""" Add a buncha nodes """


+ 2
- 2
tests/test_nxgraphstate.py View File

@@ -4,8 +4,8 @@ import networkx as nx

def simple_test():
g = GraphState()
g.add_node(0, xyz(0, 0, 0))
g.add_node(1, xyz(0, 0, 0))
g.add_node(0, position = xyz(10, 0, 0))
g.add_node(1, position = xyz(1, 0, 0))
g.act_hadamard(0)
g.act_hadamard(1)
g.act_cz(0, 1)


Loading…
Cancel
Save