From f3e92488e8bba00a616e0292a505fd706917bfaf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Radek=20Hu=C5=A1ek?= <husek@iuuk.mff.cuni.cz>
Date: Thu, 8 Jul 2021 21:38:52 +0200
Subject: [PATCH] voltage graphs: fix negative values

---
 graph_tools/voltage_graphs.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/graph_tools/voltage_graphs.py b/graph_tools/voltage_graphs.py
index d021796..95f8579 100644
--- a/graph_tools/voltage_graphs.py
+++ b/graph_tools/voltage_graphs.py
@@ -97,7 +97,7 @@ def _init_():
       else:
         for i in range(-a):
           gadget.out(v if i == 0 else free_edges[i-1])
-          gadget.out(free_edges[i] if i < a - 1 else u)
+          gadget.out(free_edges[i] if i < abs(a) - 1 else u)
 
     gadget = gadget.finish()
 
-- 
GitLab