Answers for LLM inference engineers

AttributeError: module 'networkx' has no attribute 'from_numpy_matrix' (or 'read_gpickle', 'Graph' object has no attribute 'node', 'nodes_iter', any name): which networkx removed it and what to use

networkx 3.0 (2023-01-08) removed from_numpy_matrix and to_numpy_matrix (use from_numpy_array, to_numpy_array), read_gpickle and write_gpickle (use pickle), from_scipy_sparse_matrix (from_scipy_sparse_array) and nx.info (print(G)). 2.4 (2019-10-17) removed G.node (use G.nodes) and connected_component_subgraphs. 2.0 removed nodes_iter, edges_iter and G.edge. If the error comes from a library you did not write, upgrade the library or pin networkx below the release that removed the name. Paste the error below for the release-by-release answer.

Published 2026-11-25 · 33 networkx releases installed and run, 1.11 to 3.7 (104,577 lookups) · how

Examples:

Runs in your browser on the data in this page (networkx_names.json); nothing you paste is sent anywhere.

Which release removed it, and what replaces it?

288 names that one networkx release has and a later one does not (100 of them in 3.0). "Instead" is networkx's own deprecation text from the last release that had the name (175 of 288), except where marked "our note" (from networkx's migration guides and release notes, for names removed without a warning, as most of the 1.x API was in 2.0).

