diff options
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -27,15 +27,15 @@ Simple example Find the shortest path between two nodes in an undirected graph: -.. code:: python +.. code:: pycon >>> import networkx as nx >>> G = nx.Graph() - >>> G.add_edge('A', 'B', weight=4) - >>> G.add_edge('B', 'D', weight=2) - >>> G.add_edge('A', 'C', weight=3) - >>> G.add_edge('C', 'D', weight=4) - >>> nx.shortest_path(G, 'A', 'D', weight='weight') + >>> G.add_edge("A", "B", weight=4) + >>> G.add_edge("B", "D", weight=2) + >>> G.add_edge("A", "C", weight=3) + >>> G.add_edge("C", "D", weight=4) + >>> nx.shortest_path(G, "A", "D", weight="weight") ['A', 'B', 'D'] Install |