Statistics
| Branch: | Revision:

## iof-tools / networkxMiCe / networkx-master / examples / graph / plot_erdos_renyi.py @ 5cef0f13

 1 ```# -*- coding: utf-8 -*- ``` ```#!/usr/bin/env python ``` ```""" ``` ```=========== ``` ```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. ``` ```""" ``` ```# Author: Aric Hagberg (hagberg@lanl.gov) ``` ```# Copyright (C) 2004-2019 by ``` ```# Aric Hagberg ``` ```# Dan Schult ``` ```# Pieter Swart ``` ```# All rights reserved. ``` ```# BSD license. ``` ```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('%s %d %f' % (v, nx.degree(G, v), nx.clustering(G, v))) ``` ```# print the adjacency list ``` ```for line in nx.generate_adjlist(G): ``` ``` print(line) ``` ```nx.draw(G) ``` ```plt.show() ```