diff options
author | Jarrod Millman <jarrod.millman@gmail.com> | 2020-12-03 09:25:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-03 09:25:04 -0800 |
commit | 41f94869573d9a0d0da318cd50a75c257bc0b7ef (patch) | |
tree | 21858d08596f9f87ab0678caee91e99ec5eb1024 /examples | |
parent | 5686e9a8e307f2d545f0df3bd2320b0cd4545165 (diff) | |
download | networkx-41f94869573d9a0d0da318cd50a75c257bc0b7ef.tar.gz |
Use str dunder (#4412)
Diffstat (limited to 'examples')
-rw-r--r-- | examples/drawing/plot_atlas.py | 2 | ||||
-rw-r--r-- | examples/drawing/plot_lanl_routes.py | 2 | ||||
-rw-r--r-- | examples/graph/dot_atlas.py | 4 | ||||
-rw-r--r-- | examples/graph/plot_roget.py | 2 | ||||
-rw-r--r-- | examples/graph/plot_words.py | 2 |
5 files changed, 5 insertions, 7 deletions
diff --git a/examples/drawing/plot_atlas.py b/examples/drawing/plot_atlas.py index 59ea54eb..ccdb50fe 100644 --- a/examples/drawing/plot_atlas.py +++ b/examples/drawing/plot_atlas.py @@ -59,7 +59,7 @@ def iso(G1, glist): G = atlas6() -print(f"graph has {nx.number_of_nodes(G)} nodes with {nx.number_of_edges(G)} edges") +print(G) print(nx.number_connected_components(G), "connected components") plt.figure(1, figsize=(8, 8)) diff --git a/examples/drawing/plot_lanl_routes.py b/examples/drawing/plot_lanl_routes.py index 7cab5a27..6f92afb7 100644 --- a/examples/drawing/plot_lanl_routes.py +++ b/examples/drawing/plot_lanl_routes.py @@ -47,7 +47,7 @@ def lanl_graph(): G = lanl_graph() -print(f"graph has {nx.number_of_nodes(G)} nodes with {nx.number_of_edges(G)} edges") +print(G) print(nx.number_connected_components(G), "connected components") plt.figure(figsize=(8, 8)) diff --git a/examples/graph/dot_atlas.py b/examples/graph/dot_atlas.py index 257336fb..58c324bc 100644 --- a/examples/graph/dot_atlas.py +++ b/examples/graph/dot_atlas.py @@ -13,9 +13,7 @@ from networkx.generators.atlas import graph_atlas_g atlas = graph_atlas_g()[0:20] for G in atlas: - print( - f"{G.name} has {nx.number_of_nodes(G)} nodes with {nx.number_of_edges(G)} edges" - ) + print(G) A = nx.nx_agraph.to_agraph(G) A.graph_attr["label"] = G.name # set default node attributes diff --git a/examples/graph/plot_roget.py b/examples/graph/plot_roget.py index 9f287a18..70023b47 100644 --- a/examples/graph/plot_roget.py +++ b/examples/graph/plot_roget.py @@ -65,7 +65,7 @@ def roget_graph(): G = roget_graph() print("Loaded roget_dat.txt containing 1022 categories.") -print(f"digraph has {nx.number_of_nodes(G)} nodes with {nx.number_of_edges(G)} edges") +print(G) UG = G.to_undirected() print(nx.number_connected_components(UG), "connected components") diff --git a/examples/graph/plot_words.py b/examples/graph/plot_words.py index 9b4eb42a..dddea7cd 100644 --- a/examples/graph/plot_words.py +++ b/examples/graph/plot_words.py @@ -62,7 +62,7 @@ def words_graph(): G = words_graph() print("Loaded words_dat.txt containing 5757 five-letter English words.") print("Two words are connected if they differ in one letter.") -print(f"Graph has {nx.number_of_nodes(G)} nodes with {nx.number_of_edges(G)} edges") +print(G) print(f"{nx.number_connected_components(G)} connected components") for (source, target) in [("chaos", "order"), ("nodes", "graph"), ("pound", "marks")]: |