networkx

Python library for creating, manipulating, and analyzing complex networks and graphs.

Library
PyPI
v3.6.1
17,250stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
92/100Excellent
Development Activity96
Maintenance84
Community88
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
88/100Excellent
Architecture88
Code Quality90
Innovation85
Learning Curve88

NetworkX is a pure-Python library for creating, manipulating, and studying the structure, dynamics, and functions of graphs and complex networks. It ships Graph, DiGraph, MultiGraph, and MultiDiGraph classes that accept any hashable object as a node, plus over a hundred modules of built-in algorithms covering shortest paths, centrality, flow, community detection, isomorphism, and approximation.

Beyond the core data structures and algorithms, NetworkX interoperates with the wider scientific Python stack through conversions to and from NumPy arrays, SciPy sparse matrices, and pandas DataFrames, and it can read and write common graph formats like GEXF, GraphML, and JSON. A pluggable backend-dispatch system also lets GPU- or Rust-accelerated packages transparently replace its default pure-Python execution for the same function calls.

What You Get

  • Graph, DiGraph, MultiGraph, and MultiDiGraph classes with a consistent adjacency-view API and support for any hashable node type
  • 100+ modules of built-in graph algorithms spanning shortest paths, centrality, flow, community detection, isomorphism, coloring, and approximation
  • Read/write support for common graph file formats including GEXF, GraphML, JSON, and adjacency/edge lists
  • Direct conversion to and from NumPy arrays, SciPy sparse matrices, and pandas DataFrames
  • A pluggable backend-dispatch system (nx-cugraph, nx-parallel, graphblas-algorithms) for GPU- or Rust-accelerated execution without changing calling code

Common Use Cases

  • Analyzing social networks and community structure
  • Modeling and optimizing transportation, logistics, and infrastructure networks
  • Representing biological networks such as protein interactions or gene regulation for structural analysis
  • Teaching and prototyping graph theory and network science concepts

Under The Hood

Architecture NetworkX centers its data model on the Graph/DiGraph/MultiGraph/MultiDiGraph classes in networkx/classes/, each built on adjacency dictionaries (_adj, _node) wrapped by cached-property “views” (AdjacencyView, NodeView, EdgeView, DegreeView in reportviews.py/coreviews.py) that provide read-only, memoized access invalidated by custom descriptor classes whenever the underlying dict is reassigned. Algorithms live in a large networkx/algorithms/ package (100+ modules and subpackages: centrality, community, connectivity, flow, isomorphism, shortest_paths, tree, approximation) that operate on the graph classes purely through their public view API, cleanly separating data structure from algorithm code. A notable architectural layer, networkx/utils/backends.py, implements a dispatch mechanism registered via a networkx.backends entry-point group that lets external packages (nx-cugraph, graphblas-algorithms, nx-parallel) transparently swap in GPU- or Rust-accelerated implementations for the same function signatures — this backend-dispatch layer is also the biggest surface of architectural risk, since changing the core view-API contracts would ripple into every registered backend.

Tech Stack NetworkX is pure Python (100% of the codebase), targeting Python >=3.12 with a setuptools build backend and zero required runtime dependencies — optional extras add numpy, scipy, matplotlib, and pandas under a default extra for array conversion, sparse-matrix support, and plotting. There’s no server or ORM layer since it’s a standalone data-structure/algorithms library. Testing runs on pytest with pytest-cov and pytest-xdist plus doctest-modules integration; Ruff handles linting/formatting and mypy handles type-checking. The project dual-manages environments with plain pip/venv and Pixi, which defines per-Python-version test/lint/doc/benchmark environments. CI spans GitHub Actions (test, lint, mypy, benchmark workflows) and CircleCI for documentation builds, with releases packaged via build/twine.

