The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


graph-easy - render/convert graphs in/from various formats


Convert between graph formats and layout/render graphs:

        graph-easy [options] [inputfile [outputfile]]

        echo "[ Bonn ] - car -> [ Berlin ]" | graph-easy
        graph-easy --as_ascii
        graph-easy --html --output=mygraph.html graph.txt
        graph-easy graph.txt graph.svg
        graph-easy graph.txt --as_dot | dot -Tpng -o graph.png
        graph-easy graph.txt --png
        graph-easy graph.vcg --dot
        graph-easy --gdl
        graph-easy --graphml


Here are the most important options, more are listed in the full documentation:


Print the full documentation, not just this short overview.


Specify the input file name. Example:

    graph-easy --input=input.txt

The format will be auto-detected, override it with --from.


Specify the output file name. Example:

    graph-easy --output=output.txt input.txt

Specify the output format. Example:

    graph-easy --as=ascii input.txt

Valid formats are:

    ascii       ASCII art rendering
    boxart      Unicode Boxart rendering
    html        HTML
    svg         Scalable Vector Graphics
    graphviz    the DOT language
    dot         alias for "graphviz"
    txt         Graph::Easy text
    vcg         VCG (Visualizing Compiler Graphs - a subset of GDL) text
    gdl         GDL (Graph Description Language) text
    graphml     GraphML

In addition, the following formats are understood and piped through the program specified with the --renderer option (default: dot):

    bmp         Windows bitmap
    gif         GIF 
    hpgl        HP-GL/2 vector graphic
    jpg         JPEG
    pcl         PCL printer language
    pdf         PDF
    png         PNG
    ps          Postscript 
    ps2         Postscript with PDF notations (see graphviz documentation)
    tga         Targa bitmap
    tif         TIFF bitmap

The default format will be determined by the output filename extension, and is ascii, if the output filename was not set.

You can also use ONE argument of the form --as_ascii or --ascii.


Specify the input format. Valid formats are:

    graphviz    the DOT language
    txt         Graph::Easy text
    vcg         VCG text
    gdl         GDL (Graph Description Language) text

If not specified, the input format is auto-detected.

You can also use ONE argument of the form --from_dot, etc.


The external program (default: "dot") used to render the output formats like png, jpg etc. Some choices are "neato", "twopi", "fdp" or "circo".


Input will only be parsed, without any output generation. Useful in combination with --debug=1 or --stats. Example:

    graph-easy input.txt --parse --debug=1

Write various statistics about the input graph to STDERR. Best used in combination with --parse:

    graph-easy input.txt --parse --stats

Set the timeout in seconds for the Graph::Easy layouter that generates ASCII, HTML, SVG or boxart output. If the layout does not finish in this time, it will be aborted. Example:

    graph-easy input.txt --timeout=500

Conversion to DOT, VCG/GDL, GraphML or plain text ignores the timeout.

The default is 240 seconds (4 minutes).


Write info regarding the conversion process to STDERR.


graph-easy reads a description of a graph (a connected network of nodes and edges, not a pie chart :-) and then converts this to the desired output format.

By default, the input will be read from STDIN, and the output will go to STDOUT. The input is expected to be encoded in UTF-8, the output will also be UTF-8.

It understands the following formats as input:


The formats are automatically detected, regardless of the input file name, but you can also explicitely declare your input to be in one specific format.

The output can be a dump of the graph in one of the following formats:


In addition, Graph::Easy can also create layouts of graphs in one of the following output formats:


Note that for SVG output, you need to install the module Graph::Easy::As_svg first.

As a shortcut, you can also specify the output format as 'png', this will cause graph-easy to pipe the input in graphviz format to the dot program to create a PNG file in one step. The following two examples are equivalent:

    graph-easy graph.txt --dot | dot -Tpng -o graph.png
    graph-easy graph.txt --png


graph-easy supports a few more arguments in addition to the ones from above:


Write version info and exit.


Set the debug level (1..3). Warning, this will generate huge amounts of hard to understand output on STDERR. Example:

        graph-easy input.txt --output=test.html --debug=1
--png, --dot, --vcg, --gdl, --txt, --ascii, --boxart, --html, --svg

Given exactly one of these options, produces the desired output format.


ASCII output

        echo "[ Bonn ] -- car --> [ Berlin ], [ Ulm ]" | graph-easy

        +--------+  car   +-----+
        |  Bonn  | -----> | Ulm |
        +--------+        +-----+
          | car
        | Berlin |

Graphviz example output

        echo "[ Bonn ] -- car --> [ Berlin ], [ Ulm ]" | graph-easy --dot
        digraph GRAPH_0 {
          edge [ arrowhead=open ];
          graph [ rankdir=LR ];
          node [
            shape=box ];
          Bonn -> Ulm [ label=car ]
          Bonn -> Berlin [ label=car ]

VCG example output

        echo "[ Bonn ] -- car --> [ Berlin ], [ Ulm ]" | graph-easy --vcg
        graph: {
          title: "Untitled graph"
          node: { title: "Berlin" }
          node: { title: "Bonn" }
          node: { title: "Ulm" }
          edge:  { label: "car" sourcename: "Bonn" targetname: "Ulm" }
          edge:  { label: "car" sourcename: "Bonn" targetname: "Berlin" }

GDL example output

GDL (Graph Description Language) is a superset of VCG, and thus the output will look almost the same as VCG:

        echo "[ Bonn ] -- car --> [ Berlin ], [ Ulm ]" | graph-easy --gdl
        graph: {
          title: "Untitled graph"
          node: { title: "Berlin" }
          node: { title: "Bonn" }
          node: { title: "Ulm" }
          edge:  { label: "car" source: "Bonn" target: "Ulm" }
          edge:  { label: "car" source: "Bonn" target: "Berlin" }


GraphML example output

GraphML is XML:

        echo "[ Bonn ] -- car --> [ Berlin ], [ Ulm ]" | graph-easy --graphml
        <?xml version="1.0" encoding="UTF-8"?>
        <graphml xmlns=""
          <!-- Created by Graph::Easy v0.58 at Mon Aug 20 00:01:25 2007 -->
          <key id="d0" for="edge""label" attr.type="string"/>
          <graph id="G" edgedefault="directed">
            <node id="Berlin"/>
            <node id="Bonn"/>
            <node id="Ulm"/>
            <edge source="Bonn" target="Berlin"/>
              <data key="d0">car</data>
            <edge source="Bonn" target="Ulm"/>
              <data key="d0">car</data>


Please note that it is impossible to convert 100% from one format to another format since every graph language out there has features that are unique to only this language.

In addition, the conversion process always converts the input first into an Graph::Easy graph, and then to the desired output format.

This means that only features and attributes that are actually valid in Graph::Easy are supported yet. Work in making Graph::Easy an universal format supporting as much as possible is still in progress.

Attributes that are not yet supported natively by Graph::Easy are converted to custom attributes with a prefixed x-format-, f.i. x-dot-. Upon output to the same format, these are converted back, but conversion to a different format will lose these attributes.

For a list of what problems still remain, please see the TODO file in the Graph::Easy distribution on CPAN:

If you notice anything wrong, or miss attributes, please file a bug report on

so we can fix it and include the missing things into Graph::Easy!


This library is free software; you can redistribute it and/or modify it under the terms of the GPL.

See the LICENSE file of Graph::Easy for a copy of the GPL.

This product includes color specifications and designs developed by Cynthia Brewer ( See the LICENSE file for the full license text that applies to these color schemes.


Copyright (C) 2004 - 2008 by Tels


More information can be found in the online manual of Graph::Easy:

See also: Graph::Easy, Graph::Easy::Manual