diff --git a/abp/static/scripts/graph.js b/abp/static/scripts/graph.js index b507ff5..9cf6a00 100644 --- a/abp/static/scripts/graph.js +++ b/abp/static/scripts/graph.js @@ -50,11 +50,16 @@ graph.update = function(newState) { if (editor.selection) { console.log(editor.selection); var node = editor.selection; - editor.grid.position.copy(abj.node[node].position); - gui.controls.target.copy(abj.node[node].position); - node_name.innerHTML = "Node " + node; - node_data.className = "visible"; - node_vop.innerHTML = "VOP: " + abj.node[node].vop; + if (Object.prototype.hasOwnProperty.call(abj.node, node)) { + editor.grid.position.copy(abj.node[node].position); + gui.controls.target.copy(abj.node[node].position); + node_name.innerHTML = "Node " + node; + node_data.className = "visible"; + node_vop.innerHTML = "VOP: " + abj.node[node].vop; + } else { + editor.selection = undefined; + node_data.className = "hidden"; + } } else { node_data.className = "hidden"; } diff --git a/examples/visualization/lattice_2d.py b/examples/visualization/lattice_2d.py index 2d42016..cd4450c 100644 --- a/examples/visualization/lattice_2d.py +++ b/examples/visualization/lattice_2d.py @@ -40,4 +40,5 @@ for node in nodes: for edge in edges: psi.act_cz(str(edge[0]), str(edge[1])) +psi.update(0.1) diff --git a/examples/visualization/lattice_3d.py b/examples/visualization/lattice_3d.py index e4a229b..a4db00e 100644 --- a/examples/visualization/lattice_3d.py +++ b/examples/visualization/lattice_3d.py @@ -45,9 +45,10 @@ nodes, edges = lattice(threedee_unit_cell, (3, 3, 3)) psi = GraphState() for node in nodes: - psi.add_node(str(node), position=xyz(*node)) + psi.add_qubit(str(node), position=xyz(*node)) psi.act_hadamard(str(node)) for edge in edges: psi.act_cz(str(edge[0]), str(edge[1])) +psi.update()