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 --input=graph.dot --as_ascii graph-easy --html --output=graph.html graph.txt graph-easy graph.txt graph.svg graph-easy graph.txt --as_dot | dot -Tpng -o graph.png graph-easy graph.txt --as_png graph-easy graph.vcg --as_dot graph-easy graph.dot --gdl
Print the full documentation, not just a short overview.
Specify the input file name. Example:
graph-easy --input=input.txt
The format of the input will be detected automatically, but you can override this detection 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 boxart html svg graphviz the DOT language dot an alias for "graphviz" txt Graph::Easy text vcg VCG (a subset of GDL) text gdl GDL (Graph Description Language) text png a PNG file rendered via "dot"
If unspecified, the default format will be determined by the output filename extension, and is ascii, if the output filename was not set.
ascii
Note that you can also use ONE argument of the form --as_ascii, --as_svg and so on.
--as_ascii
--as_svg
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.
Note that you can also use ONE argument of the form --from_graphviz or --from_txt instead of --from.
--from
Write info regarding the conversion process to STDERR.
Write debugging info to STDERR. Warning, this can create huge amounts of hard-to-understand output!
Example:
graph-easy input.txt --output=test.html --debug=1
Input will only be parsed, without any output generation. This is usefull in combination with --debug=1.
--debug=1
graph-easy input.txt --parse --debug=1
Set the timeout in seconds for the layouter. If the layout does not finish in this time, it will be aborted.
graph-easy input.txt --timeout=500
This option is mainly intended for things that are routed through the layouter of Graph::Easy, because this layouter can sometimes get stuck and use a lot of time. Simple conversions between the different graph text formats are still subject to the set timeout, but this conversion usually finishes in way under one second.
graph-easy reads a description of a graph (a connected network of nodes and edges, not a pie chart :-) and then convert this to the desired output format.
graph-easy
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:
Graph::Easy http://bloodgate.com/perl/graph/manual/ DOT http://www.graphviz.org/ VCG http://rw4.cs.uni-sb.de/~sander/html/gsvcg1.html GDL http://www.aisee.com/
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 either be a dump of the graph in one of the input formats (Graph::Easy, Graphviz, VCG/GDL), or a layout (rendering) of the graph in one of the following output formats implemented by Graph::Easy:
Graph::Easy
HTML SVG ASCII BOXART
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:
dot
graph-easy graph.txt --as_dot | dot -Tpng -o graph.png graph-easy graph.txt --as_png
echo "[ Bonn ] -- car --> [ Berlin ], [ Ulm ]" | graph-easy --as=ascii +--------+ car +-----+ | Bonn | -----> | Ulm | +--------+ +-----+ | | car v +--------+ | Berlin | +--------+
echo "[ Bonn ] -- car --> [ Berlin ], [ Ulm ]" | graph-easy --as=dot digraph GRAPH_0 { edge [ arrowhead=open ]; graph [ rankdir=LR ]; node [ fontsize=11, fillcolor=white, style=filled, shape=box ]; Bonn -> Ulm [ label=car ] Bonn -> Berlin [ label=car ] }
echo "[ Bonn ] -- car --> [ Berlin ], [ Ulm ]" | graph-easy --as=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 (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 --as=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" } }
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 (http://colorbrewer.org/). See the LICENSE file for the full license text that applies to these color schemes.
Copyright (C) 2004 - 2007 by Tels http://bloodgate.com
More information can be found in the online manual of Graph::Easy:
http://bloodgate.com/perl/graph/manual/
See also: Graph::Easy, Graph::Easy::Manual
To install Graph::Easy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Graph::Easy
CPAN shell
perl -MCPAN -e shell install Graph::Easy
For more information on module installation, please visit the detailed CPAN module installation guide.