From c4c645b42973700742cb94084a19c59771568934 Mon Sep 17 00:00:00 2001 From: Louis Navarre <louisnavarre@hotmail.com> Date: Fri, 17 Feb 2023 11:20:57 +0100 Subject: [PATCH] Correct Python nb_nodes and sample NTF --- sample_ntf/small.ntf | 4 ++++ sp.py | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 sample_ntf/small.ntf diff --git a/sample_ntf/small.ntf b/sample_ntf/small.ntf new file mode 100644 index 0000000..eb10462 --- /dev/null +++ b/sample_ntf/small.ntf @@ -0,0 +1,4 @@ +0 1 1 +1 0 4 +0 2 -1 +2 1 9 \ No newline at end of file diff --git a/sp.py b/sp.py index 56d2046..7abb2fb 100644 --- a/sp.py +++ b/sp.py @@ -104,7 +104,7 @@ def read_graph(filename): l1 = [from_node, to_node, cost] links.append(l1) - return links + return links, nb_nodes if __name__ == "__main__": @@ -128,9 +128,9 @@ if __name__ == "__main__": # Exemple de message que vous pouvez ecrire si le mode verbose est actif. print(args, file=sys.stderr) - graph = read_graph(args.input_file) + graph, nb_nodes = read_graph(args.input_file) for source in range(nb_nodes): - dist, path = bellman_ford(graph, source) + dist, path = bellman_ford(graph, source, verbose) # Ces messages ne sont pas des messages de debug. # Ils peuvent donc etre affiches (uniquement si la sortie choisie est stdout ou stderr) -- GitLab