diff options
| author | Jarrod Millman <jarrod.millman@gmail.com> | 2019-04-04 12:49:24 -0700 |
|---|---|---|
| committer | Jarrod Millman <jarrod.millman@gmail.com> | 2019-04-04 12:49:24 -0700 |
| commit | ae7a5bd05eaf9e9acf0b2ef5ae30179cd7522a1f (patch) | |
| tree | b9a57d49a96b496e661ee52e743fe60a8d7b61e0 /examples/graph/expected_degree_sequence.py | |
| parent | bae9b8a554d486d75fc1989aac498c89e361a847 (diff) | |
| download | networkx-ae7a5bd05eaf9e9acf0b2ef5ae30179cd7522a1f.tar.gz | |
Ensure sphinx-gallery tries running all the examples
It only runs scripts starting w/ plot_ by default.
Diffstat (limited to 'examples/graph/expected_degree_sequence.py')
| -rw-r--r-- | examples/graph/expected_degree_sequence.py | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/examples/graph/expected_degree_sequence.py b/examples/graph/expected_degree_sequence.py deleted file mode 100644 index 78b5bf90..00000000 --- a/examples/graph/expected_degree_sequence.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python -""" -======================== -Expected Degree Sequence -======================== - -Random graph from given degree sequence. -""" -# Author: Aric Hagberg (hagberg@lanl.gov) - -# Copyright (C) 2006-2019 by -# Aric Hagberg <hagberg@lanl.gov> -# Dan Schult <dschult@colgate.edu> -# Pieter Swart <swart@lanl.gov> -# All rights reserved. -# BSD license. - -import networkx as nx -from networkx.generators.degree_seq import expected_degree_graph - -# make a random graph of 500 nodes with expected degrees of 50 -n = 500 # n nodes -p = 0.1 -w = [p * n for i in range(n)] # w = p*n for all nodes -G = expected_degree_graph(w) # configuration model -print("Degree histogram") -print("degree (#nodes) ****") -dh = nx.degree_histogram(G) -low = min(nx.degree(G)) -for i in range(low, len(dh)): - bar = ''.join(dh[i] * ['*']) - print("%2s (%2s) %s" % (i, dh[i], bar)) |