NameRemoved inInstead
networkx.block2.0
networkx.draw_graphviz2.0
networkx.edges_iter2.0G.edges() or nx.edges(G) (2.0 removed every *_iter method). (our note)
networkx.external2.0
networkx.kclique2.0From networkx.algorithms.community import kclique (still there in 3.7).
networkx.mst2.0From networkx.algorithms.tree import mst (still there in 3.7).
networkx.nodes_iter2.0G.nodes() or nx.nodes(G) (2.0 removed every *_iter method). (our note)
networkx.threshold2.0
networkx.topological_sort_recursive2.0
networkx.algorithms.block2.0
networkx.algorithms.kclique2.0From networkx.algorithms.community import kclique (still there in 3.7).
networkx.algorithms.mst2.0
networkx.algorithms.topological_sort_recursive2.0
networkx.algorithms.centrality.communicability_alg2.0
networkx.algorithms.dag.topological_sort_recursive2.0
networkx.classes.edges_iter2.0G.edges() or nx.edges(G) (2.0 removed every *_iter method). (our note)
networkx.classes.nodes_iter2.0G.nodes() or nx.nodes(G) (2.0 removed every *_iter method). (our note)
networkx.classes.function.edges_iter2.0G.edges() or nx.edges(G) (2.0 removed every *_iter method). (our note)
networkx.classes.function.nodes_iter2.0G.nodes() or nx.nodes(G) (2.0 removed every *_iter method). (our note)
networkx.drawing.draw_graphviz2.0
networkx.drawing.nx_pydot.networkx_from_pydot2.0networkx_from_pydot is replaced by from_pydot
networkx.drawing.nx_pydot.pydot_from_networkx2.0pydot_from_networkx is replaced by to_pydot
networkx.drawing.nx_pylab.draw_graphviz2.0
networkx.generators.threshold2.0
networkx.utils.create_degree_sequence2.0create_degree_sequence() is deprecated
G.adjacency_iter (DiGraph)2.0G.adjacency() (2.0 release notes). (our note)
G.adjacency_list (DiGraph)2.0G.adjacency() (2.0 release notes), or [list(nbrs) for n, nbrs in G.adjacency()]. (our note)
G.adjlist_dict_factory (DiGraph)2.0adjlist_inner_dict_factory (and adjlist_outer_dict_factory) on the class. (our note)
G.degree_iter (DiGraph)2.0G.degree() (2.0 removed every *_iter method). (our note)
G.edge (DiGraph)2.0G.adj (G.adj[u][v] is the edge data dict, as G.edge[u][v] was in 1.x), or G.edges[u, v]. (our note)
G.edges_iter (DiGraph)2.0G.edges() (2.0 removed every *_iter method). (our note)
G.in_degree_iter (DiGraph)2.0G.in_degree(). (our note)
G.in_edges_iter (DiGraph)2.0G.in_edges(). (our note)
G.neighbors_iter (DiGraph)2.0G.neighbors(n), which returns an iterator from 2.0. (our note)
G.nodes_iter (DiGraph)2.0G.nodes() (2.0 removed every *_iter method; the method without _iter returns a view or iterator). (our note)
G.out_degree_iter (DiGraph)2.0G.out_degree(). (our note)
G.out_edges_iter (DiGraph)2.0G.out_edges(). (our note)
G.predecessors_iter (DiGraph)2.0G.predecessors(n). (our note)
G.successors_iter (DiGraph)2.0G.successors(n). (our note)
G.adjacency_iter (Graph)2.0G.adjacency() (2.0 release notes). (our note)
G.adjacency_list (Graph)2.0G.adjacency() (2.0 release notes), or [list(nbrs) for n, nbrs in G.adjacency()]. (our note)
G.adjlist_dict_factory (Graph)2.0adjlist_inner_dict_factory (and adjlist_outer_dict_factory) on the class. (our note)
G.degree_iter (Graph)2.0G.degree() (2.0 removed every *_iter method). (our note)
G.edge (Graph)2.0G.adj (G.adj[u][v] is the edge data dict, as G.edge[u][v] was in 1.x), or G.edges[u, v]. (our note)
G.edges_iter (Graph)2.0G.edges() (2.0 removed every *_iter method). (our note)
G.neighbors_iter (Graph)2.0G.neighbors(n), which returns an iterator from 2.0. (our note)
G.nodes_iter (Graph)2.0G.nodes() (2.0 removed every *_iter method; the method without _iter returns a view or iterator). (our note)
G.adjacency_iter (MultiDiGraph)2.0G.adjacency() (2.0 release notes). (our note)
G.adjacency_list (MultiDiGraph)2.0G.adjacency() (2.0 release notes), or [list(nbrs) for n, nbrs in G.adjacency()]. (our note)
G.adjlist_dict_factory (MultiDiGraph)2.0adjlist_inner_dict_factory (and adjlist_outer_dict_factory) on the class. (our note)
G.degree_iter (MultiDiGraph)2.0G.degree() (2.0 removed every *_iter method). (our note)
G.edge (MultiDiGraph)2.0G.adj (G.adj[u][v] is the edge data dict, as G.edge[u][v] was in 1.x), or G.edges[u, v]. (our note)
G.edges_iter (MultiDiGraph)2.0G.edges() (2.0 removed every *_iter method). (our note)
G.in_degree_iter (MultiDiGraph)2.0G.in_degree(). (our note)
G.in_edges_iter (MultiDiGraph)2.0G.in_edges(). (our note)
G.neighbors_iter (MultiDiGraph)2.0G.neighbors(n), which returns an iterator from 2.0. (our note)
G.nodes_iter (MultiDiGraph)2.0G.nodes() (2.0 removed every *_iter method; the method without _iter returns a view or iterator). (our note)
G.out_degree_iter (MultiDiGraph)2.0G.out_degree(). (our note)
G.out_edges_iter (MultiDiGraph)2.0G.out_edges(). (our note)
G.predecessors_iter (MultiDiGraph)2.0G.predecessors(n). (our note)
G.successors_iter (MultiDiGraph)2.0G.successors(n). (our note)
G.adjacency_iter (MultiGraph)2.0G.adjacency() (2.0 release notes). (our note)
G.adjacency_list (MultiGraph)2.0G.adjacency() (2.0 release notes), or [list(nbrs) for n, nbrs in G.adjacency()]. (our note)
G.adjlist_dict_factory (MultiGraph)2.0adjlist_inner_dict_factory (and adjlist_outer_dict_factory) on the class. (our note)
G.degree_iter (MultiGraph)2.0G.degree() (2.0 removed every *_iter method). (our note)
G.edge (MultiGraph)2.0G.adj (G.adj[u][v] is the edge data dict, as G.edge[u][v] was in 1.x), or G.edges[u, v]. (our note)
G.edges_iter (MultiGraph)2.0G.edges() (2.0 removed every *_iter method). (our note)
G.neighbors_iter (MultiGraph)2.0G.neighbors(n), which returns an iterator from 2.0. (our note)
G.nodes_iter (MultiGraph)2.0G.nodes() (2.0 removed every *_iter method; the method without _iter returns a view or iterator). (our note)
networkx.bellman_ford2.1Function bellman_ford() is deprecated and will be removedin 2.1, use bellman_ford_predecessor_and_distance() instead.
networkx.from_pandas_dataframe2.1from_pandas_dataframe is deprecated and will be removedin 2.1, use from_pandas_edgelist instead.
networkx.to_pandas_dataframe2.1to_pandas_dataframe is deprecated and will be removedin 2.1, use to_pandas_adjacency instead.
networkx.algorithms.bellman_ford2.1Function bellman_ford() is deprecated and will be removedin 2.1, use bellman_ford_predecessor_and_distance() instead.
networkx.algorithms.community.asyn_lpa2.1
networkx.algorithms.dag.nodes_or_number2.1From networkx.utils import nodes_or_number (still there in 3.7).
networkx.algorithms.dag.open_file2.1From networkx.utils import open_file (still there in 3.7).
networkx.algorithms.shortest_paths.bellman_ford2.1Function bellman_ford() is deprecated and will be removedin 2.1, use bellman_ford_predecessor_and_distance() instead.
networkx.convert_matrix.from_pandas_dataframe2.1from_pandas_dataframe is deprecated and will be removedin 2.1, use from_pandas_edgelist instead.
networkx.convert_matrix.to_pandas_dataframe2.1to_pandas_dataframe is deprecated and will be removedin 2.1, use to_pandas_adjacency instead.
networkx.generators.tree2.1
G.root_graph (DiGraph)2.2
G.root_graph (Graph)2.2
G.root_graph (MultiDiGraph)2.2
G.root_graph (MultiGraph)2.2
networkx.attracting_component_subgraphs2.4attracting_component_subgraphs is deprecated and will be removedin 2.2. Use (G.subgraph(c).copy() for c in attracting_components(G))
networkx.biconnected_component_subgraphs2.4connected_component_subgraphs is deprecated and will be removedin 2.2. Use (G.subgraph(c).copy() for c in biconnected_components(G))
networkx.connected_component_subgraphs2.4connected_component_subgraphs is deprecated and will be removedin 2.2. Use (G.subgraph(c).copy() for c in connected_components(G))
networkx.strongly_connected_component_subgraphs2.4strongly_connected_component_subgraphs is deprecated and will be removed in 2.2use (G.subgraph(c).copy() for c in strongly_connected_components(G))
networkx.weakly_connected_component_subgraphs2.4weakly_connected_component_subgraphs is deprecated and will be removed in 2.2use (G.subgraph(c).copy() for c in weakly_connected_components(G))
networkx.algorithms.attracting_component_subgraphs2.4attracting_component_subgraphs is deprecated and will be removedin 2.2. Use (G.subgraph(c).copy() for c in attracting_components(G))
networkx.algorithms.biconnected_component_subgraphs2.4connected_component_subgraphs is deprecated and will be removedin 2.2. Use (G.subgraph(c).copy() for c in biconnected_components(G))
networkx.algorithms.connected_component_subgraphs2.4connected_component_subgraphs is deprecated and will be removedin 2.2. Use (G.subgraph(c).copy() for c in connected_components(G))
networkx.algorithms.strongly_connected_component_subgraphs2.4strongly_connected_component_subgraphs is deprecated and will be removed in 2.2use (G.subgraph(c).copy() for c in strongly_connected_components(G))
networkx.algorithms.weakly_connected_component_subgraphs2.4weakly_connected_component_subgraphs is deprecated and will be removed in 2.2use (G.subgraph(c).copy() for c in weakly_connected_components(G))
networkx.algorithms.community.community_generators2.4
networkx.algorithms.components.attracting_component_subgraphs2.4attracting_component_subgraphs is deprecated and will be removedin 2.2. Use (G.subgraph(c).copy() for c in attracting_components(G))
networkx.algorithms.components.biconnected_component_subgraphs2.4connected_component_subgraphs is deprecated and will be removedin 2.2. Use (G.subgraph(c).copy() for c in biconnected_components(G))
networkx.algorithms.components.connected_component_subgraphs2.4connected_component_subgraphs is deprecated and will be removedin 2.2. Use (G.subgraph(c).copy() for c in connected_components(G))
networkx.algorithms.components.strongly_connected_component_subgraphs2.4strongly_connected_component_subgraphs is deprecated and will be removed in 2.2use (G.subgraph(c).copy() for c in strongly_connected_components(G))
networkx.algorithms.components.weakly_connected_component_subgraphs2.4weakly_connected_component_subgraphs is deprecated and will be removed in 2.2use (G.subgraph(c).copy() for c in weakly_connected_components(G))
G.add_cycle (DiGraph)2.4add_cycle is deprecated. Use nx.add_cycle instead.
G.add_path (DiGraph)2.4add_path is deprecated. Use nx.add_path instead.
G.add_star (DiGraph)2.4add_star is deprecated. Use nx.add_star instead.
G.fresh_copy (DiGraph)2.4G.fresh_copy is deprecated. Use G.__class__ instead
G.node (DiGraph)2.4G.nodes: G.nodes[n] for a node's attribute dict, G.nodes(data=True) for (node, data) pairs, `for n in G:` to loop over nodes. (networkx 2.0 kept G.node as a pointer to G.nodes; 2.4 removed it.) (our note)
G.nodes_with_selfloops (DiGraph)2.4nodes_with_selfloops is deprecated.Use nx.nodes_with_selfloops instead.
G.number_of_selfloops (DiGraph)2.4number_of_selfloops is deprecated.Use nx.number_of_selfloops instead.
G.selfloop_edges (DiGraph)2.4selfloop_edges is deprecated. Use nx.selfloop_edges instead.
G.add_cycle (Graph)2.4add_cycle is deprecated. Use nx.add_cycle instead.
G.add_path (Graph)2.4add_path is deprecated. Use nx.add_path instead.
G.add_star (Graph)2.4add_star is deprecated. Use nx.add_star instead.
G.fresh_copy (Graph)2.4G.fresh_copy is deprecated. Use G.__class__ instead
G.node (Graph)2.4G.nodes: G.nodes[n] for a node's attribute dict, G.nodes(data=True) for (node, data) pairs, `for n in G:` to loop over nodes. (networkx 2.0 kept G.node as a pointer to G.nodes; 2.4 removed it.) (our note)
G.nodes_with_selfloops (Graph)2.4nodes_with_selfloops is deprecated.Use nx.nodes_with_selfloops instead.
G.number_of_selfloops (Graph)2.4number_of_selfloops is deprecated.Use nx.number_of_selfloops instead.
G.selfloop_edges (Graph)2.4selfloop_edges is deprecated. Use nx.selfloop_edges instead.
G.add_cycle (MultiDiGraph)2.4add_cycle is deprecated. Use nx.add_cycle instead.
G.add_path (MultiDiGraph)2.4add_path is deprecated. Use nx.add_path instead.
G.add_star (MultiDiGraph)2.4add_star is deprecated. Use nx.add_star instead.
G.fresh_copy (MultiDiGraph)2.4G.fresh_copy is deprecated. Use G.__class__ instead
G.node (MultiDiGraph)2.4G.nodes: G.nodes[n] for a node's attribute dict, G.nodes(data=True) for (node, data) pairs, `for n in G:` to loop over nodes. (networkx 2.0 kept G.node as a pointer to G.nodes; 2.4 removed it.) (our note)
G.nodes_with_selfloops (MultiDiGraph)2.4nodes_with_selfloops is deprecated.Use nx.nodes_with_selfloops instead.
G.number_of_selfloops (MultiDiGraph)2.4number_of_selfloops is deprecated.Use nx.number_of_selfloops instead.
G.selfloop_edges (MultiDiGraph)2.4selfloop_edges is deprecated. Use nx.selfloop_edges instead.
G.add_cycle (MultiGraph)2.4add_cycle is deprecated. Use nx.add_cycle instead.
G.add_path (MultiGraph)2.4add_path is deprecated. Use nx.add_path instead.
G.add_star (MultiGraph)2.4add_star is deprecated. Use nx.add_star instead.
G.fresh_copy (MultiGraph)2.4G.fresh_copy is deprecated. Use G.__class__ instead
G.node (MultiGraph)2.4G.nodes: G.nodes[n] for a node's attribute dict, G.nodes(data=True) for (node, data) pairs, `for n in G:` to loop over nodes. (networkx 2.0 kept G.node as a pointer to G.nodes; 2.4 removed it.) (our note)
G.nodes_with_selfloops (MultiGraph)2.4nodes_with_selfloops is deprecated.Use nx.nodes_with_selfloops instead.
G.number_of_selfloops (MultiGraph)2.4number_of_selfloops is deprecated.Use nx.number_of_selfloops instead.
G.selfloop_edges (MultiGraph)2.4selfloop_edges is deprecated. Use nx.selfloop_edges instead.
networkx.nx_yaml2.6.2pyyaml directly: yaml.dump(G, f) and yaml.load(f, Loader=yaml.Loader) (networkx 3.0 migration guide). (our note)
networkx.read_yaml2.6.2pyyaml directly: yaml.dump(G, f) and yaml.load(f, Loader=yaml.Loader) (networkx 3.0 migration guide). (our note)
networkx.release2.6.2
networkx.version2.6.2
networkx.write_yaml2.6.2pyyaml directly: yaml.dump(G, f) and yaml.load(f, Loader=yaml.Loader) (networkx 3.0 migration guide). (our note)
networkx.algorithms.approximation.independent_set2.6.2
networkx.readwrite.read_yaml2.6.2pyyaml directly: yaml.dump(G, f) and yaml.load(f, Loader=yaml.Loader) (networkx 3.0 migration guide). (our note)
networkx.readwrite.write_yaml2.6.2pyyaml directly: yaml.dump(G, f) and yaml.load(f, Loader=yaml.Loader) (networkx 3.0 migration guide). (our note)
networkx.drawing.layout.random_state2.7
networkx.adj_matrix3.0adj_matrix is deprecated and will be removed in version 3.0. Use `adjacency_matrix` instead
networkx.authority_matrix3.0authority_matrix is deprecated as of version 2.6 and will be removed in version 3.0. The authority matrix can be computed by:: >>> M = nx.to_numpy_array(G, nodelist=nodelist) >>> M.T @ M
networkx.betweenness_centrality_source3.0betweenness_centrality_source --> betweenness_centrality_subset
networkx.edge_betweenness3.0edge_betweeness is replaced by edge_betweenness_centrality
networkx.extrema_bounding3.0extrema_bounding is deprecated and will be removed in networkx 3.0
networkx.find_cores3.0find_cores is deprecated as of version 2.7 and will be removed in version 3.0. The find_cores function is renamed core_number
networkx.from_numpy_matrix3.0from_numpy_matrix is deprecated and will be removed in NetworkX 3.0. Use from_numpy_array instead, e.g. from_numpy_array(A, **kwargs)
networkx.from_scipy_sparse_matrix3.0The scipy.sparse array containers will be used instead of matrices in Networkx 3.0. Use `from_scipy_sparse_array` instead.
networkx.gpickle3.0The pickle module: with open(path, 'wb') as f: pickle.dump(G, f, pickle.HIGHEST_PROTOCOL), and pickle.load(f) to read (networkx 3.0 migration guide). (our note)
networkx.hits_numpy3.0networkx.hits_numpy is deprecated and will be removedin NetworkX 3.0, use networkx.hits instead.
networkx.hits_scipy3.0networkx.hits_scipy is deprecated and will be removedin NetworkX 3.0, use networkx.hits instead.
networkx.hub_matrix3.0hub_matrix is deprecated as of version 2.6 and will be removed in version 3.0. The hub matrix can be computed by:: >>> M = nx.to_numpy_array(G, nodelist=nodelist) >>> M @ M.T
networkx.info3.0info is deprecated and will be removed in version 3.0. Instead (our note): print(G): str(G) is a one-line summary in 3.7 ('Graph with 3 nodes and 2 edges'); G.number_of_nodes(), G.number_of_edges() for the numbers.
networkx.jit3.0
networkx.jit_data3.0jit_data is deprecated and will be removed in NetworkX 3.0.
networkx.jit_graph3.0jit_graph is deprecated and will be removed in NetworkX 3.0.
networkx.k_nearest_neighbors3.0k_nearest_neighbors function is deprecated and will be removed in v3.0. Use `average_degree_connectivity` instead.
networkx.make_small_graph3.0make_small_graph is deprecated and will be removed in version 3.0. If `ltype` == 'adjacencylist', convert `xlist` to a dict and use `from_dict_of_lists` instead. If `ltype` == 'edgelist', use `from_edgelist` instead.
networkx.numeric_mixing_matrix3.0numeric_mixing_matrix is deprecated and will be removed in v3.0. Use `attribute_mixing_matrix` instead.
networkx.nx_shp3.0
networkx.ordered3.0Consistently ordered variant of :class:`~networkx.Graph`. .. deprecated:: 2.6 OrderedGraph is deprecated and will be removed in version 3.0. Use `Graph` instead, which guarantees order is preserved for Python >= 3.7
networkx.OrderedDiGraph3.0OrderedDiGraph is deprecated and will be removed in version 3.0. Use `DiGraph` instead, which guarantees order is preserved for Python >= 3.7
networkx.OrderedGraph3.0OrderedGraph is deprecated and will be removed in version 3.0. Use `Graph` instead, which guarantees order is preserved for Python >= 3.7
networkx.OrderedMultiDiGraph3.0OrderedMultiDiGraph is deprecated and will be removed in version 3.0. Use `MultiDiGraph` instead, which guarantees order is preserved for Python >= 3.7
networkx.OrderedMultiGraph3.0OrderedMultiGraph is deprecated and will be removed in version 3.0. Use `MultiGraph` instead, which guarantees order is preserved for Python >= 3.7
networkx.pagerank_numpy3.0networkx.pagerank_numpy is deprecated and will be removed in NetworkX 3.0, use networkx.pagerank instead.
networkx.pagerank_scipy3.0networkx.pagerank_scipy is deprecated and will be removed in NetworkX 3.0, use networkx.pagerank instead.
networkx.project3.0networkx.project is deprecated and will be removedin NetworkX 3.0, use networkx.projected_graph instead.
networkx.read_gpickle3.0read_gpickle is deprecated and will be removed in 3.0.Use pickle.load(path)
networkx.read_shp3.0read_shp is deprecated and will be removed in 3.0.See https://networkx.org/documentation/latest/auto_examples/index.html#geospatial.
networkx.simrank_similarity_numpy3.0networkx.simrank_similarity_numpy is deprecated and will be removedin NetworkX 3.0, use networkx.simrank_similarity instead.
networkx.testing3.0
networkx.to_numpy_matrix3.0to_numpy_matrix is deprecated and will be removed in NetworkX 3.0. Use to_numpy_array instead, e.g. np.asmatrix(to_numpy_array(G, **kwargs))
networkx.to_numpy_recarray3.0to_numpy_recarray is deprecated and will be removed in version 3.0. Use to_numpy_array instead:: nx.to_numpy_array(G, dtype=dtype, weight=None).view(np.recarray)
networkx.to_scipy_sparse_matrix3.0The scipy.sparse array containers will be used instead of matrices in Networkx 3.0. Use `to_scipy_sparse_array` instead.
networkx.write_gpickle3.0write_gpickle is deprecated and will be removed in 3.0.Use pickle.dump(G, path, protocol)
networkx.write_shp3.0write_shp is deprecated and will be removed in 3.0.See https://networkx.org/documentation/latest/auto_examples/index.html#geospatial.
networkx.algorithms.authority_matrix3.0authority_matrix is deprecated as of version 2.6 and will be removed in version 3.0. The authority matrix can be computed by:: >>> M = nx.to_numpy_array(G, nodelist=nodelist) >>> M.T @ M
networkx.algorithms.betweenness_centrality_source3.0betweenness_centrality_source --> betweenness_centrality_subset
networkx.algorithms.edge_betweenness3.0edge_betweeness is replaced by edge_betweenness_centrality
networkx.algorithms.extrema_bounding3.0extrema_bounding is deprecated and will be removed in networkx 3.0
networkx.algorithms.find_cores3.0find_cores is deprecated as of version 2.7 and will be removed in version 3.0. The find_cores function is renamed core_number
networkx.algorithms.hits_numpy3.0networkx.hits_numpy is deprecated and will be removedin NetworkX 3.0, use networkx.hits instead.
networkx.algorithms.hits_scipy3.0networkx.hits_scipy is deprecated and will be removedin NetworkX 3.0, use networkx.hits instead.
networkx.algorithms.hub_matrix3.0hub_matrix is deprecated as of version 2.6 and will be removed in version 3.0. The hub matrix can be computed by:: >>> M = nx.to_numpy_array(G, nodelist=nodelist) >>> M @ M.T
networkx.algorithms.k_nearest_neighbors3.0k_nearest_neighbors function is deprecated and will be removed in v3.0. Use `average_degree_connectivity` instead.
networkx.algorithms.numeric_mixing_matrix3.0numeric_mixing_matrix is deprecated and will be removed in v3.0. Use `attribute_mixing_matrix` instead.
networkx.algorithms.pagerank_numpy3.0networkx.pagerank_numpy is deprecated and will be removed in NetworkX 3.0, use networkx.pagerank instead.
networkx.algorithms.pagerank_scipy3.0networkx.pagerank_scipy is deprecated and will be removed in NetworkX 3.0, use networkx.pagerank instead.
networkx.algorithms.project3.0networkx.project is deprecated and will be removedin NetworkX 3.0, use networkx.projected_graph instead.
networkx.algorithms.simrank_similarity_numpy3.0networkx.simrank_similarity_numpy is deprecated and will be removedin NetworkX 3.0, use networkx.simrank_similarity instead.
networkx.algorithms.bipartite.project3.0networkx.project is deprecated and will be removedin NetworkX 3.0, use networkx.projected_graph instead.
networkx.algorithms.centrality.betweenness_centrality_source3.0betweenness_centrality_source --> betweenness_centrality_subset
networkx.algorithms.centrality.edge_betweenness3.0edge_betweeness is replaced by edge_betweenness_centrality
networkx.classes.info3.0info is deprecated and will be removed in version 3.0. Instead (our note): print(G): str(G) is a one-line summary in 3.7 ('Graph with 3 nodes and 2 edges'); G.number_of_nodes(), G.number_of_edges() for the numbers.
networkx.classes.ordered3.0Consistently ordered variant of :class:`~networkx.Graph`. .. deprecated:: 2.6 OrderedGraph is deprecated and will be removed in version 3.0. Use `Graph` instead, which guarantees order is preserved for Python >= 3.7
networkx.classes.OrderedDiGraph3.0OrderedDiGraph is deprecated and will be removed in version 3.0. Use `DiGraph` instead, which guarantees order is preserved for Python >= 3.7
networkx.classes.OrderedGraph3.0OrderedGraph is deprecated and will be removed in version 3.0. Use `Graph` instead, which guarantees order is preserved for Python >= 3.7
networkx.classes.OrderedMultiDiGraph3.0OrderedMultiDiGraph is deprecated and will be removed in version 3.0. Use `MultiDiGraph` instead, which guarantees order is preserved for Python >= 3.7
networkx.classes.OrderedMultiGraph3.0OrderedMultiGraph is deprecated and will be removed in version 3.0. Use `MultiGraph` instead, which guarantees order is preserved for Python >= 3.7
networkx.classes.function.info3.0info is deprecated and will be removed in version 3.0. Instead (our note): print(G): str(G) is a one-line summary in 3.7 ('Graph with 3 nodes and 2 edges'); G.number_of_nodes(), G.number_of_edges() for the numbers.
networkx.convert_matrix.from_numpy_matrix3.0from_numpy_matrix is deprecated and will be removed in NetworkX 3.0. Use from_numpy_array instead, e.g. from_numpy_array(A, **kwargs)
networkx.convert_matrix.from_scipy_sparse_matrix3.0The scipy.sparse array containers will be used instead of matrices in Networkx 3.0. Use `from_scipy_sparse_array` instead.
networkx.convert_matrix.to_numpy_matrix3.0to_numpy_matrix is deprecated and will be removed in NetworkX 3.0. Use to_numpy_array instead, e.g. np.asmatrix(to_numpy_array(G, **kwargs))
networkx.convert_matrix.to_numpy_recarray3.0to_numpy_recarray is deprecated and will be removed in version 3.0. Use to_numpy_array instead:: nx.to_numpy_array(G, dtype=dtype, weight=None).view(np.recarray)
networkx.convert_matrix.to_scipy_sparse_matrix3.0The scipy.sparse array containers will be used instead of matrices in Networkx 3.0. Use `to_scipy_sparse_array` instead.
networkx.drawing.nx_agraph.display_pygraphviz3.0display_pygraphviz is deprecated and will be removed in NetworkX 3.0. To view a graph G using pygraphviz, use nx.nx_agraph.view_pygraphviz(G). To view a graph from file, consider an image processing libary like `Pillow`, e.g. PIL.Image.open(path.name).show()
networkx.generators.make_small_graph3.0make_small_graph is deprecated and will be removed in version 3.0. If `ltype` == 'adjacencylist', convert `xlist` to a dict and use `from_dict_of_lists` instead. If `ltype` == 'edgelist', use `from_edgelist` instead.
networkx.linalg.adj_matrix3.0adj_matrix is deprecated and will be removed in version 3.0. Use `adjacency_matrix` instead
networkx.readwrite.gpickle3.0The pickle module: with open(path, 'wb') as f: pickle.dump(G, f, pickle.HIGHEST_PROTOCOL), and pickle.load(f) to read (networkx 3.0 migration guide). (our note)
networkx.readwrite.jit3.0
networkx.readwrite.jit_data3.0jit_data is deprecated and will be removed in NetworkX 3.0.
networkx.readwrite.jit_graph3.0jit_graph is deprecated and will be removed in NetworkX 3.0.
networkx.readwrite.nx_shp3.0
networkx.readwrite.nx_yaml3.0pyyaml directly: yaml.dump(G, f) and yaml.load(f, Loader=yaml.Loader) (networkx 3.0 migration guide). (our note)
networkx.readwrite.read_gpickle3.0read_gpickle is deprecated and will be removed in 3.0.Use pickle.load(path)
networkx.readwrite.read_shp3.0read_shp is deprecated and will be removed in 3.0.See https://networkx.org/documentation/latest/auto_examples/index.html#geospatial.
networkx.readwrite.write_gpickle3.0write_gpickle is deprecated and will be removed in 3.0.Use pickle.dump(G, path, protocol)
networkx.readwrite.write_shp3.0write_shp is deprecated and will be removed in 3.0.See https://networkx.org/documentation/latest/auto_examples/index.html#geospatial.
networkx.readwrite.json_graph.jit3.0
networkx.readwrite.json_graph.jit_data3.0jit_data is deprecated and will be removed in NetworkX 3.0.
networkx.readwrite.json_graph.jit_graph3.0jit_graph is deprecated and will be removed in NetworkX 3.0.
networkx.utils.consume3.0consume is deprecated and will be removed in version 3.0. Use collections.deque(iterator, maxlen=0) instead.
networkx.utils.contextmanagers3.0
networkx.utils.default_opener3.0default_opener is deprecated and will be removed in version 3.0.
networkx.utils.dict_to_numpy_array13.0dict_to_numpy_array1 is deprecated and will be removed in networkx 3.0. Use dict_to_numpy_array instead.
networkx.utils.dict_to_numpy_array23.0dict_to_numpy_array2 is deprecated and will be removed in networkx 3.0. Use dict_to_numpy_array instead.
networkx.utils.empty_generator3.0empty_generator is deprecated and will be removed in v3.0.
networkx.utils.generate_unique_node3.0generate_unique_node is deprecated and will be removed in 3.0. Use uuid.uuid4 instead.
networkx.utils.is_iterator3.0is_iterator is deprecated and will be removed in version 3.0. Use isinstance(obj, collections.abc.Iterator) instead.
networkx.utils.is_list_of_ints3.0is_list_of_ints is deprecated and will be removed in 3.0.See also: networkx.utils.make_list_of_ints.
networkx.utils.is_string_like3.0is_string_like is deprecated and will be removed in 3.0.Use isinstance(obj, str) instead.
networkx.utils.iterable3.0iterable is deprecated and will be removed in 3.0.Use isinstance(obj, (collections.abc.Iterable, collections.abc.Sized)) instead.
networkx.utils.make_str3.0make_str is deprecated and will be removed in 3.0. Use str instead.
networkx.utils.preserve_random_state3.0preserve_random_state is deprecated and will be removed in 3.0.
networkx.utils.random_state3.0`random_state` is a deprecated alias for `np_random_state` and will be removed in version 3.0. Use `np_random_state` instead.
networkx.utils.reversed3.0context manager reversed is deprecated and to be removed in 3.0.Use G.reverse(copy=False) if G.is_directed() else G instead.
networkx.utils.to_tuple3.0to_tuple is deprecated and will be removed in NetworkX 3.0.
networkx.utils.decorators.preserve_random_state3.0preserve_random_state is deprecated and will be removed in 3.0.
networkx.utils.decorators.random_state3.0`random_state` is a deprecated alias for `np_random_state` and will be removed in version 3.0. Use `np_random_state` instead.
networkx.backends3.2From networkx.utils import backends (still there in 3.7).
networkx.cliques_containing_node3.2cliques_containing_node is deprecated and will be removed. Use the result of find_cliques directly to compute maximal cliques containing each node: {n: [c for c in nx.find_cliques(G) if n in c] for n in G}
networkx.graph_clique_number3.2graph_clique_number is deprecated and will be removed. Use: max(len(c) for c in nx.find_cliques(G)) instead.
networkx.graph_number_of_cliques3.2graph_number_of_cliques is deprecated and will be removed. Use: sum(1 for _ in nx.find_cliques(G)) instead.
networkx.algorithms.cliques_containing_node3.2cliques_containing_node is deprecated and will be removed. Use the result of find_cliques directly to compute maximal cliques containing each node: {n: [c for c in nx.find_cliques(G) if n in c] for n in G}
networkx.algorithms.graph_clique_number3.2graph_clique_number is deprecated and will be removed. Use: max(len(c) for c in nx.find_cliques(G)) instead.
networkx.algorithms.graph_number_of_cliques3.2graph_number_of_cliques is deprecated and will be removed. Use: sum(1 for _ in nx.find_cliques(G)) instead.
networkx.classes.backends3.2
networkx.classes.function.reverse_view3.2From networkx import reverse_view (still there in 3.7).
networkx.classes.function.subgraph_view3.2From networkx import subgraph_view (still there in 3.7).
networkx.forest_str3.4forest_str is deprecated as of version 3.1 and will be removed in version 3.3. Use generate_network_text or write_network_text instead.
networkx.join3.4The function `join` is deprecated and is renamed `join_trees`. The join function itself will be removed in v3.4
networkx.random_tree3.4random_tree is deprecated and will be removed in NX v3.4 Use random_labeled_tree instead.
networkx.strongly_connected_components_recursive3.4strongly_connected_components_recursive is deprecated and will be removed in the future. Use strongly_connected_components instead.
networkx.algorithms.join3.4The function `join` is deprecated and is renamed `join_trees`. The join function itself will be removed in v3.4
networkx.algorithms.strongly_connected_components_recursive3.4strongly_connected_components_recursive is deprecated and will be removed in the future. Use strongly_connected_components instead.
networkx.algorithms.components.strongly_connected_components_recursive3.4strongly_connected_components_recursive is deprecated and will be removed in the future. Use strongly_connected_components instead.
networkx.algorithms.tree.Edmonds3.4Edmonds has been deprecated
networkx.algorithms.tree.join3.4The function `join` is deprecated and is renamed `join_trees`. The join function itself will be removed in v3.4
networkx.generators.random_tree3.4random_tree is deprecated and will be removed in NX v3.4 Use random_labeled_tree instead.
networkx.readwrite.forest_str3.4forest_str is deprecated as of version 3.1 and will be removed in version 3.3. Use generate_network_text or write_network_text instead.
networkx.utils.deprecate_positional_args3.4.1
networkx.utils.decorators.deprecate_positional_args3.4.1
networkx.all_triplets3.5all_triplets is deprecated and will be removed in v3.5. Use `itertools.combinations(G, 3)` instead.
networkx.d_separated3.5d_separated is deprecated and will be removed in NetworkX v3.5.Please use `is_d_separator(G, x, y, z)`.
networkx.minimal_d_separator3.5This function is deprecated and will be removed in NetworkX v3.5.Please use `is_d_separator(G, x, y)`.
networkx.random_triad3.5random_triad is deprecated and will be removed in NetworkX v3.5. Use random.sample instead, e.g.:: G.subgraph(random.sample(list(G), 3))
networkx.total_spanning_tree_weight3.5total_spanning_tree_weight is deprecated and will be removed in v3.5. Use `nx.number_of_spanning_trees(G)` instead.
networkx.algorithms.all_triplets3.5all_triplets is deprecated and will be removed in v3.5. Use `itertools.combinations(G, 3)` instead.
networkx.algorithms.d_separated3.5d_separated is deprecated and will be removed in NetworkX v3.5.Please use `is_d_separator(G, x, y, z)`.
networkx.algorithms.minimal_d_separator3.5This function is deprecated and will be removed in NetworkX v3.5.Please use `is_d_separator(G, x, y)`.
networkx.algorithms.random_triad3.5random_triad is deprecated and will be removed in NetworkX v3.5. Use random.sample instead, e.g.:: G.subgraph(random.sample(list(G), 3))
networkx.drawing.nx_pylab.circular_layout3.5From networkx import circular_layout (still there in 3.7).
networkx.drawing.nx_pylab.forceatlas2_layout3.5From networkx import forceatlas2_layout (still there in 3.7).
networkx.drawing.nx_pylab.kamada_kawai_layout3.5From networkx import kamada_kawai_layout (still there in 3.7).
networkx.drawing.nx_pylab.planar_layout3.5From networkx import planar_layout (still there in 3.7).
networkx.drawing.nx_pylab.random_layout3.5From networkx import random_layout (still there in 3.7).
networkx.drawing.nx_pylab.shell_layout3.5From networkx import shell_layout (still there in 3.7).
networkx.drawing.nx_pylab.spectral_layout3.5From networkx import spectral_layout (still there in 3.7).
networkx.drawing.nx_pylab.spring_layout3.5From networkx import spring_layout (still there in 3.7).
networkx.linalg.total_spanning_tree_weight3.5total_spanning_tree_weight is deprecated and will be removed in v3.5. Use `nx.number_of_spanning_trees(G)` instead.
networkx.compute_v_structures3.6`compute_v_structures` actually yields colliders. It will be removed in version 3.6. Use `nx.dag.v_structures` or `nx.dag.colliders` instead.
networkx.algorithms.compute_v_structures3.6`compute_v_structures` actually yields colliders. It will be removed in version 3.6. Use `nx.dag.v_structures` or `nx.dag.colliders` instead.
networkx.algorithms.dag.compute_v_structures3.6`compute_v_structures` actually yields colliders. It will be removed in version 3.6. Use `nx.dag.v_structures` or `nx.dag.colliders` instead.
networkx.algorithms.community.kernighan_lin3.6.1
networkx.random_lobster3.7`random_lobster` is deprecated, use `random_lobster_graph` instead.
networkx.generators.random_lobster3.7`random_lobster` is deprecated, use `random_lobster_graph` instead.

