NetworkX creates, manipulates, and analyzes graphs and multigraphs in Python, with standard algorithms and flexible node and edge data.
Overview
NetworkX is a Python package for working with graphs, digraphs, and multigraphs in code. It supports building networks, running common graph algorithms, and measuring structure and dynamics on complex networks.
Data structures accept flexible node and edge payloads, so vertices and edges can carry text, numbers, or other Python objects. The library includes generators for classic, random, and synthetic networks alongside utilities for shortest paths, centrality, clustering, and many other analyses.
It is designed for fast prototyping and teaching, runs across platforms supported by Python, and ships with broad automated test coverage. Documentation and tutorials cover installation, examples such as weighted shortest paths, and contribution workflows through the project website.
Install via pip with optional dependency bundles for default extras. Releases follow a stable versioning line with separate development documentation for upcoming features.
Key features
- Graph, digraph, and multigraph types
- Standard graph algorithms
- Network structure metrics
- Classic and random graph generators
- Arbitrary node and edge attributes
- Shortest path and traversal utilities
- BSD-licensed Python package
- Documented API and tutorials
Use cases
- Analyzing social or infrastructure networks
- Teaching graph theory in Python
- Prototyping network algorithms
- Building pipelines that need graph data structures