[Python-modules-commits] [python-networkx] 01/10: Import python-networkx_1.11~rc2.orig.tar.gz

Sandro Tosi morph at moszumanska.debian.org
Thu Jan 28 20:07:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch master
in repository python-networkx.

commit 88a9a51215e3cb598723261c0815c2e02e7dfce4
Author: Sandro Tosi <morph at debian.org>
Date:   Thu Jan 28 19:42:42 2016 +0000

    Import python-networkx_1.11~rc2.orig.tar.gz
---
 PKG-INFO                                     |   4 +-
 doc/source/install.rst                       |   2 +-
 doc/source/reference/api_1.11.rst            |  12 ++-
 doc/source/reference/legal.rst               |   2 +-
 doc/source/reference/news.rst                |   1 +
 doc/source/tutorial/tutorial.rst             | 104 ++++++++++++-------------
 examples/advanced/heavy_metal_umlaut.py      |  10 +--
 examples/algorithms/blockmodel.py            |  17 ++--
 examples/algorithms/krackhardt_centrality.py |  10 +--
 examples/algorithms/rcm.py                   |   8 +-
 examples/basic/properties.py                 |   4 +-
 examples/basic/read_write.py                 |   9 ++-
 examples/drawing/atlas.py                    |  65 ++++++++--------
 examples/drawing/chess_masters.py            |  35 ++++-----
 examples/drawing/circular_tree.py            |  19 +++--
 examples/drawing/degree_histogram.py         |   7 +-
 examples/drawing/edge_colormap.py            |   8 +-
 examples/drawing/ego_graph.py                |   2 +-
 examples/drawing/four_grids.py               |  13 ++--
 examples/drawing/giant_component.py          |  38 +++++----
 examples/drawing/house_with_colors.py        |   2 +-
 examples/drawing/knuth_miles.py              |  13 ++--
 examples/drawing/labels_and_colors.py        |  10 +--
 examples/drawing/lanl_routes.py              |  60 +++++++-------
 examples/drawing/node_colormap.py            |   4 +-
 examples/drawing/sampson.py                  |   8 +-
 examples/drawing/unix_email.py               |  15 ++--
 examples/drawing/weighted_graph.py           |   4 +-
 examples/graph/atlas.py                      |  65 ++++++++--------
 examples/graph/atlas2.py                     |  25 +++---
 examples/graph/degree_sequence.py            |  10 +--
 examples/graph/erdos_renyi.py                |   6 +-
 examples/graph/expected_degree_sequence.py   |   5 +-
 examples/graph/football.py                   |   5 +-
 examples/graph/knuth_miles.py                |  13 ++--
 examples/graph/napoleon_russian_campaign.py  |  11 +--
 examples/graph/roget.py                      |  13 ++--
 examples/graph/unix_email.py                 |  15 ++--
 examples/graph/words.py                      |  13 ++--
 examples/javascript/force.py                 |   8 +-
 examples/multigraph/chess_masters.py         |  35 ++++-----
 examples/pygraphviz/pygraphviz_attributes.py |  17 ++--
 examples/pygraphviz/pygraphviz_draw.py       |  11 +--
 examples/pygraphviz/pygraphviz_simple.py     |  19 ++---
 examples/pygraphviz/write_dotfile.py         |  40 ++++++----
 examples/subclass/antigraph.py               |  22 +++---
 examples/subclass/printgraph.py              |  25 +++---
 networkx.egg-info/PKG-INFO                   |   4 +-
 networkx.egg-info/requires.txt               |   2 +-
 networkx/classes/graph.py                    |   9 ++-
 networkx/convert.py                          |   4 +-
 networkx/convert_matrix.py                   |   2 +-
 networkx/drawing/__init__.py                 |   4 +-
 networkx/drawing/layout.py                   |  12 +--
 networkx/drawing/nx_agraph.py                |  36 +++++----
 networkx/drawing/nx_pydot.py                 | 112 ++++++++++++---------------
 networkx/drawing/nx_pylab.py                 |   6 +-
 networkx/drawing/tests/test_agraph.py        |  14 ++--
 networkx/drawing/tests/test_pydot.py         |  31 ++++----
 networkx/release.py                          |   4 +-
 networkx/version.py                          |   8 +-
 61 files changed, 562 insertions(+), 530 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 55f4c91..30a5db9 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: networkx
-Version: 1.11rc1
+Version: 1.11rc2
 Summary: Python package for creating and manipulating graphs and networks
 Home-page: http://networkx.github.io/
 Author: NetworkX Developers
@@ -25,7 +25,7 @@ Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/doc/source/install.rst b/doc/source/install.rst
index 51fa953..87c55ce 100644
--- a/doc/source/install.rst
+++ b/doc/source/install.rst
@@ -151,7 +151,7 @@ In conjunction with either
 
       or
 
-      - pydot: http://code.google.com/p/pydot/
+      - pydotplus: https://github.com/carlos-jenkins/pydotplus
 
 provides graph drawing and graph layout algorithms.
 
diff --git a/doc/source/reference/api_1.11.rst b/doc/source/reference/api_1.11.rst
index b45a2ea..5940559 100644
--- a/doc/source/reference/api_1.11.rst
+++ b/doc/source/reference/api_1.11.rst
@@ -10,12 +10,22 @@ Please send comments and questions to the networkx-discuss mailing list:
 
 API changes
 -----------
