From 27d8a351bac99c2d03385137c02149002d38b8dc Mon Sep 17 00:00:00 2001
From: Yoann Dufresne <yoann.dufresne0@gmail.com>
Date: Thu, 2 Apr 2020 11:45:47 +0200
Subject: [PATCH] bugfix: minimize the index size for small d-graph values

---
 deconvolution/dgraph/VariableDGIndex.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/deconvolution/dgraph/VariableDGIndex.py b/deconvolution/dgraph/VariableDGIndex.py
index 013bb99..535230a 100644
--- a/deconvolution/dgraph/VariableDGIndex.py
+++ b/deconvolution/dgraph/VariableDGIndex.py
@@ -17,6 +17,6 @@ class VariableDGIndex(AbstractDGIndex):
     def add_dgraph(self, dg):
         barcodes = dg.node_set
 
-        for size in range(len(barcodes)-self.size, len(barcodes)+1):
+        for size in range(max(1, len(barcodes)-self.size), len(barcodes)+1):
             for tup in combinations(barcodes, size):
                 self.add_value(frozenset(tup), dg)
-- 
GitLab