Browse Source

Add pics

master
Pete Shadbolt 8 years ago
parent
commit
126c819d2c
4 changed files with 5 additions and 5 deletions
  1. +4
    -4
      abp/fancy.py
  2. +1
    -1
      abp/graphstate.py
  3. +0
    -0
      img/demo.gif
  4. BIN
      img/viz.png

+ 4
- 4
abp/fancy.py View File

@@ -48,13 +48,13 @@ class GraphState(graphstate.GraphState, networkx.Graph):
#self.ws.close() #self.ws.close()
#self.connect_to_server() #self.connect_to_server()


def layout(self, dim=2):
def layout(self):
""" Automatically lay out the graph """ """ Automatically lay out the graph """
pos = networkx.spring_layout(self, dim, scale=np.sqrt(self.order()))
pos = networkx.spring_layout(self, 3, scale=np.sqrt(self.order()))
middle = np.average(pos.values(), axis=0) middle = np.average(pos.values(), axis=0)
pos = {key: value - middle for key, value in pos.items()} pos = {key: value - middle for key, value in pos.items()}
for key, (x, y) in pos.items():
self.node[key]["position"] = util.xyz(x, y, 0)
for key, (x, y, z) in pos.items():
self.node[key]["position"] = util.xyz(x, y, z)


def add_vops(self): def add_vops(self):
""" Automatically add vops if they're not present """ """ Automatically add vops if they're not present """


+ 1
- 1
abp/graphstate.py View File

@@ -114,7 +114,7 @@ class GraphState(object):
va = self.node[a]["vop"] va = self.node[a]["vop"]
vb = self.node[b]["vop"] vb = self.node[b]["vop"]
new_edge, self.node[a]["vop"], self.node[b]["vop"] = \ new_edge, self.node[a]["vop"], self.node[b]["vop"] = \
clifford.cz_table[edge, va, vb]
clifford.cz_table[int(edge), va, vb]
if new_edge != edge: if new_edge != edge:
self.toggle_edge(a, b) self.toggle_edge(a, b)




demo.gif → img/demo.gif View File


BIN
img/viz.png View File

Before After
Width: 529  |  Height: 321  |  Size: 10KB

Loading…
Cancel
Save