diff options
| author | Jarrod Millman <jarrod.millman@gmail.com> | 2018-11-03 00:39:32 -0700 |
|---|---|---|
| committer | Jarrod Millman <jarrod.millman@gmail.com> | 2018-11-14 18:49:11 -0800 |
| commit | c19b4bc99704bce370192d5daa2eb182ea809ee5 (patch) | |
| tree | afdccb4f14a9c52fb42b6842632820d3c28eea07 /doc | |
| parent | e835fe3163ee56f3e53b0adb55f35e6187b37681 (diff) | |
| download | networkx-c19b4bc99704bce370192d5daa2eb182ea809ee5.tar.gz | |
Fix doctests
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/reference/introduction.rst | 2 | ||||
| -rw-r--r-- | doc/release/migration_guide_from_1.x_to_2.0.rst | 4 | ||||
| -rw-r--r-- | doc/tutorial.rst | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/doc/reference/introduction.rst b/doc/reference/introduction.rst index 6dd8cb2f..64182195 100644 --- a/doc/reference/introduction.rst +++ b/doc/reference/introduction.rst @@ -317,7 +317,7 @@ edges $(A, B)$ and $(B, C)$. >>> G.add_edge('A', 'B') >>> G.add_edge('B', 'C') >>> print(G.adj) - {'A': {'B': {}}, 'C': {'B': {}}, 'B': {'A': {}, 'C': {}}} + {'A': {'B': {}}, 'B': {'A': {}, 'C': {}}, 'C': {'B': {}}} The data structure gets morphed slightly for each base graph class. For DiGraph two dict-of-dicts-of-dicts structures are provided, one diff --git a/doc/release/migration_guide_from_1.x_to_2.0.rst b/doc/release/migration_guide_from_1.x_to_2.0.rst index a1878c5d..bdc29e5b 100644 --- a/doc/release/migration_guide_from_1.x_to_2.0.rst +++ b/doc/release/migration_guide_from_1.x_to_2.0.rst @@ -81,9 +81,9 @@ views. >>> H = nx.Graph() >>> H.add_nodes_from([1, 'networkx', '2.0']) >>> G.nodes & H.nodes # finding common nodes in 2 graphs - set([1]) + {1} >>> G.nodes | H.nodes # union of nodes in 2 graphs - set([0, 1, 2, 3, 4, 'networkx', '2.0']) + {0, 1, 2, 3, 4, 'networkx', '2.0'} Similarly, ``G.edges`` now returns an EdgeView instead of a list of edges and it also supports set operations. diff --git a/doc/tutorial.rst b/doc/tutorial.rst index c9125eaa..fdfc9302 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -137,7 +137,7 @@ better in other contexts. .. nbplot:: >>> list(G.nodes) - ['a', 1, 2, 3, 'spam', 'm', 'p', 's'] + [1, 2, 3, 'spam', 's', 'p', 'a', 'm'] >>> list(G.edges) [(1, 2), (1, 3), (3, 'm')] >>> list(G.adj[1]) # or list(G.neighbors(1)) @@ -296,7 +296,7 @@ Add node attributes using ``add_node()``, ``add_nodes_from()``, or ``G.nodes`` {'time': '5pm'} >>> G.nodes[1]['room'] = 714 >>> G.nodes.data() - NodeDataView({1: {'room': 714, 'time': '5pm'}, 3: {'time': '2pm'}}) + NodeDataView({1: {'time': '5pm', 'room': 714}, 3: {'time': '2pm'}}) Note that adding a node to ``G.nodes`` does not add it to the graph, use ``G.add_node()`` to add new nodes. Similarly for edges. @@ -450,7 +450,7 @@ functions such as: >>> G.add_edges_from([(1, 2), (1, 3)]) >>> G.add_node("spam") # adds node "spam" >>> list(nx.connected_components(G)) - [set([1, 2, 3]), set(['spam'])] + [{1, 2, 3}, {'spam'}] >>> sorted(d for n, d in G.degree()) [0, 1, 1, 2] >>> nx.clustering(G) @@ -463,7 +463,7 @@ These are easily stored in a `dict` structure if you desire. >>> sp = dict(nx.all_pairs_shortest_path(G)) >>> sp[3] - {1: [3, 1], 2: [3, 1, 2], 3: [3]} + {3: [3], 1: [3, 1], 2: [3, 1, 2]} See :doc:`/reference/algorithms/index` for details on graph algorithms supported. |
