Yes it is possible. See cluster2.pl example in GraphViz CPAN module.
#!/usr/bin/perl use strict; use warnings; use GraphViz; my $g = GraphViz->new(); my @default_attrs = ( fontsize => '8', fontname => 'arial', ); my $eurocluster = {name=>'Europe', style=>'filled', fillcolor=>'lightgray', fontname=>'arial', fontsize=>'12', }; $g->add_node('London', cluster=>$eurocluster, @default_attrs); $g->add_node('Paris', cluster=>$eurocluster, @default_attrs); $g->add_node('New York', @default_attrs); $g->add_edge('London' => 'Paris', @default_attrs); $g->add_edge('London' => 'New York', label => 'Far', @default_attrs); $g->add_edge('Paris' => 'London', @default_attrs); $g->as_gif("nodes.gif"); $g->as_dot("nodes.dot");
That is the result nodes.dot files
digraph test { graph [ratio=fill]; node [label="\N"]; graph [bb="0,0,150,174"]; subgraph cluster_Europe { graph [fillcolor=lightgray, fontname=arial, fontsize=12, label=Europe, style=filled, bb="8,8,78,166"]; London [label=London, fontname=arial, fontsize=8, pos="43,118" +, width="0.75", height="0.5"]; Paris [label=Paris, fontname=arial, fontsize=8, pos="43,34", w +idth="0.75", height="0.5"]; London -> Paris [fontname=arial, fontsize=8, pos="e,37.367,51. +789 37.364,100.19 36.203,89.049 35.949,74.471 36.604,61.831"]; Paris -> London [fontname=arial, fontsize=8, pos="e,48.636,100 +.19 48.633,51.789 49.796,62.92 50.051,77.497 49.398,90.14"]; } "New York" [label="New York", fontname=arial, fontsize=8, pos="119 +,34", width="0.86111", height="0.5"]; London -> "New York" [fontname=arial, fontsize=8, label=Far, pos=" +e,104.51,50.015 57.295,102.2 68.687,89.609 84.811,71.787 97.72,57.52" +, lp="91.5,76"]; }

In reply to Re: Module GraphViz : make subgraphs ? by djibel
in thread Module GraphViz : make subgraphs ? by odrevet

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.