{
  "nbformat_minor": 0, 
  "nbformat": 4, 
  "cells": [
    {
      "execution_count": null, 
      "cell_type": "code", 
      "source": [
        "%matplotlib inline"
      ], 
      "outputs": [], 
      "metadata": {
        "collapsed": false
      }
    }, 
    {
      "source": [
        "\n# Erdos Renyi\n\n\nCreate an G{n,m} random graph with n nodes and m edges\nand report some properties.\n\nThis graph is sometimes called the Erd\u0151s-R\u00e9nyi graph\nbut is different from G{n,p} or binomial_graph which is also\nsometimes called the Erd\u0151s-R\u00e9nyi graph.\n\n"
      ], 
      "cell_type": "markdown", 
      "metadata": {}
    }, 
    {
      "execution_count": null, 
      "cell_type": "code", 
      "source": [
        "# Author: Aric Hagberg (hagberg@lanl.gov)\n\n#    Copyright (C) 2004-2017 by\n#    Aric Hagberg <hagberg@lanl.gov>\n#    Dan Schult <dschult@colgate.edu>\n#    Pieter Swart <swart@lanl.gov>\n#    All rights reserved.\n#    BSD license.\n\nimport sys\n\nimport matplotlib.pyplot as plt\nfrom networkx import nx\n\nn = 10  # 10 nodes\nm = 20  # 20 edges\n\nG = nx.gnm_random_graph(n, m)\n\n# some properties\nprint(\"node degree clustering\")\nfor v in nx.nodes(G):\n    print('%s %d %f' % (v, nx.degree(G, v), nx.clustering(G, v)))\n\n# print the adjacency list to terminal\ntry:\n    nx.write_adjlist(G, sys.stdout)\nexcept TypeError:  # Python 3.x\n    nx.write_adjlist(G, sys.stdout.buffer)\n\nnx.draw(G)\nplt.show()"
      ], 
      "outputs": [], 
      "metadata": {
        "collapsed": false
      }
    }
  ], 
  "metadata": {
    "kernelspec": {
      "display_name": "Python 2", 
      "name": "python2", 
      "language": "python"
    }, 
    "language_info": {
      "mimetype": "text/x-python", 
      "nbconvert_exporter": "python", 
      "name": "python", 
      "file_extension": ".py", 
      "version": "2.7.12", 
      "pygments_lexer": "ipython2", 
      "codemirror_mode": {
        "version": 2, 
        "name": "ipython"
      }
    }
  }
}