Skip Menu |

This queue is for tickets about the GraphViz CPAN distribution.

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

People
Owner: Nobody in particular
Requestors: fenner [...] research.att.com
Cc:
AdminCc:

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



Subject: cluster names handled incorrectly
I'm using GraphViz 2.02. I haven't tried this in any other versions. If a cluster has a space in its name, it gets quoted, resulting in a subgraph name like subgraph cluster_"This is my cluster" { Unfortunately, dot's grammar says that a quoted string begins with a quote, you can't just spring quotes wherever like with shell programming, so this is an error to dot, resulting in awfully odd output. Naively, this patch seems to help: --- /usr/local/lib/perl5/site_perl/5.8.7/GraphViz.pm Fri Jan 7 10:24:54 2005 +++ ./GraphViz.pm Wed Jan 4 10:22:45 2006 @@ -1094,7 +1094,7 @@ $attrs =~ s/,/;/go; $attrs =~ s/\]$//o; - $dot .= "\tsubgraph cluster_" . $self->_quote_name($name) . " {\n"; + $dot .= "\tsubgraph " . $self->_quote_name("cluster_" . $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}; This short script demonstrates the problem - the debug output has the funny quoting, the canonical output has the bizarre result: #!/usr/bin/perl use GraphViz; $g = GraphViz->new(); $g->add_node("MyNode", cluster => "Cluster Name Has Spaces"); print "DEBUG ->\n"; print $g->as_debug; print "CANON ->\n"; print $g->as_canon; DEBUG -> digraph test { ratio="fill"; subgraph cluster_"Cluster Name Has Spaces" { label="Cluster Name Has Spaces"; MyNode [label="MyNode"]; } } CANON -> digraph test { graph [ratio=fill]; node [label="\N"]; subgraph cluster_ { } { graph [label="Cluster Name Has Spaces"]; MyNode [label=MyNode]; } "Cluster Name Has Spaces"; } After my patch above, the canonical output is more or less the same as the debug output. While one might consider this a bug in graphviz to produce such bizarre output, it's GIGO - the grammar for the dot language shows that identifiers that are quoted strings have to begin and end with a quote.
This issue has not been fixed in GraphViz2 V 1.00. I (Ron) have noted it as a problem to be fixed. There're won't be any further development on GraphViz.