Dot::Writer
use Dot::Writer qw(write_dot); write_dot({ name => "MyGraph", graph => \%graph, colors => \%colors, out => "outfile" }); # Or you can use a hash my $options = { name => "MyGraph", graph => \%graph, node_attr => \%colors, out => "outfile" }; write_dot($options);
This module writes DOT files. To do it, it needs at least two arguments (graph and out). The "colors" and "name" arguments are optional.
Name of the graph to write on the graph initialization statement.
digraph MyGraph { ... }
A hash reference with the graph. It should have the following structure:
%hash = ( parent1 => child1 = "color|attr1|attr2|..." => child2 = "color|attr1|attr2|..." parent2 => child3 = "color|attr1|attr2|..." => child4 = "color|attr1|attr2|..." ... )
A hash ref with the colors for each node.The keys should be the node IDs of your nodes. This argument is optional. If not set, no color will be specified.
A file to write it
To install Dot::Parser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dot::Parser
CPAN shell
perl -MCPAN -e shell install Dot::Parser
For more information on module installation, please visit the detailed CPAN module installation guide.