From a3e197f7f71a154abad15f4c0329a90332ff2432 Mon Sep 17 00:00:00 2001 From: linlin Date: Tue, 6 Oct 2020 17:25:30 +0200 Subject: [PATCH] New translations test_sp_methods.py (Chinese Simplified) --- lang/zh/notebooks/tests/test_sp_methods.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 lang/zh/notebooks/tests/test_sp_methods.py diff --git a/lang/zh/notebooks/tests/test_sp_methods.py b/lang/zh/notebooks/tests/test_sp_methods.py new file mode 100644 index 0000000..b37a3fd --- /dev/null +++ b/lang/zh/notebooks/tests/test_sp_methods.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Test networkx shortest paths methods. +Created on Tue Oct 9 14:49:09 2018 + +@author: ljia +""" + +import networkx as nx + +g = nx.Graph() +g.add_edge(1, 2) +g.add_edge(3, 2) +g.add_edge(1, 4) +g.add_edge(3, 4) +p1 = nx.shortest_path(g, 1, 3) +p1 = [p1] +p2 = list(nx.all_shortest_paths(g, 1, 3)) +p1 += p2 +pr = [sp[::-1] for sp in p1] +nx.draw(g) \ No newline at end of file