altgraph
Python graph (network) package
What it is and what it does
altgraph is a Python graph library descended from graphlib, providing data structures and algorithms for building and analyzing directed and undirected networks. It offers core graph operations—breadth-first and depth-first traversal, topological sorting, shortest-path computation—and can export graphs in graphviz format for visualization. The package has no runtime dependencies and supports Python 2.7 and Python 3.4 through 3.14.
The library is primarily used as a dependency in tools like py2app and macholib for analyzing module and binary dependencies. It is stable and widely deployed (over 12 million monthly downloads), though maintenance is aging—the last release was 266 days ago. For straightforward graph construction and traversal tasks, it remains a lightweight, dependency-free choice.
Use it for:
- Analyze module dependencies in Python applications or build tools
- Perform graph traversals and topological sorting on network data
- Export graph structures to graphviz for visualization and debugging
- Build dependency graphs for build systems or package managers
- Compute shortest paths and connectivity in directed networks
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
altgraph constructs and analyzes graphs (networks), supporting BFS and DFS traversals, topological sorting, shortest paths, and graphviz output.
Yes. altgraph is a stable, lightweight, zero-dependency library with permissive licensing and no known vulnerabilities. Install it when you need core graph algorithms and traversal operations. The aging maintenance status (last release 266 days ago) is not a blocker for stable use, but monitor the repository if you require active development or new features.
Install
altgraph on PyPI
pip
pip install altgraphuv
uv add altgraphpoetry
poetry add altgraphInstalling altgraph
Before you install
Low install friction with no runtime dependencies. Maintenance status is aging—last release was 266 days ago—but the repository remains active and the package is widely used (top 5000 on PyPI).
License in practice
MIT license (permissive) means you can use, modify, and distribute altgraph freely in commercial and private projects with minimal restrictions.
Quickstart
pip install altgraph
from altgraph.Graph import Graph
g = Graph()
g.add_node('a')
g.add_node('b')
g.add_edge('a', 'b')
print(g.nodes())
Verify before relying
- Whether graphviz must be installed separately for output functionality to work
- Current performance characteristics for large graphs (node/edge scale limits)
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 266 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 12,333,630/month — #1,326 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: altgraph-0.17.5-py2.py3-none-any.whl
Keywords: graph
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
modulegraphmodulegraph analyzes Python module dependencies…
permissive · top 15,000 on PyPI
objectgraphObjectgraph provides a Python class for…
permissive · top 15,000 on PyPI
toposortImplements topological sorting of directed…
permissive · top 5,000 on PyPI
rustworkxA high-performance graph library for Python,…
permissive · top 5,000 on PyPI
DijkstarDijkstar implements Dijkstra's shortest-path…
permissive · top 15,000 on PyPI
networkxNetworkX provides data structures and…
permissive · top 1,000 on PyPI
retworkxA deprecated package name for rustworkx, a…
permissive · top 15,000 on PyPI
objgraphObjgraph lets you visualize and explore Python…
permissive · top 5,000 on PyPI
grandalfGrandalf computes node coordinates and routes…
copyleft · top 5,000 on PyPI
modulegraph2Modulegraph2 builds and introspects a…
permissive · top 15,000 on PyPI