From a7c6e8a0bc8b796008d0842c266238cb4b8a10e9 Mon Sep 17 00:00:00 2001
From: Louis Navarre <louisnavarre@hotmail.com>
Date: Tue, 17 Jan 2023 14:24:41 +0000
Subject: [PATCH] Change output format of file

---
 shortest_path.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/shortest_path.py b/shortest_path.py
index a68742f..a5067d6 100644
--- a/shortest_path.py
+++ b/shortest_path.py
@@ -43,7 +43,9 @@ def bellman_ford(table, s):
         a, b, cab = table[j][0], table[j][1], table[j][2]
         if (dist[a] != math.inf and dist[b] > dist[a]+cab):
             print("Cycle négatif détecté")
-            return -1, -1
+            dist = [math.inf] * nb_nodes
+            dist[s] = 0
+            path = [-1] * nb_nodes
     return dist, path
 
 
-- 
GitLab