use GraphViz; my $g = GraphViz->new( directed => 1, layout => 'circo', ratio => 'compress', width => 6, height => 6, node => {shape => 'ellipse'}, ); .. add nodes and edges .. my $image = 'foo'; open OUT_FILE, ">$image.png" or die $!; binmode (OUT_FILE); $g->as_png(\*OUT_FILE); close OUT_FILE; my $cmap = $g->as_cmapx; print < test $cmap END