How was this measured?

Each of 33 networkx releases (every release from 1.11 to 3.7, patch releases included) was installed from PyPI in its own environment, the public names of 31 networkx modules and of the Graph, DiGraph, MultiGraph and MultiDiGraph classes were listed with dir(), and getattr was run for the union of all names in every release. A small graph of each class was also built and checked with hasattr, because networkx 1.x set G.node and G.edge on the object, not the class. Releases: 1.11, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.5.1, 2.6.2, 2.6.3, 2.7, 2.7.1, 2.8, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.8.5, 2.8.6, 2.8.7, 2.8.8, 3.0, 3.1 (Python 3.8); 3.2, 3.2.1 (Python 3.9); 3.3, 3.4, 3.4.1, 3.4.2 (Python 3.10); 3.5, 3.6, 3.6.1 (Python 3.11); 3.7 (Python 3.12). 1.11 and 2.0 to 2.5.1 were installed with decorator 4.4.2, and 1.11 to 2.2 with setuptools below 70 (they import pkg_resources).

The table keeps class members, names in any module's __all__ (networkx re-exports them at the top) and names networkx itself deprecated; helpers a module merely imported are left out, but the lookup still answers for them. The text is read from the installed source of the last release that had the name: the warnings.warn(..., DeprecationWarning) in its body, with a local msg = ... resolved.

