Fletch is correct; by your own description, the only code that you posted is not the even the code that produces the warning. Please post more details. Often, when reducing large code to a concise example of a problem, you will find the solution yourself.
That said, I can see a few possible problems.
--- Graph/Writer/Dot.pm_original Fri Jun 14 01:54:05 2002 +++ Graph/Writer/Dot.pm Mon Nov 15 10:31:35 2004 @@ -68,13 +68,15 @@ my %attributes; my @keys; + my $arrow = ($graph->directed) ? '->' : '--'; + my $gname = ($graph->directed) ? 'digraph' : 'graph'; #---------------------------------------------------------------- +--- # If the graph has a 'name' attribute, then we use that for the # name of the digraph instance. Else it's just 'g'. #---------------------------------------------------------------- +--- $gn = $graph->has_attribute('name') ? $graph->get_attribute('name +') : 'g'; - print $FILE "digraph $gn\n{\n"; + print $FILE "$gname $gn\n{\n"; #---------------------------------------------------------------- +--- # Dump out any overall attributes of the graph @@ -114,7 +116,7 @@ while (@edges > 0) { ($from, $to) = splice(@edges, 0, 2); - print $FILE " $from -> $to"; + print $FILE " $from $arrow $to"; %attributes = $graph->get_attributes($from, $to); @keys = grep(exists $attributes{$_}, @{$valid_attributes{'edge'}} +); if (@keys > 0)
#!/usr/bin/perl use warnings 'all'; use strict; use Graph::Undirected; use Graph::Writer::Dot; my @areas = qw( America Britain Chile ); my @verts = qw( Phone_Company Cellular_Networks Government Internet Rural_Users ); my %graph; # Hash of Graph::Undirected objects. foreach my $area (@areas) { $graph{$area} = Graph::Undirected->new(); $graph{$area}->add_vertex($_) foreach @verts; } $graph{America}->add_edge(@verts[0,1]); $graph{America}->add_edge(@verts[1,2]); $graph{America}->add_edge(@verts[3,0]); $graph{America}->add_edge('Government', 'Internet'); $graph{Britain}->add_edge(@verts[0,2]); $graph{Britain}->add_edge(@verts[1,2]); $graph{Britain}->add_edge(@verts[3,2]); for ($graph{Chile}) { $_->add_edge(@verts[0,1]); $_->add_edge(@verts[0,2]); $_->add_edge(@verts[0,3]); $_->add_edge(@verts[1,2]); $_->add_edge(@verts[1,3]); $_->add_edge(@verts[2,3]); } my $writer = Graph::Writer::Dot->new(); foreach my $area (@areas) { $writer->write_graph($graph{$area}, "$area.dot"); }
In reply to Re: creating multiple graphs programmatically
by Util
in thread creating multiple graphs programmatically
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |