skillfed

altgraph

Python graph (network) package

altgraph v0.17.5 12.3M downloads/30d#1,326 on PyPI25
Permissive license MIT AGING released

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 altgraph

uv

uv add altgraph

poetry

poetry add altgraph

Installing 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

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: MathematicsTopic :: Scientific/Engineering :: VisualizationTopic :: Software Development :: Libraries :: Python Modules

Tags

graph library pythonnetwork analysis traversaltopological sortshortest path algorithmgraphviz outputbfs dfs graphdirected graph
graph-algorithmsnetwork-analysisdependency-analysis

More Python Modules packages