Questions

How do I fix "module 'networkx' has no attribute 'from_numpy_matrix'"?

networkx 3.0 (2023-01-08) removed from_numpy_matrix and to_numpy_matrix; 2.6 to 2.8 warn when they are called. Use nx.from_numpy_array(A) and nx.to_numpy_array(G), which take the same arguments; wrap with np.asmatrix(...) if you really need a matrix. The same release removed from_scipy_sparse_matrix and to_scipy_sparse_matrix: use from_scipy_sparse_array and to_scipy_sparse_array.

How do I fix "module 'networkx' has no attribute 'read_gpickle'"?

networkx 3.0 removed read_gpickle, write_gpickle and the networkx.readwrite.gpickle module. Use pickle directly: with open('g.gpickle', 'wb') as f: pickle.dump(G, f, pickle.HIGHEST_PROTOCOL); and with open('g.gpickle', 'rb') as f: G = pickle.load(f). A file written by write_gpickle in 2.8.8 loads this way in 3.7 (tried).

How do I fix "'Graph' object has no attribute 'node'"?

networkx 2.4 (2019-10-17) removed G.node; 2.0 to 2.3 kept it as a pointer to G.nodes. Use G.nodes[n] for a node's attribute dict, G.nodes(data=True) for (node, data) pairs, and for n in G: to loop. The same release removed G.add_path, G.add_cycle, G.add_star and G.selfloop_edges (use nx.add_path(G, ...), nx.selfloop_edges(G)).

How do I fix "module 'networkx' has no attribute 'connected_component_subgraphs'"?

networkx 2.4 removed connected_component_subgraphs (and the strongly, weakly and biconnected versions); 2.1 to 2.3 warned. Use (G.subgraph(c).copy() for c in nx.connected_components(G)), or max(nx.connected_components(G), key=len) for the largest component's nodes.

How do I fix "'Graph' object has no attribute 'nodes_iter'" (or edges_iter, degree_iter)?

networkx 2.0 (2017-09-20) removed every *_iter method. Call the method without _iter: G.nodes(), G.edges(), G.degree(), G.neighbors(n); they return views or iterators. G.edge also went in 2.0: use G.adj (G.adj[u][v] is the edge data dict).

How do I fix "module 'networkx' has no attribute 'info'"?

networkx 3.0 removed nx.info. print(G) gives the same one-line summary ('Graph with 3 nodes and 2 edges'); use G.number_of_nodes() and G.number_of_edges() for the numbers.

Sources

The same data as JSON: networkx_names.json, licensed CC BY 4.0.

Related: "module 'numpy' has no attribute 'float_'" · "cannot import name 'triu' from 'scipy.linalg'" · "module 'matplotlib.cm' has no attribute 'get_cmap'".