pygraphviz
Python interface to Graphviz
What it is and what it does
PyGraphviz is a Python binding to the Graphviz graph layout and visualization toolkit. It lets you construct graphs programmatically, apply Graphviz's sophisticated layout algorithms, and render them to various formats. The package wraps Graphviz's C libraries through compiled extensions, so it requires both the Python package and the underlying Graphviz system library to function.
The API mirrors NetworkX's design, making it familiar to developers already working with network libraries. You build graphs by adding nodes and edges, then use Graphviz's algorithms to compute layouts and generate visual output. It's commonly used for network diagrams, dependency graphs, and scientific visualization where automatic layout is valuable.
Use it for:
- Generate network topology diagrams and system architecture visualizations from Python data structures.
- Render dependency graphs for software projects, showing build or import relationships.
- Create scientific and mathematical graph visualizations with automatic layout algorithms.
- Build flowcharts and state diagrams programmatically from application logic.
- Export graph data to multiple formats (PNG, SVG, PDF) for reports and documentation.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyGraphviz provides a Python interface to Graphviz, enabling you to create, edit, read, write, and draw graphs using Graphviz's layout algorithms and visualization engine.
Yes, if you need graph visualization with automatic layout. PyGraphviz is actively maintained, has no known vulnerabilities, and offers permissive licensing. The medium install friction (compiled C bindings, system Graphviz dependency) is a real but manageable hurdle; prebuilt wheels for modern Python versions ease deployment. Worth installing for network analysis, diagram generation, and scientific visualization tasks.
Install
pygraphviz on PyPI
pip
pip install pygraphvizuv
uv add pygraphvizpoetry
poetry add pygraphvizInstalling pygraphviz
Before you install
Medium install friction due to compiled C bindings to the Graphviz library. Prebuilt wheels are available for Python 3.10–3.14 on macOS, Linux, and Windows, but the underlying Graphviz system library must be present. Repository is actively maintained with recent commits.
License in practice
Released under BSD-3-Clause (permissive). Binary wheels bundle Graphviz libraries separately licensed under Eclipse Public License v2.0; review the bundled LICENSE.graphviz if that matters for your use case.
Quickstart
import pygraphviz as pgv
G = pgv.AGraph()
G.add_node("a")
G.add_edge("b", "c")
print(G)
Graphviz system library must be installed on your system; PyPI wheels bundle it but your environment must support the compiled C extension.
Verify before relying
- Whether Graphviz is automatically available in all wheel distributions or requires separate system installation on some platforms.
- Performance characteristics and scalability limits for large graphs.
- Compatibility with PyPy beyond the classifier listing.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 25 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,286,036/month — #2,341 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pygraphviz-2.0.1-cp310-cp310-macosx_11_0_arm64.whl; pygraphviz-2.0.1-cp310-cp310-macosx_11_0_x86_64.whl; pygraphviz-2.0.1-cp310-cp310-manylinux_2_28_aarch64.whl; pygraphviz-2.0.1-cp310-cp310-manylinux_2_28_x86_64.whl; pygraphviz-2.0.1-cp310-cp310-win_amd64.whl; pygraphviz-2.0.1-cp311-cp311-macosx_11_0_arm64.whl; pygraphviz-2.0.1-cp311-cp311-macosx_11_0_x86_64.whl; pygraphviz-2.0.1-cp311-cp311-manylinux_2_28_aarch64.whl; pygraphviz-2.0.1-cp311-cp311-manylinux_2_28_x86_64.whl; pygraphviz-2.0.1-cp311-cp311-win_amd64.whl; pygraphviz-2.0.1-cp312-cp312-macosx_11_0_arm64.whl; pygraphviz-2.0.1-cp312-cp312-macosx_11_0_x86_64.whl; pygraphviz-2.0.1-cp312-cp312-manylinux_2_28_aarch64.whl; pygraphviz-2.0.1-cp312-cp312-manylinux_2_28_x86_64.whl; pygraphviz-2.0.1-cp312-cp312-win_amd64.whl; pygraphviz-2.0.1-cp313-cp313-macosx_11_0_arm64.whl; pygraphviz-2.0.1-cp313-cp313-macosx_11_0_x86_64.whl; pygraphviz-2.0.1-cp313-cp313-manylinux_2_28_aarch64.whl; pygraphviz-2.0.1-cp313-cp313-manylinux_2_28_x86_64.whl; pygraphviz-2.0.1-cp313-cp313-win_amd64.whl
Keywords: Networks, Graph Visualization, network, graph, graph drawing
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
graphvizGenerates DOT language source code for graph…
permissive · top 1,000 on PyPI
pygexfPygexf writes network graph data to GEXF (Graph…
unclear · top 15,000 on PyPI
pyvisPyvis creates interactive network graph…
permissive · top 5,000 on PyPI
planarityTests whether a graph is planar, computes…
permissive · top 15,000 on PyPI
networkxNetworkX provides data structures and…
permissive · top 1,000 on PyPI
pydotplusPyDotPlus provides a Python interface to…
permissive · top 15,000 on PyPI
torchvizGenerates visual diagrams of PyTorch neural…
permissive · top 5,000 on PyPI
GvGenGvGen generates Graphviz dot files…
permissive · top 15,000 on PyPI
pydotpydot is a Python interface to Graphviz that…
permissive · top 1,000 on PyPI
objgraphObjgraph lets you visualize and explore Python…
permissive · top 5,000 on PyPI