Normally I would use
GraphViz by itself, and pass it options as to how to draw nodes and connectors, but
GraphViz::Data::Grapher doesn't expose those options.
Reading the code here is a horribly hackish way to pass
GraphViz options to
GraphViz::Data::Grapher:
use strict;
use warnings;
use GraphViz;
use GraphViz::Data::Grapher;
my %othergraphvizopts = ( compress => 1 );
my $structure = [ 'a', 'b', 'c', { hi => 'there' } ];
my $g = GraphViz->new(sort => 1, %othergraphvizopts);
GraphViz::Data::Grapher::_init($g, $structure);
print $g->as_png;
That is a horrible hack, but should work.
The
compress => 1 is just an example, consult
GraphViz->new for options. The
sort => 1 is from
GraphViz::Data::Dumper's new
If you use
GraphViz::Data::Structure, it seems like a decent alternative, supports a more concise graph and also lets you pass in options directly to the underlying
GraphViz object or use a pre-constructed
GraphViz object, no hack needed.
use GraphViz;
use GraphViz::Data::Structure;
my %othergraphvizopts = ( compress => 1 );
my $structure = [ 'a', 'b', 'c', { hi => 'there' } ];
my $g = GraphViz->new(%othergraphvizopts);
my $g1 = GraphViz::Data::Structure->new($structure, GraphViz => $g);
print $g->as_png;