jrfonseca / xdot.py

Interactive viewer for graphs written in Graphviz's dot language.
GNU Lesser General Public License v3.0
870 stars 146 forks source link
graphviz gtk python xdot

About xdot.py

xdot.py is an interactive viewer for graphs written in Graphviz's dot language.

It uses internally the GraphViz's xdot output format as an intermediate format, Python GTK bindings, and Cairo for rendering.

xdot.py can be used either as a standalone application from command line, or as a library embedded in your Python application.

Status

xdot.py script became much more popular than I ever anticipated, and there are several interested in improving it further. However, for several years now, xdot.py already meets my own needs, and unfortunately I don't have much time for maintaining it myself.

So I'm looking into transition xdot.py maintenance to others: either hand over the maintenance xdot.py to a community or indicate an official fork of xdot.py.

I encourage people interested in development of xdot.py to fork the GitHub repository, and join the new mailing list.

Features

Known Issues

See also:

Screenshots

Profile 1 Screenshot Profile 2 Screenshot Control Flow Graph

Requirements

Windows users

Download and install:

Debian/Ubuntu users

Run:

apt install gir1.2-gtk-3.0 python3-gi python3-gi-cairo python3-numpy graphviz

Usage

Command Line

If you install xdot.py from PyPI or from your Linux distribution package managing system, you should have the xdot somewhere in your PATH automatically.

When running xdot.py from its source tree, you can run it by first setting PYTHONPATH environment variable to the full path of xdot.py's source tree, then running:

python3 -m xdot

You can also pass the following options:

Usage:
    xdot.py [file|-]

Options:
  -h, --help            show this help message and exit
  -f FILTER, --filter=FILTER
                        graphviz filter: dot, neato, twopi, circo, or fdp
                        [default: dot]
  -n, --no-filter       assume input is already filtered into xdot format (use
                        e.g. dot -Txdot)
  -g GEOMETRY           default window size in form WxH

Shortcuts:
  Up, Down, Left, Right     scroll
  PageUp, +, =              zoom in
  PageDown, -               zoom out
  R                         reload dot file
  F                         find
  Q                         quit
  P                         print
  T                         toggle toolbar
  W                         zoom to fit
  Escape                    halt animation
  Ctrl-drag                 zoom in/out
  Shift-drag                zooms an area
  Click (on edge)           focus edge's source node
  Ctrl-click (on edge)      focus edge's *destination* node

If - is given as input file then xdot.py will read the dot graph from the standard input.

Embedding

See included sample.py script for an example of how to embedded xdot.py into another application.

Screenshot

Download

Links