From ec55bd450de5c61a11f6e9ceb9b288f89211a34b Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Wed, 9 Mar 2016 20:48:12 +0000 Subject: [PATCH] Local complementation --- TODO | 4 ++++ cz.py | 29 +++++++++++++++++++++++++++++ graph.py | 36 +++++++++++++++++++++++------------- tests/test_graph.py | 7 +++++-- 4 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 TODO create mode 100644 cz.py diff --git a/TODO b/TODO new file mode 100644 index 0000000..18b0f9d --- /dev/null +++ b/TODO @@ -0,0 +1,4 @@ +Next things to do: + - Read A&B code which expresses C(1) as products of sqrt(iX), sqrt(iY) + - Read A&B code which exposes LC API + - Implement the above diff --git a/cz.py b/cz.py new file mode 100644 index 0000000..edf1a36 --- /dev/null +++ b/cz.py @@ -0,0 +1,29 @@ +from graph import Graph +from matplotlib import pyplot as plt + +class GraphState(Graph): + + def __init__(self, n): + Graph.__init__(self, n) + + def local_complementation(self, a): + for i in self.neighbours[a]: + for j in self.neighbours[a]: + if i