Anders and Briegel in Python
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
641B

  1. from graph import *
  2. import viz
  3. import itertools as it
  4. import clifford
  5. def local_complementation(g, vops, v):
  6. """ As defined in LISTING 1 of Anders & Briegel """
  7. for i, j in it.combinations(g[v], 2):
  8. toggle_edge(g, i, j)
  9. # Update VOPs
  10. vops[v] = clifford.times_table[vops[v]][clifford.sqx]
  11. for i in g[v]:
  12. vops[i] = clifford.times_table[vops[i]][clifford.msqz]
  13. if __name__ == '__main__':
  14. g, vops = graph()
  15. add_edge(g, 0, 1)
  16. add_edge(g, 1, 2)
  17. add_edge(g, 0, 2)
  18. add_edge(g, 0, 3)
  19. viz.draw(g, vops, "out.pdf")
  20. local_complementation(g, vops, 0)
  21. viz.draw(g, vops, "out2.pdf")