Code Quality Every algorithms subpackage carries a co-located tests/ directory, and pytest is configured with filterwarnings = ["error"], turning any unexpected warning into a test failure. Docstrings follow numpydoc conventions and are exercised directly as doctests, so documentation examples are continuously verified against the real API. Mypy runs project-wide in CI, though a couple of view modules are explicitly excluded from strict checking, reflecting some dynamic, metaprogramming-heavy code that resists static typing. Ruff enforces import sorting, comprehension style, and numpy-specific lint rules, and pre-commit hooks gate contributions. Overall this reads as a mature, well-tested, typed-where-practical codebase with strong CI enforcement.

API Design The public API centers on a small, consistent surface — Graph, DiGraph, and their multi-edge variants — with algorithms exposed as plain functions taking a graph as their first argument, keeping the learning curve shallow for anyone familiar with basic graph theory. Nodes and edges accept arbitrary hashable objects and attribute dictionaries without any schema, which lowers boilerplate for quick prototyping but pushes some type-safety responsibility onto the caller. Extensive numpydoc docstrings, doctest-verified examples, and a large example gallery make the API self-documenting, and the backend-dispatch design keeps the same function signatures usable whether the caller has installed acceleration packages or not.

Used by 12 apps in this directory

HTML
85%
Apache 2.0

Elementary

Data Engineering · Monitoring · Analytics

2,405

The dbt-native data observability CLI that turns your existing dbt tests and metadata into anomaly detection, lineage graphs, and Slack/Teams alerts — no separate platform required.

View details
81
Repo Health
75
Technical
79
Dependency
Built with
HTML85%
Python15%
Updated yesterday
TypeScript
53%
Apache 2.0

Flowsint

Automation · Developer Tools

7,800

A privacy-first, graph-based OSINT investigation platform with 30+ automated enrichers for mapping relationships between domains, IPs, people, and organizations.

View details
85
Repo Health
71
Technical
70
Dependency
Built with
TypeScript53%
Python44%
Updated yesterday
Python
100%
MIT

Graphify

AI Agents

115,361

A YC-backed, open-source knowledge graph skill for AI coding assistants — type /graphify and it maps your entire project (code, docs, PDFs, images, videos) into a queryable graph instead of grepping through files.

View details
82
Repo Health
73
Technical
72
Dependency
Built with
Python100%
Updated 2 days ago
TypeScript
91%
Apache 2.0

Helicone

Monitoring · AI Development · Analytics

6,133

An open-source AI gateway and LLM observability platform that routes requests to 100+ models while logging cost, latency, and full traces for every call.

View details
69
Repo Health
81
Technical
65
Dependency
Built with
TypeScript91%
Updated 1 weeks ago
Python
85%
Apache 2.0

knowhere

AI Development · Developer Tools

2,942

Transform messy, unstructured documents into persistent, navigable memory that AI agents can actually use.

View details
83
Repo Health
75
Technical
69
Dependency
Built with
Python85%
HTML15%
Updated yesterday
Python
68%
MIT

Langflow

AI Agents · AI Development

154,349

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python68%
TypeScript23%
Updated today
Python
61%
Apache 2.0

marimo

Developer Tools · Data Engineering

22,670

A reactive Python notebook that eliminates hidden state, runs reproducibly, and deploys as a web app or script — stored as pure Python, built for the AI era.

View details
90
Repo Health
91
Technical
65
Dependency
Built with
Python61%
TypeScript37%
Updated yesterday
C++
66%
Other

Memgraph

Databases · AI Development

4,392

High-performance in-memory graph database for AI context and real-time analytics

View details
90
Repo Health
79
Technical
69
Dependency
Built with
C++66%
Python18%
Updated yesterday
Python
99%
Apache 2.0

Rasa Open Source

AI Assistants · AI Development

21,315

Rasa Open Source is a Python machine learning framework for building contextual, multi-turn chatbots and voice assistants that understand natural language and maintain conversation state.

View details
65
Repo Health
78
Technical
63
Dependency
Built with
Python99%
Updated 1 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search