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.

25 lines
516B

  1. from matplotlib import pyplot as plt
  2. from graph import *
  3. from viz import draw
  4. def local_complementation(g, vops, a):
  5. for i in g[a]:
  6. for j in g[a]:
  7. if i<j:
  8. toggle_edge(g, i, j)
  9. if __name__ == '__main__':
  10. g, vops = graph(10)
  11. add_edge(g, 0, 1)
  12. add_edge(g, 1, 3)
  13. add_edge(g, 3, 2)
  14. add_edge(g, 3, 0)
  15. add_edge(g, 2, 0)
  16. add_edge(g, 0, 5)
  17. vops[0]=1
  18. draw(g, vops)
  19. plt.clf()
  20. local_complementation(g, vops, 0)
  21. draw(g, vops, "out2.pdf")