Python graph libraries

Updated Nov 2026

Python graph libraries store networks of nodes and edges and run algorithms such as shortest paths, centrality, and community detection on them. A compiled library stores the graph in native memory with integer node indices rather than as Python objects. These libraries let data scientists and AI agents analyze social networks, knowledge graphs, and dependency graphs.

Popularity

NetworkX has the most monthly downloads in this comparison, at 279.1M.

LibraryMonthly downloadsStarsLast releaseLicense
NetworkX
279.1M
17.4KSep 2026BSD-3-Clause
rustworkx
7.5M
1.8KJul 2026Apache-2.0
igraph
4.3M
1.5KOct 2025GPL-2.0
leidenalg
1.8M
803May 2026GPL-3.0-or-later
python-louvain
361.8K
1.0KJan 2022BSD-3-Clause
NetworKit
191.7K
886Nov 2026MIT
Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

Builds and analyzes graphs with Python objects as nodes.

Downloads / mo
279.1M
Stars
17.4K
Last release
3.7
License
BSD-3-Clause

Strengths

  • Uses meaningful node labels. Use strings or other hashable Python objects directly as nodes.
  • Finds weighted and unweighted paths. Use one interface for directed, undirected, and weighted shortest paths.

Limitations

  • Parallel coverage depends on backend. Unsupported nx-parallel functions fall back to NetworkX.
  • GraphML inputs must be trusted. Only parse GraphML files from trusted sources.

Quickstart

From tutorial.html
$ pip install networkx
import networkx as nx
G = nx.Graph()

G.add_node(1)

NetworkX examples

From open-source projects on GitHub

Builds indexed graphs with arbitrary Python data on nodes and edges.

Downloads / mo
7.5M
Stars
1.8K
Last release
0.18.1
License
Apache-2.0

Strengths

  • Stores Python data on edges. Attach arbitrary Python objects to nodes and edges.
  • Parallelizes all-pairs shortest paths. Dijkstra all-pairs searches use a configurable thread pool.

Limitations

  • Deleted node IDs get reused. Refresh cached node references after deleting and adding nodes.

Quickstart

From introduction.html
$ pip install rustworkx
import rustworkx as rx

G = rx.PyGraph()

G.add_node(1)

rustworkx examples

From open-source projects on GitHub

Builds, analyzes, and exports graphs through indexed vertices.

Downloads / mo
4.3M
Stars
1.5K
Last release
1.0.0
License
GPL-2.0

Strengths

  • Includes Leiden community detection. Find communities with the built-in Leiden algorithm.
  • Reads and writes graph files. Exchange graphs with other tools through supported graph formats.

Limitations

  • Vertex deletion changes later IDs. Store stable labels separately when deleting vertices.

Quickstart

From tutorial.html
$ pip install igraph
import igraph as ig
g = ig.Graph(n=10, edges=[[0, 1], [0, 5]])
print(g)

igraph examples

From open-source projects on GitHub

Detects communities in large networks with the Leiden algorithm.

Downloads / mo
1.8M
Stars
803
Last release
0.12.0
License
GPL-3.0-or-later

Quickstart

From README.rst
$ pip install leidenalg
import leidenalg
import igraph as ig

G = ig.Graph.Erdos_Renyi(100, 0.1);
part = leidenalg.find_partition(G, leidenalg.ModularityVertexPartition);

leidenalg examples

From open-source projects on GitHub

Detects communities with the Louvain algorithm.

Downloads / mo
361.8K
Stars
1.0K
Last release
0.16
License
BSD-3-Clause

Quickstart

From api.html
$ pip install python-louvain
import community as community_louvain
import networkx as nx
G = nx.erdos_renyi_graph(100, 0.01)
partion = community_louvain.best_partition(G)

python-louvain examples

From open-source projects on GitHub

Analyzes networks with parallel graph algorithms exposed to Python.

Downloads / mo
191.7K
Stars
886
Last release
11.3
License
MIT

Strengths

  • Uses multiple CPU cores. Run parallel graph algorithms through the Python API.
  • Generates clustered test graphs. Create clustered random graphs and detect their communities.

Limitations

  • Node labels need integer mappings. Map string identifiers to integer node IDs before building graphs.

Quickstart

From User-Guide.html
$ pip3 install networkit
import networkit as nk

G = nk.Graph(5)

G.addEdge(1, 3)

NetworKit examples

From open-source projects on GitHub

FAQ

NetworkX suits most graph work, with any hashable Python object as a node. rustworkx and igraph suit larger graphs that need compiled algorithms. NetworKit suits very large networks with parallel algorithms.

NetworkX builds and analyzes graphs in pure Python with any hashable object as a node. It includes a broad set of graph algorithms and drawing helpers.

NetworkX keeps nodes as Python objects and suits graphs that change often. igraph identifies vertices by index and suits relatively static networks that need faster analysis.

leidenalg runs the Leiden algorithm and supports multiplex and temporal graph layers. python-louvain runs the Louvain algorithm on an undirected NetworkX graph and returns a node-to-community dictionary.

For coding agents

Found your graph library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official