From d196042cfb0b74ce63f9ebca19d6b0409e75aa5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Radek=20Hu=C5=A1ek?= <PitelVonSacek@gmail.com>
Date: Thu, 10 Dec 2015 08:38:05 +0100
Subject: [PATCH] Implement EXPLICIT_NORMAL_EDGES

Also fixes related typos
---
 compileTimeOptions.h |  4 ++--
 group-connectivity.h | 13 +++++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/compileTimeOptions.h b/compileTimeOptions.h
index 4ef5d52..10fa76a 100644
--- a/compileTimeOptions.h
+++ b/compileTimeOptions.h
@@ -14,9 +14,9 @@ BOOL_OPTION(OPTIMIZE_COMBINE, 0)
 
 BOOL_OPTION(USE_NEXT_FORB, 1)
 
-BOOL_OPTION(EXPLICIT_NOMAL_EDGES, 0)
+BOOL_OPTION(EXPLICIT_NORMAL_EDGES, 0)
 REQUIRES(EXPLICIT_NORMAL_EDGES, USE_NEXT_FORB)
 
 BOOL_OPTION(USE_TWO_CUTS, 0)
-REQUIRES(USE_TWO_CUTS, USE_NEXT_FORB && EXPLICIT_NOMAL_EDGES)
+REQUIRES(USE_TWO_CUTS, USE_NEXT_FORB && EXPLICIT_NORMAL_EDGES)
 
diff --git a/group-connectivity.h b/group-connectivity.h
index f7950ac..fc1b508 100644
--- a/group-connectivity.h
+++ b/group-connectivity.h
@@ -44,6 +44,9 @@ struct Tester : public AbstractTester {
 
   std::vector<EdgeId> classEdges;
   std::vector< std::pair<EdgeId, Mapping> > nonClassEdges;
+# if EXPLICIT_NORMAL_EDGES
+  std::vector< EdgeId > normalEdges;
+# endif
 
   virtual void init(
     int edges_,
@@ -75,12 +78,22 @@ struct Tester : public AbstractTester {
         map.assign(edge, neg ? Ring::one : Ring::negate(Ring::one));
       }
     }
+
+#   if EXPLICIT_NORMAL_EDGES
+    std::vector<bool> edgeList(edges, 1);
+    for (size_t i = 0; i < edges; i++)
+      if (edgeList[i]) normalEdges.push_back(i);
+#   endif
   }
 
 
 #if USE_NEXT_FORB
   bool nextForb(Mapping& forb) {
+#   if EXPLICIT_NORMAL_EDGES
+    for (auto i : normalEdges) {
+#   else
     for (size_t i = 0; i < edges; i++) {
+#   endif
       T v = forb[i] + 1;
       if (v >= Ring::size) {
         forb.assign(i, 1);
-- 
GitLab