From 0350daae008cba48d49bc81152a6811223dd6d7f Mon Sep 17 00:00:00 2001
From: zimmermann <zimmermann@cl.uni-heidelberg.de>
Date: Thu, 22 Mar 2018 19:16:56 +0100
Subject: [PATCH] Bugfixes.

---
 src/absinth.py   | 8 ++++----
 src/abstinent.py | 7 ++++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/absinth.py b/src/absinth.py
index e777ccf..71a0a3e 100644
--- a/src/absinth.py
+++ b/src/absinth.py
@@ -1025,12 +1025,12 @@ def main(topic_id: int, topic_name: str, result_dict: dict) -> None:
 
         try:
             mean_degree = edge_count/node_count
+            stat_dict['L_rand'] = np.log(node_count)/np.log(mean_degree)
+            stat_dict['C_rand'] = 2 * mean_degree/node_count
         except ZeroDivisionError:
             mean_degree = 0
-
-        stat_dict['L_rand'] = np.log(node_count)/np.log(mean_degree)
-        stat_dict['C_rand'] = 2 * mean_degree/node_count
-        
+            stat_dict['L_rand'] = None
+            stat_dict['C_rand'] = 0
         
         propagation_rank = config.colour_rank
         mst_rank = config.mst_rank
diff --git a/src/abstinent.py b/src/abstinent.py
index 5536301..15a2955 100644
--- a/src/abstinent.py
+++ b/src/abstinent.py
@@ -637,12 +637,13 @@ def main(topic_id: int, topic_name: str, result_dict: dict) -> None:
 
         try:
             mean_degree = edge_count/node_count
+            stat_dict['L_rand'] = np.log(node_count)/np.log(mean_degree)
+            stat_dict['C_rand'] = 2 * mean_degree/node_count
         except ZeroDivisionError:
             mean_degree = 0
+            stat_dict['L_rand'] = None
+            stat_dict['C_rand'] = 0
 
-        stat_dict['L_rand'] = np.log(node_count)/np.log(mean_degree)
-        stat_dict['C_rand'] = 2 * mean_degree/node_count
-        
         print('[a]', 'Disambiguating results.\t('+topic_name+')')
         
         bag = bag_of_senses(graph, root_hub_list)
-- 
GitLab