From 348931da400cddadcbdff227acf5923430a31819 Mon Sep 17 00:00:00 2001
From: Louis Navarre <louisnavarre@hotmail.com>
Date: Tue, 17 Jan 2023 11:17:59 +0000
Subject: [PATCH] Correct the creation of graphs

---
 create_graph_dumb.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/create_graph_dumb.py b/create_graph_dumb.py
index 2d78d96..584c307 100644
--- a/create_graph_dumb.py
+++ b/create_graph_dumb.py
@@ -17,6 +17,7 @@ def create_random_graph(args):
         c_ab = random.randint(1, 10)
 
         nodes.setdefault(node_a, list()).append((node_b, c_ab))
+        nodes.setdefault(node_b, list())
 
     return nodes, nb_links
 
@@ -37,6 +38,7 @@ def ntf_parse(args):
 
         c_ab = int(tab[2])
         nodes.setdefault(node_a, list()).append((node_b, c_ab))
+        nodes.setdefault(node_b, list())
 
     return nodes, len(data)
 
@@ -70,6 +72,7 @@ def to_binary_file(nodes, nb_links, output):
         print(nodes)
         for node in nodes:
             for j, cost in nodes[node]:
+                print(node, j, cost)
                 fd.write(node.to_bytes(4, "big"))
                 fd.write(j.to_bytes(4, "big"))
                 fd.write(cost.to_bytes(4, "big", signed=True))
-- 
GitLab