Skip to main content

Latest PyPI Version License Downloads

This package facilitates the creation of graph descriptions in the DOT language of the Graphviz graph drawing software from Python.

Create a graph object, assemble the graph by adding nodes and edges, and retrieve its DOT source code string. Save the source code to a file and compile it with the Graphviz installation of your system.

Installation

$ pip install graphviz

To compile the generated DOT source code, you also need to install Graphviz (download page).

Make sure that the dot executable is on your systems’ path.

Usage

Create a graph object:

>>> from graphviz import Digraph

>>> dot = Digraph(comment='The Round Table')

>>> dot  #doctest: +ELLIPSIS
<graphviz.dot.Digraph object at 0x...>

Add nodes and edges:

>>> dot.node('A', 'King Arthur')
>>> dot.node('B', 'Sir Bedevere the Wise')
>>> dot.node('L', 'Sir Lancelot the Brave')

>>> dot.edges(['AB', 'AL'])
>>> dot.edge('B', 'L', constraint='false')

Check the generated source code:

>>> print dot.source  # doctest: +NORMALIZE_WHITESPACE
// The Round Table
digraph {
    A [label="King Arthur"]
    B [label="Sir Bedevere the Wise"]
    L [label="Sir Lancelot the Brave"]
        A -> B
        A -> L
        B -> L [constraint=false]
}

Save and render the source code, optionally view the result:

>>> dot.render('round-table.gv', view=True)
'round-table.gv.pdf'
https://raw.github.com/xflr6/graphviz/master/docs/round-table.png

See also

License

This package is distributed under the MIT license.

Metadata

Release files for graphviz 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graphviz 0.2.2
File Size Uploaded
graphviz-0.2.2.zip 25.4 kB Details

Release files / graphviz-0.2.2.zip

Download URL graphviz-0.2.2.zip
Size 25.4 kB
Tags Source
SHA-256 checksum
How to use checksums
49a6b7a2d6e95d837d8796d03f70b97392ada0e337bc3fcc929ad1a3fe167f8d
BLAKE2b-256 checksum
How to use checksums
a88a38dfe0f67a2f720437808205004d636dbb554194888234fb6b97629d6e12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.21

2 release files

0.20.3

2 release files

0.20.2

2 release files

0.20.1

2 release files

0.20

2 release files

0.19.1

2 release files

0.19

2 release files

0.18.2

2 release files

0.18.1

2 release files

0.18

2 release files

0.17

2 release files

0.16

2 release files

0.15

2 release files

0.14.1

2 release files

0.14

2 release files

0.13

2 release files

0.12

2 release files

0.11

2 release files

0.10.1

2 release files

0.10

2 release files

0.9

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8

2 release files

0.7.1

2 release files

0.7

2 release files

0.6

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5

2 release files

0.4.10

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

1 release file

0.3.1

1 release file

0.3

1 release file

This release

0.2.2 This release

1 release file

0.2.1

1 release file

0.2

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page