+* [`#1930 <https://github.com/networkx/networkx/pull/1930>`_] 
+  No longer import nx_agraph and nx_pydot into the top-level namespace.
+  They can be accessed within networkx as e.g. ``nx.nx_agraph.write_dot``
+  or imported as ``from networkx.drawing.nx_agraph import write_dot``.
 
 * [`#1750 <https://github.com/networkx/networkx/pull/1750>`_]
   Arguments center and scale are now available for all layout functions.
   The defaul values revert to the v1.9 values (center is the origin
   for circular layouts and domain is [0, scale) for others.
 
+* [`#1924 <https://github.com/networkx/networkx/pull/1924>`_]
+  Replace pydot with pydotplus for drawing with the pydot interface.
+
+* [`#1888 <https://github.com/networkx/networkx/pull/1888>`_]
+  Replace support for Python3.2 with support for Python 3.5.
+
 Miscellaneous changes
 ---------------------
 
@@ -23,7 +33,7 @@ Miscellaneous changes
   Set up appveyor to automatically test installation on Windows machines.
   Remove symbolic links in examples to help such istallation.
 
-Change many doc_string typos to allow sphinx 
+Change many doc_string typos to allow sphinx
 to build the docs without errors or warnings. 
 
 Enable the docs to be automatically built on 
diff --git a/doc/source/reference/legal.rst b/doc/source/reference/legal.rst
index 4b9c4fc..dd4a2f8 100644
--- a/doc/source/reference/legal.rst
+++ b/doc/source/reference/legal.rst
@@ -4,7 +4,7 @@ NetworkX is distributed with the BSD license.
 
 ::
 
-   Copyright (C) 2004-2012, NetworkX Developers
+   Copyright (C) 2004-2016, NetworkX Developers
    Aric Hagberg <hagberg at lanl.gov>
    Dan Schult <dschult at colgate.edu>
    Pieter Swart <swart at lanl.gov>
diff --git a/doc/source/reference/news.rst b/doc/source/reference/news.rst
index 2773252..2d2a101 100644
--- a/doc/source/reference/news.rst
+++ b/doc/source/reference/news.rst
@@ -12,6 +12,7 @@ Support for Python 3.5 added, drop support for Python 3.2.
 
 Highlights
 ~~~~~~~~~~
+Pydot features now use pydotplus.
 Fixes installation on some machines and test with appveyor, 
 Restores default center and scale of layout routines,
 Fixes various docs including no symbolic links in examples.
diff --git a/doc/source/tutorial/tutorial.rst b/doc/source/tutorial/tutorial.rst
index 351759a..f52e84f 100644
--- a/doc/source/tutorial/tutorial.rst
+++ b/doc/source/tutorial/tutorial.rst
@@ -18,14 +18,14 @@ along with identified pairs of nodes (called edges, links, etc).
 In NetworkX, nodes can be any hashable object e.g. a text string, an
 image, an XML object, another Graph, a customized node object, etc.
 (Note: Python's None object should not be used as a node as it
-determines whether optional function arguments have been assigned 
+determines whether optional function arguments have been assigned
 in many functions.)
 
 Nodes
 -----
 
 The graph G can be grown in several ways.
-NetworkX includes many graph generator functions 
+NetworkX includes many graph generator functions
 and facilities to read and write graphs in many formats.
 To get started though we'll look at simple manipulations.
 You can add one node at a time,
@@ -38,14 +38,14 @@ add a list of nodes,
 
 or add any :term:`nbunch` of nodes.
 An *nbunch* is any iterable container
-of nodes that is not itself a node 
+of nodes that is not itself a node
 in the graph. (e.g. a list, set, graph, file, etc..)
 
 >>> H=nx.path_graph(10)
 >>> G.add_nodes_from(H)
 
 Note that G now contains the nodes of H as nodes of G.
-In contrast, you could use the graph H as a node in G. 
+In contrast, you could use the graph H as a node in G.
 
 >>> G.add_node(H)
 
@@ -56,7 +56,7 @@ thinking about how to structure your application so that
 the nodes are useful entities.  Of course you can always
 use a unique identifier in G and have a separate dictionary
 keyed by identifier to the node information if you prefer.
-(Note: You should not change the node object if the hash 
+(Note: You should not change the node object if the hash
 depends on its contents.)
 
 Edges
@@ -68,24 +68,24 @@ G can also be grown by adding one edge at a time,
 >>> e=(2,3)
 >>> G.add_edge(*e) # unpack edge tuple*
 
-by adding a list of edges, 
+by adding a list of edges,
 
 >>> G.add_edges_from([(1,2),(1,3)])
 
 or by adding any :term:`ebunch` of edges.
 An *ebunch* is any iterable container
 of edge-tuples.  An edge-tuple can be a 2-tuple
-of nodes or a 3-tuple with 2 nodes followed by 
+of nodes or a 3-tuple with 2 nodes followed by
 an edge attribute dictionary, e.g. (2,3,{'weight':3.1415}).
 Edge attributes are discussed further below
 
 >>> G.add_edges_from(H.edges())
 
-One can demolish the graph in a similar fashion; using 
+One can demolish the graph in a similar fashion; using
 :meth:`Graph.remove_node`,
-:meth:`Graph.remove_nodes_from`, 
+:meth:`Graph.remove_nodes_from`,
 :meth:`Graph.remove_edge`
-and 
+and
 :meth:`Graph.remove_edges_from`, e.g.
 
 >>> G.remove_node(H)
@@ -128,13 +128,13 @@ Removing nodes or edges has similar syntax to adding:
 >>> G.remove_edge(1,3)
 
 When creating a graph structure by instantiating one of the graph
-classes you can specify data in several formats.  
+classes you can specify data in several formats.
 
 >>> H=nx.DiGraph(G)   # create a DiGraph using the connections from G
 >>> H.edges()
 [(1, 2), (2, 1)]
 >>> edgelist=[(0,1),(1,2),(2,3)]
->>> H=nx.Graph(edgelist) 
+>>> H=nx.Graph(edgelist)
 
 What to use as nodes and edges
 ------------------------------
@@ -144,12 +144,12 @@ edges. The most common choices are numbers or strings, but a node can
 be any hashable object (except None), and an edge can be associated
 with any object x using G.add_edge(n1,n2,object=x).
 
-As an example, n1 and n2 could be protein objects from the RCSB Protein 
-Data Bank, and x could refer to an XML record of publications detailing 
-experimental observations of their interaction. 
+As an example, n1 and n2 could be protein objects from the RCSB Protein
+Data Bank, and x could refer to an XML record of publications detailing
+experimental observations of their interaction.
 
 We have found this power quite useful, but its abuse
-can lead to unexpected surprises unless one is familiar with Python. 
+can lead to unexpected surprises unless one is familiar with Python.
 If in doubt, consider using :func:`convert_node_labels_to_integers` to obtain
 a more traditional graph with integer labels.
 
@@ -157,20 +157,20 @@ a more traditional graph with integer labels.
 Accessing edges
 ---------------
 
-In addition to the methods 
-:meth:`Graph.nodes`, 
-:meth:`Graph.edges`, and 
+In addition to the methods
+:meth:`Graph.nodes`,
+:meth:`Graph.edges`, and
 :meth:`Graph.neighbors`,
 iterator versions (e.g. :meth:`Graph.edges_iter`) can save you from
-creating large lists when you are just going to iterate 
+creating large lists when you are just going to iterate
 through them anyway.
 
 Fast direct access to the graph data structure is also possible
 using subscript notation.
 
 .. Warning::
-   Do not change the returned dict--it is part of 
-   the graph data structure and direct manipulation may leave the 
+   Do not change the returned dict--it is part of
+   the graph data structure and direct manipulation may leave the
    graph in an inconsistent state.
 
 >>> G[1]  # Warning: do not change the resulting dict
@@ -213,7 +213,7 @@ Python object you like, can be attached to graphs, nodes, or edges.
 Each graph, node, and edge can hold key/value attribute pairs
 in an associated attribute dictionary (the keys must be hashable).
 By default these are empty, but attributes can be added or changed using
-add_edge, add_node or direct manipulation of the attribute 
+add_edge, add_node or direct manipulation of the attribute
 dictionaries named G.graph, G.node and G.edge for a graph G.
 
 
@@ -269,14 +269,14 @@ Directed graphs
 ---------------
 
 The :class:`DiGraph` class provides additional methods specific to directed
-edges, e.g. 
-:meth:`DiGraph.out_edges`, 
-:meth:`DiGraph.in_degree`, 
-:meth:`DiGraph.predecessors`, 
-:meth:`DiGraph.successors` etc.  
-To allow algorithms to work with both classes easily, the directed 
-versions of neighbors() and degree() are equivalent to successors() 
-and the sum of in_degree() and out_degree() respectively even though 
+edges, e.g.
+:meth:`DiGraph.out_edges`,
+:meth:`DiGraph.in_degree`,
+:meth:`DiGraph.predecessors`,
+:meth:`DiGraph.successors` etc.
+To allow algorithms to work with both classes easily, the directed
+versions of neighbors() and degree() are equivalent to successors()
+and the sum of in_degree() and out_degree() respectively even though
 that may feel inconsistent at times.
 
 >>> DG=nx.DiGraph()
@@ -340,7 +340,7 @@ can also be generated by
     disjoint_union(G1,G2)    - graph union assuming all nodes are different
     cartesian_product(G1,G2) - return Cartesian product graph
     compose(G1,G2)           - combine graphs identifying nodes common to both
-    complement(G)            - graph complement 
+    complement(G)            - graph complement
     create_empty_copy(G)     - return an empty copy of the same graph class
     convert_to_undirected(G) - return an undirected representation of G
     convert_to_directed(G)   - return a directed representation of G
@@ -359,7 +359,7 @@ can also be generated by
 >>> K_3_5=nx.complete_bipartite_graph(3,5)
 >>> barbell=nx.barbell_graph(10,10)
 >>> lollipop=nx.lollipop_graph(10,20)
- 
+
 4. Using a stochastic graph generator, e.g.
 
 >>> er=nx.erdos_renyi_graph(100,0.15)
@@ -367,21 +367,21 @@ can also be generated by
 >>> ba=nx.barabasi_albert_graph(100,5)
 >>> red=nx.random_lobster(100,0.9,0.9)
 
-5. Reading a graph stored in a file using common graph formats, 
+5. Reading a graph stored in a file using common graph formats,
    such as edge lists, adjacency lists, GML, GraphML, pickle, LEDA and others.
 
 >>> nx.write_gml(red,"path.to.file")
 >>> mygraph=nx.read_gml("path.to.file")
 
-Details on graph formats: :doc:`/reference/readwrite` 
+Details on graph formats: :doc:`/reference/readwrite`
 
-Details on graph generator functions: :doc:`/reference/generators` 
+Details on graph generator functions: :doc:`/reference/generators`
 
 
-Analyzing graphs 
+Analyzing graphs
 ----------------
 
-The structure of G can be analyzed using various graph-theoretic 
+The structure of G can be analyzed using various graph-theoretic
 functions such as:
 
 >>> G=nx.Graph()
@@ -402,11 +402,11 @@ Functions that return node properties return dictionaries keyed by node label.
 >>> nx.degree(G)
 {1: 2, 2: 1, 3: 1, 'spam': 0}
 
-For values of specific nodes, you can provide a single node or an nbunch 
-of nodes as argument.  If a single node is specified, then a single value 
-is returned.  If an nbunch is specified, then the function will 
+For values of specific nodes, you can provide a single node or an nbunch
+of nodes as argument.  If a single node is specified, then a single value
+is returned.  If an nbunch is specified, then the function will
 return a dictionary.
- 
+
 >>> nx.degree(G,1)
 2
 >>> G.degree(1)
@@ -425,11 +425,11 @@ Details on graph algorithms supported: :doc:`/reference/algorithms`
 Drawing graphs
 --------------
 
-NetworkX is not primarily a graph drawing package but 
+NetworkX is not primarily a graph drawing package but
 basic drawing with Matplotlib as well as an interface to use the
-open source Graphviz software package are included.  
+open source Graphviz software package are included.
 These are part of the networkx.drawing package
-and will be imported if possible. 
+and will be imported if possible.
 See :doc:`/reference/drawing` for details.
 
 Note that the drawing package in NetworkX is not yet compatible with
@@ -439,11 +439,11 @@ First import Matplotlib's plot interface (pylab works too)
 
 >>> import matplotlib.pyplot as plt
 
-You may find it useful to interactively test code using "ipython -pylab", 
+You may find it useful to interactively test code using "ipython -pylab",
 which combines the power of ipython and matplotlib and provides a convenient
 interactive mode.
 
-To test if the import of networkx.drawing was successful 
+To test if the import of networkx.drawing was successful
 draw G using one of
 
 >>> nx.draw(G)
@@ -451,12 +451,12 @@ draw G using one of
 >>> nx.draw_circular(G)
 >>> nx.draw_spectral(G)
 
-when drawing to an interactive display. 
-Note that you may need to issue a Matplotlib 
+when drawing to an interactive display.
+Note that you may need to issue a Matplotlib
 
->>> plt.show() 
+>>> plt.show()
 
-command if you are not using matplotlib in interactive mode: (See 
+command if you are not using matplotlib in interactive mode: (See
 `Matplotlib FAQ <http://matplotlib.org/faq/installing_faq.html#matplotlib-compiled-fine-but-nothing-shows-up-when-i-use-it>`_
 )
 
@@ -466,7 +466,7 @@ To save drawings to a file, use, for example
 >>> plt.savefig("path.png")
 
 writes to the file "path.png" in the local directory. If Graphviz
-and PyGraphviz, or pydot, are available on your system, you can also use
+and PyGraphviz, or pydotplus, are available on your system, you can also use
 
 >>> nx.draw_graphviz(G)
 >>> nx.write_dot(G,'file.dot')
diff --git a/examples/advanced/heavy_metal_umlaut.py b/examples/advanced/heavy_metal_umlaut.py
index 1f45cf4..9055771 100644
--- a/examples/advanced/heavy_metal_umlaut.py
+++ b/examples/advanced/heavy_metal_umlaut.py
@@ -1,17 +1,15 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-Example using unicode strings as graph labels.  
+Example using unicode strings as graph labels.
 
 Also shows creative use of the Heavy Metal Umlaut:
 http://en.wikipedia.org/wiki/Heavy_metal_umlaut
 
 """
-__author__ = """Aric Hagberg (hagberg at lanl.gov)"""
-__date__ = ""
-__credits__ = """"""
-__revision__ = ""
-#    Copyright (C) 2006 by 
+# Author: Aric Hagberg (hagberg at lanl.gov)
+
+#    Copyright (C) 2006-2016 by
 #    Aric Hagberg <hagberg at lanl.gov>
 #    Dan Schult <dschult at colgate.edu>
 #    Pieter Swart <swart at lanl.gov>
diff --git a/examples/algorithms/blockmodel.py b/examples/algorithms/blockmodel.py
index 94506f2..2fed347 100644
--- a/examples/algorithms/blockmodel.py
+++ b/examples/algorithms/blockmodel.py
@@ -18,9 +18,7 @@ Example of creating a block model using the blockmodel function in NX.  Data use
 }
 
 """
-
-__author__ = """\n""".join(['Drew Conway <drew.conway at nyu.edu>',
-                            'Aric Hagberg <hagberg at lanl.gov>'])
+# Authors:  Drew Conway <drew.conway at nyu.edu>, Aric Hagberg <hagberg at lanl.gov>
 
 from collections import defaultdict
 import networkx as nx
@@ -41,8 +39,8 @@ def create_hc(G):
     Y=distance.squareform(distances)
     Z=hierarchy.complete(Y)  # Creates HC using farthest point linkage
     # This partition selection is arbitrary, for illustrive purposes
-    membership=list(hierarchy.fcluster(Z,t=1.15)) 
-    # Create collection of lists for blockmodel 
+    membership=list(hierarchy.fcluster(Z,t=1.15))
+    # Create collection of lists for blockmodel
     partition=defaultdict(list)
     for n,p in zip(list(range(len(G))),membership):
         partition[p].append(n)
@@ -50,16 +48,16 @@ def create_hc(G):
 
 if __name__ == '__main__':
     G=nx.read_edgelist("hartford_drug.edgelist")
-    
+
     # Extract largest connected component into graph H
     H=nx.connected_component_subgraphs(G)[0]
     # Makes life easier to have consecutively labeled integer nodes
-    H=nx.convert_node_labels_to_integers(H) 
+    H=nx.convert_node_labels_to_integers(H)
     # Create parititions with hierarchical clustering
     partitions=create_hc(H)
     # Build blockmodel graph
     BM=nx.blockmodel(H,partitions)
-    
+
 
     # Draw original graph
     pos=nx.spring_layout(H,iterations=100)
@@ -83,6 +81,3 @@ if __name__ == '__main__':
     plt.ylim(0,1)
     plt.axis('off')
     plt.savefig('hartford_drug_block_model.png')
-    
-    
-    
diff --git a/examples/algorithms/krackhardt_centrality.py b/examples/algorithms/krackhardt_centrality.py
index 3e49b6a..71dee8f 100644
--- a/examples/algorithms/krackhardt_centrality.py
+++ b/examples/algorithms/krackhardt_centrality.py
@@ -2,11 +2,11 @@
 """
 Centrality measures of Krackhardt social network.
 """
-__author__ = """Aric Hagberg (hagberg at lanl.gov)"""
-__date__ = "$Date: 2005-05-12 14:33:11 -0600 (Thu, 12 May 2005) $"
-__credits__ = """"""
-__revision__ = "$Revision: 998 $"
-#    Copyright (C) 2004 by 
+# Author: Aric Hagberg (hagberg at lanl.gov)
+# Date: 2005-05-12 14:33:11 -0600 (Thu, 12 May 2005)
+# Revision: 998
+
+#    Copyright (C) 2004-2016 by
 #    Aric Hagberg <hagberg at lanl.gov>
 #    Dan Schult <dschult at colgate.edu>
 #    Pieter Swart <swart at lanl.gov>
diff --git a/examples/algorithms/rcm.py b/examples/algorithms/rcm.py
index 54418a2..43fa56f 100644
--- a/examples/algorithms/rcm.py
+++ b/examples/algorithms/rcm.py
@@ -1,9 +1,9 @@
 # Cuthill-McKee ordering of matrices
-# The reverse Cuthill-McKee algorithm gives a sparse matrix ordering that 
+# The reverse Cuthill-McKee algorithm gives a sparse matrix ordering that
 # reduces the matrix bandwidth.
 # Requires NumPy
-# Copyright (C) 2011 by 
-# Aric Hagberg <aric.hagberg at gmail.com>
+# Copyright (C) 2011-2016 by
+# Author:    Aric Hagberg <aric.hagberg at gmail.com>
 # BSD License
 import networkx as nx
 from networkx.utils import reverse_cuthill_mckee_ordering
@@ -11,7 +11,7 @@ import numpy as np
 
 # build low-bandwidth numpy matrix
 G=nx.grid_2d_graph(3,3)
-rcm = list(reverse_cuthill_mckee_ordering(G))    
+rcm = list(reverse_cuthill_mckee_ordering(G))
 print("ordering",rcm)
 
 print("unordered Laplacian matrix")
diff --git a/examples/basic/properties.py b/examples/basic/properties.py
index 31e4f03..9ac87f8 100644
--- a/examples/basic/properties.py
+++ b/examples/basic/properties.py
@@ -2,7 +2,7 @@
 """
 Compute some network properties for the lollipop graph.
 """
-#    Copyright (C) 2004 by 
+#    Copyright (C) 2004-2016 by
 #    Aric Hagberg <hagberg at lanl.gov>
 #    Dan Schult <dschult at colgate.edu>
 #    Pieter Swart <swart at lanl.gov>
@@ -25,7 +25,7 @@ for v in G.nodes():
 print('')
 print("average shortest path length %s" % (sum(pathlengths)/len(pathlengths)))
 
-# histogram of path lengths 
+# histogram of path lengths
 dist={}
 for p in pathlengths:
     if p in dist:
diff --git a/examples/basic/read_write.py b/examples/basic/read_write.py
index 644aadb..37db0cd 100644
--- a/examples/basic/read_write.py
+++ b/examples/basic/read_write.py
@@ -2,8 +2,9 @@
 """
 Read and write graphs.
 """
-__author__ = """Aric Hagberg (hagberg at lanl.gov)"""
-#    Copyright (C) 2004-2015 by 
+# Author: Aric Hagberg (hagberg at lanl.gov)
+
+#    Copyright (C) 2004-2016 by
 #    Aric Hagberg <hagberg at lanl.gov>
 #    Dan Schult <dschult at colgate.edu>
 #    Pieter Swart <swart at lanl.gov>
@@ -18,7 +19,7 @@ try: # Python 2.6+
 except TypeError: # Python 3.x
     write_adjlist(G,sys.stdout.buffer) # write adjacency list to screen
 # write edgelist to grid.edgelist
-write_edgelist(G,path="grid.edgelist",delimiter=":") 
+write_edgelist(G,path="grid.edgelist",delimiter=":")
 # read edgelist from grid.edgelist
-H=read_edgelist(path="grid.edgelist",delimiter=":") 
+H=read_edgelist(path="grid.edgelist",delimiter=":")
 
diff --git a/examples/drawing/atlas.py b/examples/drawing/atlas.py
index ce55efa..418ac63 100644
--- a/examples/drawing/atlas.py
+++ b/examples/drawing/atlas.py
@@ -3,8 +3,9 @@
 Atlas of all graphs of 6 nodes or less.
 
 """
-__author__ = """Aric Hagberg (hagberg at lanl.gov)"""
-#    Copyright (C) 2004 by 
+# Author: Aric Hagberg (hagberg at lanl.gov)
+
+#    Copyright (C) 2004-2016 by
 #    Aric Hagberg <hagberg at lanl.gov>
 #    Dan Schult <dschult at colgate.edu>
 #    Pieter Swart <swart at lanl.gov>
@@ -21,60 +22,62 @@ def atlas6():
         Attempt to check for isomorphisms and remove.
     """
 
-    Atlas=graph_atlas_g()[0:208] # 208
+    Atlas = graph_atlas_g()[0:208] # 208
     # remove isolated nodes, only connected graphs are left
-    U=nx.Graph() # graph for union of all graphs in atlas
-    for G in Atlas: 
-        zerodegree=[n for n in G if G.degree(n)==0]
+    U = nx.Graph() # graph for union of all graphs in atlas
+    for G in Atlas:
+        zerodegree = [n for n in G if G.degree(n)==0]
         for n in zerodegree:
             G.remove_node(n)
-        U=nx.disjoint_union(U,G)
+        U = nx.disjoint_union(U, G)
+
+    # list of graphs of all connected components
+    C = nx.connected_component_subgraphs(U)
 
-    # list of graphs of all connected components        
-    C=nx.connected_component_subgraphs(U)        
-    
-    UU=nx.Graph()        
-    # do quick isomorphic-like check, not a true isomorphism checker     
-    nlist=[] # list of nonisomorphic graphs
+    UU = nx.Graph()
+    # do quick isomorphic-like check, not a true isomorphism checker
+    nlist = [] # list of nonisomorphic graphs
     for G in C:
         # check against all nonisomorphic graphs so far
-        if not iso(G,nlist):
+        if not iso(G, nlist):
             nlist.append(G)
-            UU=nx.disjoint_union(UU,G) # union the nonisomorphic graphs  
-    return UU            
+            UU = nx.disjoint_union(UU, G) # union the nonisomorphic graphs
+    return UU
 
 def iso(G1, glist):
     """Quick and dirty nonisomorphism checker used to check isomorphisms."""
     for G2 in glist:
-        if isomorphic(G1,G2):
+        if isomorphic(G1, G2):
             return True
-    return False        
+    return False
 
 
 if __name__ == '__main__':
-
-    import networkx as nx
-
     G=atlas6()
 
     print("graph has %d nodes with %d edges"\
-          %(nx.number_of_nodes(G),nx.number_of_edges(G)))
-    print(nx.number_connected_components(G),"connected components")
-
+          %(nx.number_of_nodes(G), nx.number_of_edges(G)))
+    print(nx.number_connected_components(G), "connected components")
 
     try:
-        from networkx import graphviz_layout
+        import pygraphviz
+        from networkx.drawing.nx_agraph import graphviz_layout
     except ImportError:
-        raise ImportError("This example needs Graphviz and either PyGraphviz or Pydot")
+        try:
+            import pydotplus
+            from networkx.drawing.nx_pydot import graphviz_layout
+        except ImportError:
+            raise ImportError("This example needs Graphviz and either "
+                              "PyGraphviz or PyDotPlus")
 
     import matplotlib.pyplot as plt
-    plt.figure(1,figsize=(8,8))
+    plt.figure(1, figsize=(8, 8))
     # layout graphs with positions using graphviz neato
-    pos=nx.graphviz_layout(G,prog="neato")
+    pos = graphviz_layout(G, prog="neato")
     # color nodes the same in each connected subgraph
-    C=nx.connected_component_subgraphs(G)
+    C = nx.connected_component_subgraphs(G)
     for g in C:
-        c=[random.random()]*nx.number_of_nodes(g) # random color...
+        c = [random.random()] * nx.number_of_nodes(g) # random color...
         nx.draw(g,
              pos,
              node_size=40,
@@ -83,4 +86,4 @@ if __name__ == '__main__':
              vmax=1.0,
              with_labels=False
              )
-    plt.savefig("atlas.png",dpi=75)   
+    plt.savefig("atlas.png", dpi=75)
diff --git a/examples/drawing/chess_masters.py b/examples/drawing/chess_masters.py
index fe8e2d1..76e8ae6 100644
--- a/examples/drawing/chess_masters.py
+++ b/examples/drawing/chess_masters.py
@@ -3,8 +3,8 @@
 """
 An example of the MultiDiGraph clas
 
-The function chess_pgn_graph reads a collection of chess 
-matches stored in the specified PGN file 
+The function chess_pgn_graph reads a collection of chess
+matches stored in the specified PGN file
 (PGN ="Portable Game Notation")
 Here the (compressed) default file ---
  chess_masters_WCC.pgn.bz2 ---
@@ -12,9 +12,9 @@ contains all 685 World Chess Championship matches
 from 1886 - 1985.
 (data from http://chessproblem.my-free-games.com/chess/games/Download-PGN.php)
 
-The chess_pgn_graph() function returns a MultiDiGraph 
-with multiple edges. Each node is 
-the last name of a chess master. Each edge is directed 
+The chess_pgn_graph() function returns a MultiDiGraph
+with multiple edges. Each node is
+the last name of a chess master. Each edge is directed
 from white to black and contains selected game info.
 
 The key statement in chess_pgn_graph below is
@@ -22,7 +22,7 @@ The key statement in chess_pgn_graph below is
 where game_info is a dict describing each game.
 
 """
-#    Copyright (C) 2006-2010 by 
+#    Copyright (C) 2006-2016 by
 #    Aric Hagberg <hagberg at lanl.gov>
 #    Dan Schult <dschult at colgate.edu>
 #    Pieter Swart <swart at lanl.gov>
@@ -31,19 +31,19 @@ where game_info is a dict describing each game.
 
 import networkx as nx
 
-# tag names specifying what game info should be 
+# tag names specifying what game info should be
 # stored in the dict on each digraph edge
-game_details=["Event", 
-              "Date", 
-              "Result", 
+game_details=["Event",
+              "Date",
+              "Result",
               "ECO",
               "Site"]
 
 def chess_pgn_graph(pgn_file="chess_masters_WCC.pgn.bz2"):
     """Read chess games in pgn format in pgn_file.
-    
+
     Filenames ending in .gz or .bz2 will be uncompressed.
-    
+
     Return the MultiDiGraph of players connected by a chess game.
     Edges contain game data in a dict.
 
@@ -58,7 +58,7 @@ def chess_pgn_graph(pgn_file="chess_masters_WCC.pgn.bz2"):
             tag,value=line[1:-1].split(' ',1)
             game[str(tag)]=value.strip('"')
         else:
-        # empty line after tag set indicates 
+        # empty line after tag set indicates
         # we finished reading game info
             if game:
                 white=game.pop('White')
@@ -69,9 +69,6 @@ def chess_pgn_graph(pgn_file="chess_masters_WCC.pgn.bz2"):
 
 
 if __name__ == '__main__':
-    import networkx as nx
-
-
     G=chess_pgn_graph()
 
     ngames=G.number_of_edges()
@@ -85,10 +82,10 @@ if __name__ == '__main__':
     Gcc=list(nx.connected_component_subgraphs(G.to_undirected()))
     if len(Gcc)>1:
         print("Note the disconnected component consisting of:")
-        print(Gcc[1].nodes())    
+        print(Gcc[1].nodes())
 
     # find all games with B97 opening (as described in ECO)
-    openings=set([game_info['ECO'] 
+    openings=set([game_info['ECO']
                   for (white,black,game_info) in G.edges(data=True)])
     print("\nFrom a total of %d different openings,"%len(openings))
     print('the following games used the Sicilian opening')
@@ -129,7 +126,7 @@ if __name__ == '__main__':
         else:
             wins[v]+=1.0
     try:
-        pos=nx.graphviz_layout(H)
+        pos=nx.nx_agraph.graphviz_layout(H)
     except:
         pos=nx.spring_layout(H,iterations=20)
 
diff --git a/examples/drawing/circular_tree.py b/examples/drawing/circular_tree.py
index 2a735a0..77216bd 100644
--- a/examples/drawing/circular_tree.py
+++ b/examples/drawing/circular_tree.py
@@ -2,15 +2,20 @@ import networkx as nx
 import matplotlib.pyplot as plt
 
 try:
-    from networkx import graphviz_layout
+    import pygraphviz
+    from networkx.drawing.nx_agraph import graphviz_layout
 except ImportError:
-    raise ImportError("This example needs Graphviz and either PyGraphviz or Pydot")
+    try:
+        import pydotplus
+        from networkx.drawing.nx_pydot import graphviz_layout
+    except ImportError:
+        raise ImportError("This example needs Graphviz and either "
+                          "PyGraphviz or PyDotPlus")
 
-
-G=nx.balanced_tree(3,5)
-pos=nx.graphviz_layout(G,prog='twopi',args='')
-plt.figure(figsize=(8,8))
-nx.draw(G,pos,node_size=20,alpha=0.5,node_color="blue", with_labels=False)
+G = nx.balanced_tree(3, 5)
+pos = graphviz_layout(G, prog='twopi', args='')
+plt.figure(figsize=(8, 8))
+nx.draw(G, pos, node_size=20, alpha=0.5, node_color="blue", with_labels=False)
 plt.axis('equal')
 plt.savefig('circular_tree.png')
 plt.show()
diff --git a/examples/drawing/degree_histogram.py b/examples/drawing/degree_histogram.py
index 0827c1f..a6dd874 100644
--- a/examples/drawing/degree_histogram.py
+++ b/examples/drawing/degree_histogram.py
@@ -3,9 +3,10 @@
 Random graph from given degree sequence.
 Draw degree rank plot and graph with matplotlib.
 """
-__author__ = """Aric Hagberg <aric.hagberg at gmail.com>"""
-import networkx as nx
+# Author: Aric Hagberg <aric.hagberg at gmail.com>
 import matplotlib.pyplot as plt
+import networkx as nx
+
 G = nx.gnp_random_graph(100,0.02)
 
 degree_sequence=sorted(nx.degree(G).values(),reverse=True) # degree sequence
@@ -17,7 +18,7 @@ plt.title("Degree rank plot")
 plt.ylabel("degree")
 plt.xlabel("rank")
 
-# draw graph in inset 
+# draw graph in inset
 plt.axes([0.45,0.45,0.45,0.45])
 Gcc=sorted(nx.connected_component_subgraphs(G), key = len, reverse=True)[0]
 pos=nx.spring_layout(Gcc)
diff --git a/examples/drawing/edge_colormap.py b/examples/drawing/edge_colormap.py
index 56f0b8a..a2aa7a3 100644
--- a/examples/drawing/edge_colormap.py
+++ b/examples/drawing/edge_colormap.py
@@ -3,17 +3,17 @@
 Draw a graph with matplotlib, color edges.
 You must have matplotlib>=87.7 for this to work.
 """
-__author__ = """Aric Hagberg (hagberg at lanl.gov)"""
+# Author: Aric Hagberg (hagberg at lanl.gov)
 try:
     import matplotlib.pyplot as plt
 except:
     raise
-    
+
 import networkx as nx
 
-G=nx.star_graph(20)  
+G=nx.star_graph(20)
 pos=nx.spring_layout(G)
-colors=range(20) 
+colors=range(20)
 nx.draw(G,pos,node_color='#A0CBE2',edge_color=colors,width=4,edge_cmap=plt.cm.Blues,with_labels=False)
 plt.savefig("edge_colormap.png") # save as png
 plt.show() # display
diff --git a/examples/drawing/ego_graph.py b/examples/drawing/ego_graph.py
index 81305e6..e109273 100644
--- a/examples/drawing/ego_graph.py
+++ b/examples/drawing/ego_graph.py
@@ -4,7 +4,7 @@
 Example using the NetworkX ego_graph() function to return the main egonet of 
 the largest hub in a Barabási-Albert network.
 """
-__author__="""Drew Conway (drew.conway at nyu.edu)"""
+# Author:  Drew Conway (drew.conway at nyu.edu)
 
 from operator import itemgetter
 import networkx as nx
diff --git a/examples/drawing/four_grids.py b/examples/drawing/four_grids.py
index f04918c..1120191 100644
--- a/examples/drawing/four_grids.py
+++ b/examples/drawing/four_grids.py
@@ -3,8 +3,9 @@
 Draw a graph with matplotlib.
 You must have matplotlib for this to work.
 """
-__author__ = """Aric Hagberg (hagberg at lanl.gov)"""
-#    Copyright (C) 2004-2015
+# Author: Aric Hagberg (hagberg at lanl.gov)
+
+#    Copyright (C) 2004-2016
 #    Aric Hagberg <hagberg at lanl.gov>
 #    Dan Schult <dschult at colgate.edu>
 #    Pieter Swart <swart at lanl.gov>
@@ -23,17 +24,17 @@ G=nx.grid_2d_graph(4,4)  #4x4 grid
 pos=nx.spring_layout(G,iterations=100)
 
 plt.subplot(221)
-nx.draw(G,pos,font_size=8) 
+nx.draw(G,pos,font_size=8)
 
 plt.subplot(222)
-nx.draw(G,pos,node_color='k',node_size=0,with_labels=False) 
+nx.draw(G,pos,node_color='k',node_size=0,with_labels=False)
 
 plt.subplot(223)
-nx.draw(G,pos,node_color='g',node_size=250,with_labels=False,width=6) 
+nx.draw(G,pos,node_color='g',node_size=250,with_labels=False,width=6)
 
 plt.subplot(224)
 H=G.to_directed()
-nx.draw(H,pos,node_color='b',node_size=20,with_labels=False) 
+nx.draw(H,pos,node_color='b',node_size=20,with_labels=False)
 
 plt.savefig("four_grids.png")
 plt.show()
diff --git a/examples/drawing/giant_component.py b/examples/drawing/giant_component.py
index c087a13..9ec3266 100644
--- a/examples/drawing/giant_component.py
+++ b/examples/drawing/giant_component.py
@@ -1,12 +1,12 @@
 #!/usr/bin/env python
 """
-This example illustrates the sudden appearance of a 
+This example illustrates the sudden appearance of a
 giant connected component in a binomial random graph.
 
 Requires pygraphviz and matplotlib to draw.
 
 """
-#    Copyright (C) 2006-2008
+#    Copyright (C) 2006-2016
 #    Aric Hagberg <hagberg at lanl.gov>
 #    Dan Schult <dschult at colgate.edu>
 #    Pieter Swart <swart at lanl.gov>
@@ -16,31 +16,39 @@ Requires pygraphviz and matplotlib to draw.
 try:
     import matplotlib.pyplot as plt
 except:
-    raise 
+    raise
... 1984 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-networkx.git



More information about the Python-modules-commits mailing list