Skip Menu |

This queue is for tickets about the GraphViz CPAN distribution.

Report information
The Basics
Id: 11513
Status: resolved
Priority: 0/
Queue: GraphViz

People
Owner: Nobody in particular
Requestors: heather [...] cenic.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.02
Fixed in: (no value)



Subject: Imagemap generation broken for fdp
I'm using the new fdp layout and I get random layouts if I use clusters -- a big problem if you are generating imagemaps. The problem seems to be that the subgraphs get added in a random order. The attached patch first adds all subgraphs to an array, then sorts them, _then_ adds them to the "dot" output.
--- GraphViz.pm.orig Tue Feb 15 10:43:59 2005 +++ GraphViz.pm Tue Feb 15 10:47:48 2005 @@ -1070,6 +1070,7 @@ } } + my @dot_subgraphs=(); foreach my $clustername (sort keys %cluster_nodes) { my $cluster = $clusters{$clustername}; my $attrs; @@ -1094,12 +1095,21 @@ $attrs =~ s/,/;/go; $attrs =~ s/\]$//o; - $dot .= "\tsubgraph cluster_" . $self->_quote_name($name) . " {\n"; - $dot .= "\t\t$attrs;\n"; - $dot .= join "", map { "\t\t" . $self->{NODES}->{$_}->{_code} . _attributes($self->{NODES}->{$_}) . ";\n"; } (@{$cluster_nodes{$cluster}}); - $dot .= $clusters_edge{$cluster} if exists $clusters_edge{$cluster}; - $dot .= "\t}\n"; + my $dot_subgraph .= "\tsubgraph cluster_" . $self->_quote_name($name) . " {\n"; + $dot_subgraph .= "\t\t$attrs;\n"; + $dot_subgraph .= join "", map { "\t\t" . $self->{NODES}->{$_}->{_code} . _attributes($self->{NODES}->{$_}) . ";\n"; } (@{$cluster_nodes{$cluster}}); + $dot_subgraph .= $clusters_edge{$cluster} if exists $clusters_edge{$cluster}; + $dot_subgraph .= "\t}\n"; + + push (@dot_subgraphs, $dot_subgraph); } + +# order the subgraph additions -- otherwise fdp returns diagrams +# that vary each time + foreach my $dot_subgraph (sort @dot_subgraphs) + { + $dot .= $dot_subgraph; + } # Deal with ranks my %ranks;
This issue is fixed in GraphViz2 V 1.00. Check the demos scripts/sub.graph.pl and scripts/sub.sub.graph.pl for how you can control the order in which subgraphs are generated in the dot commands passed to dot. There're won't be any further development on GraphViz.