skillfed

pygraphviz

Python interface to Graphviz

pygraphviz v2.0.1 4.3M downloads/30d#2,341 on PyPI844
Permissive license BSD-3-Clause Active released

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 pygraphviz

uv

uv add pygraphviz

poetry

poetry add pygraphviz

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: Science/ResearchProgramming Language :: CProgramming Language :: PythonProgramming 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 :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Scientific/Engineering :: Information AnalysisTopic :: Scientific/Engineering :: MathematicsTopic :: Scientific/Engineering :: VisualizationTopic :: Software Development :: Libraries :: Python Modules

Tags

graph visualization pythongraphviz python interfacenetwork graph drawinggraph layout algorithmscreate and visualize graphsgraph data structure manipulationnetwork diagram generation
graph-visualizationnetwork-analysisgraphviz-binding

More Python Modules packages