Release date: 19 September 2018
Supports Python 2.7, 3.5, 3.6 and 3.7. This is the last release to support Python 2.
NetworkX is a Python package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks.
This release is the result of 8 months of work with over 149 commits by 58 contributors. Highlights include:
Add support for Python 3.7. This is the last release to support Python 2.
Uniform random number generator (RNG) handling which defaults to global RNGs but allows specification of a single RNG for all random numbers in NX.
Improved GraphViews to ease subclassing and remove cyclic references which caused trouble with deepcopy and pickle.
New Graph method
Each function that uses random numbers now uses a
seed argument to control
the random number generation (RNG). By default the global default RNG is
used. More precisely, the
random package’s default RNG or the numpy.random
default RNG. You can also create your own RNG and pass it into the
argument. Finally, you can use an integer to indicate the state to set for
the RNG. In this case a local RNG is created leaving the global RNG untouched.
Some functions use
random and some use
numpy.random, but we have written
a translator so that all functions CAN take a
object. So a single RNG can be used for the entire package.
Cyclic references between graph classes and views have been removed to ease subclassing without memory leaks. Graphs no longer hold references to views.
Cyclic references between a graph and itself have been removed by eliminating G.root_graph. It turns out this was an avoidable construct anyway.
GraphViews have been reformulated as functions removing much of the subclass trouble with the copy/to_directed/subgraph methods. It also simplifies the graph view code base and API. There are now three function that create graph views: generic_graph_view(graph, create_using), reverse_view(digraph) and subgraph_view(graph, node_filter, edge_filter).
GraphML can now be written with attributes using numpy numeric types. In particular, np.float64 and np.int64 no longer need to convert to Python float and int to be written. They are still written as generic floats so reading them back in will not make the numpy values.
A generator following the Stochastic Block Model is now available.
all_topological_sort to generate all possible top_sorts.
New functions for tree width and tree decompositions.
Functions for Clauset-Newman-Moore modularity-max community detection.
Functions for small world analysis, directed clustering and perfect matchings, eulerizing a graph, depth-limited BFS, percolation centrality, planarity checking.
The shortest_path generic and convenience functions now have a
parameter to choose between dijkstra and bellmon-ford in the weighted case.
Default is dijkstra (which was the only option before).
empty_graph has taken over the functionality from nx.convert._prep_create_using which was removed.
create_using argument (used in many functions) should now be a
Graph Constructor like nx.Graph or nx.DiGraph.
It can still be a graph instance which will be cleared before use, but the
preferred use is a constructor.
New Base Class Method: update
H.update(G) adds the nodes, edges and graph attributes of G to H.
H.update(edges=e, nodes=n) add the edges and nodes from containers e and n.
H.update(e), and H.update(nodes=n) are also allowed.
First argument is a graph if it has
Otherwise the first argument is treated as a list of edges.
The bellman_ford predecessor dicts had sentinel value
source nodes. That has been changed so source nodes have pred value ‘’
Graph class method
fresh_copy - simply use
The GraphView classes are deprecated in preference to the function
SubMultiDiGraph are replaced by
are deprecated in favor of
Benjamin M. Gyori
Aabir Abubaker Kar
Erwan Le Merrer
Edward L Platt
Miguel Sozinho Ramalho