Mercurial > repos > shellac > sam_consensus_v3
view env/share/doc/networkx-2.5/examples/graph/plot_erdos_renyi.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
line wrap: on
line source
""" =========== Erdos Renyi =========== Create an G{n,m} random graph with n nodes and m edges and report some properties. This graph is sometimes called the Erdős-Rényi graph but is different from G{n,p} or binomial_graph which is also sometimes called the Erdős-Rényi graph. """ import matplotlib.pyplot as plt from networkx import nx n = 10 # 10 nodes m = 20 # 20 edges G = nx.gnm_random_graph(n, m) # some properties print("node degree clustering") for v in nx.nodes(G): print(f"{v} {nx.degree(G, v)} {nx.clustering(G, v)}") print() print("the adjacency list") for line in nx.generate_adjlist(G): print(line) nx.draw(G) plt.show()