If you haven't done so, please read the Overview first.
This chapter describes the possible output formats and their limitations, strengths and weaknesses.
Formats
Graph::Easy layout graphs in the following output formats:
- ASCII - creates an ASCII art "drawing" of the graph
- Box Art - uses Unicode "box drawing" characters to create a textual "drawing"
- HTML - outputs HTML+CSS code (actually a big table) to render the graph in your browser
- SVG - creates Scalable Vector Graphics output
In addition, the graph can be dumped in any of the following graph description languages:
- txt - Graph::Easy's own textual description, parsable by Graph::Easy::Parser
- graphviz - text in the Graphviz langauge. This can be feed to external programs like dot to generate PNG, SVG etc.
- GraphML - the GraphML format as described at http://graphml.graphdrawing.org/
ASCII
The ASCII output is limited to only two colors, one for the foreground, and one for the background.
  #============================================#
  H                                            v
+---------+     ........     +---------+     +--------+     +--------+
| Bautzen | --> : Bonn : --> | Koblenz | --> | Berlin | --> | Kassel |
+---------+     :......:     +---------+     +--------+     +--------+
  ^               |            ^               ^
  :               +------------+---------------+
  :                            |
  :             +------+       |
  ............. | Ulm  | ------+
                +------+
The following limitations apply:
- The edge arrows are always rendered open, regardless of the actual arrow style.
- Node shapes with slanted or round borders are not yet supported.
- Edge styles bold,broadandwideare all rendered with '#' and thus look the same.
Box Art
Works like the ASCII output, but uses Unicode
"box drawing" characters instead. This creates gap-less edges, and looks
generally much better.
Box art output shares most of the limitations with the ASCII output,
except:
- corners on borders look better
- rounded node borders are supported
- the different arrow-styles work
- edge styles bold,broadandwidework
                                My sample graph
                                             Test
                                             label
            ┌···············································┐
            :                                               v
          ┌─────────────┐  label   ▛▀▀▀▀▀▀▜               ┌───────┐
          │     One     │ ───────> ▌ Two  ▐ ▬▬▬▬▬▬▬▬▬▬▬▬> │ Four  │ ···   None
          └─────────────┘          ▙▄▄▄▄▄▄▟               └───────┘
            ║                                Test label
            ║                        ┌╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴╴┐
            v                        ╵                      v
          ┌−−−−−−−−−−−−−┐          ████████               ┏━━━━━━━┓     ┌───────┐
  ┌·······╎    Three    ╎ <══════> █ Five █ ────────────> ┃ Seven ┃ ─── │ Eight │
  :       └−−−−−−−−−−−−−┘          ████████               ┗━━━━━━━┛     └───────┘
  :         ^                        │                                    ^
  :         │                        │                                    │
  : Test    │ Test label             └────────────────────────────────────┘
  : label   v
  :       ┌─────────────┐
  :       │    Sixty    │
  :       │    Six      │
  :       │    and      │
  └······>│    six      │
          └─────────────┘
HTML
The following table shows the main features and their support in the main browsers.
| Feature | Opera | Mozilla Firefox | Konqueror | IE | 
|---|---|---|---|---|
| Node shapes: rounded, circle, ellipse | No | Yes | No | No | 
| Nodes with angled borders: diamond, house, triangle, etc. | No | Yes | Yes | 5.x + | 
| Node shape: point | Yes | Yes | Yes | 5.x + | 
| Gapless edges | Yes | Yes | Yes | Yes | 
| Padding between graph content and border | Yes | Yes | 3.4 + | No | 
Here is a sample graph:
| Test label | |||||||||||||||||||||||||||||||
| v | |||||||||||||||||||||||||||||||
| > | Five | > | Seven | Eight | None | ||||||||||||||||||||||||||
| ^ | |||||||||||||||||||||||||||||||
| > | Three | < | One | label | > | Two | > | Four | |||||||||||||||||||||||
| ^ | Test label | ^ | |||||||||||||||||||||||||||||
| Test label | |||||||||||||||||||||||||||||||
| v | |||||||||||||||||||||||||||||||
| Six | |||||||||||||||||||||||||||||||
Notes:
- Nodes with shape point: are always drawn solid, e.g. their outline and interiour have the same color.
- Edge arrows can be open or closed, but a different fill color will not show.
SVG
Please see the SVG example page.
Graphviz
Graph::Easy also allows the output of Graphviz code, which can be feed to an
external program like dot or neato to create
.png, .ps, .svg or many other
file formats:
perl examples/as_graphviz my_graph.txt | dot -Tpng -o graph.png perl examples/as_graphviz my_graph.txt | dot -Tsvg -o graph.svg
The output to graphviz does not yet take some features of
Graph::Easy into account. The reason is that graphviz works
differently than Graph::Easy and at the moment there seems no
easy way to implement this. Here is a short list of features that are incomplete:
- nodes that are placed relatively to each other
- multi-celled nodes (labels like "{ A | B }" could emulate this)
- per-node flow directions (flow for the entire graph will work, though)
In addition, the following output styles are not yet supported. These probably can be emulated with some graphviz-fu, but there was not enough time to find out how:
- node border-styles: wave, dot-dot-dash and dot-dash
- edge-styles: wave, dot-dot-dash and dot-dash
- filled edge arrows with different fill colors
- node shape: point with other point-styles than "circle"
- text-styles like bold, italic, underline, overline, strike-through
- alignment for certain types of labels
Note that unlike with the other output methods, Graph::Easy has less control
over the layout when outputting graphviz code. Sometimes this improves
graph layout, because dot et. al. are not restricted to a grid-like
layout, but certain features might be rendered quite differently
by dot than by Graph::Easy.
Especially the per-node and per-edge flow and relatively placed nodes
will likely be lost in the generated graphviz code.
If you are familiar with graphviz code and want to improve the output
of Graph::Easy, please drop me a message.
GraphML
GraphML is an XML-based text format for describing graphs.
More details about GraphML can be found at the GraphML
homepage.