logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Graph::Writer::GraphViz - GraphViz Writer for Graph object

Author

       Kang-min Liu <gugod@gugod.org>

Credits

       Thanks for RURBAN@cpan.org for noticing tests failure on different platforms.

Description

Graph::Writer::GraphViz is a class for writing out a Graph object with GraphViz module. All GraphViz
       formats should be supported without a problem.

Methods

new()
       Unlike other Graph::Writer modules, this module provide an extra parameter '-format' to new() method, in
       order to save different format.  Other supported GraphViz parameters are -layout, -ranksep, -shape,
       -fontsize, -arrowsize.  Please see the SYNOPSIS for example usage.

       Valid format depends on those GraphViz as_fmt methods on your system, like, 'gif' if you have 'as_gif',
       'text' if you can do 'as_text'.

Name

       Graph::Writer::GraphViz - GraphViz Writer for Graph object

See Also

       Graph, Graph::Writer, GraphViz

Synopsis

         my @v = qw/Alice Bob Crude Dr/;
         my $g = Graph->new(@v);

         my $wr = Graph::Writer::GraphViz->new(-format => 'dot');
         $wr->write_graph($g,'/tmp/graph.simple.dot');

         my $wr_png = Graph::Writer::GraphViz->new(-format => 'png');
         $wr_png->write_graph($g,'/tmp/graph.simple.png');

         Graph::Writer::GraphViz->new(
               -format => 'png',
               -layout => 'twopi',
               -ranksep => 1.5,
               -fontsize => 8
               -edge_color => 'grey',
               -node_color => 'black',
              )->write_graph($g,'/tmp/graph.png');

See Also