peteshadbolt / abp

Fast simulation of Clifford circuits
2 stars 1 forks source link

add_node(s) and add_edge(s) need to be more congruent with graph state language #4

Closed sammorley-short closed 8 years ago

sammorley-short commented 8 years ago

In graph state language a node and edge refer to a plus state and cz respectively, however, adding a node initialises a computational basis '0' state and adding an edge does not act a cz.

Suggested edits:

peteshadbolt commented 8 years ago

I disagree with some of this.

add_edge should not be identical to act_cz -- it should be possible to add an edge where a CZ would not create an edge due to VOPs.

add_node probably should initialize in |+〉 because, as you say, "node" is the language of graph states, which are naturally initialized in |+〉.

This will break some tests, I will find some time to deal with it,

sammorley-short commented 8 years ago

My problem with add_edge not being the same as act_cz (and perhaps I'm wrong on this) is that doesn't this then cause a problem between what you are seeing in the visualiser, and what the state actually is? Or does abp deal with all that? It seems to me you might end up screwing with the states your describing if removing an edge from a highly entangled graph doesn't perform some sort of disentanglement on the state.

peteshadbolt commented 8 years ago

Any graph with any set of VOPs is a valid quantum state. What do you mean by "screwing with the states"?

The image in abpserver should be a dumb 1-to-1 representation of the current state -- if there's a discrepancy between abp's representation and the figure, that's a bug.

sammorley-short commented 8 years ago

Ah ok. So in that case I just didn't see in what situation it would be used, but that's no reason to remove it I guess. It just feels like a really strange operation as it doesn't represent a single quantum operation on the state, but some weird, state-specific combination of CZ's and VOP's

peteshadbolt commented 8 years ago

Agreed. It is also used internally a lot. We could make it a private method and remove it from the docs. Same with add_node(s). I think that's a really good compromise actually.

s/add_node/_add_node

sammorley-short commented 8 years ago

Yeah, that's the best solution, keeps it simple. Perhaps then it would make sense to have some from_graph(nx_graph) method so you can quickly initialise from a graph structure, but then are forced to edit it as a GraphState() object going forwards (i.e. using add_qubit() and act_hadamard())?

peteshadbolt commented 8 years ago

NB: _add_edge is already private and undocumented to dissuade n00b usage.