Anders and Briegel in Python
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

27 lignes
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")