Ovid has asked for the wisdom of the Perl Monks concerning the following question:

In the GraphViz docs, there's the following item under the add_edge section:

decorateP

    if set, draws a line from the edge to the label

I can't find any tests which exercise this attribute, nor do any of the examples use it. In trying it,m it appears to be a no-op, but I could be using it incorrectly:

#!/usr/bin/perl -w use strict; use GraphViz; my $g = GraphViz->new(); #my @decorate; # move the comment to the next line to try it without my @decorate = (decorateP => 1); $g->add_node('London'); $g->add_node('Paris', label => 'City of\nlurve'); $g->add_node('New York'); $g->add_edge('London' => 'Paris', @decorate); $g->add_edge('London' => 'New York', label => 'Far', @decorate); $g->add_edge('Paris' => 'London', @decorate); $g->as_png('simple.png');

Regardless of whether or not I use the decorateP attribute, the pngs appear the same.

The binary is 1.13 (v16) on OS X. Googling has proven fruitless. Am I simply using Graphviz wrong? When building complex graphs, lacking that line from the label to the edge can get confusing (and the graph I linked to is a rather simple one.)

Cheers,
Ovid

New address of my CGI Course.

Replies are listed 'Best First'.
Re: GraphViz decorateP attribute not working?
by stvn (Monsignor) on Dec 28, 2004 at 02:34 UTC

    It seems (from a quick review of the code for GraphViz) that additional attributes are being added to a Graph::Directed instance. However I doubt that is any real help.

    What I did find which I think might be helpful is that there seems to be a GraphViz (binarny not perl module) attribute called "Decorate". You can see the details here in the GraphViz docs. My guess is that the 'P' at the end is a typo.

    BTW - You might find this useful for messing around with GraphViz on OS X. It can't be linked to the GraphViz perl module, but you can quickly an easily view and edit DOT files and see updates when you save the file. It takes some of the tedium out of fiddling with the small details of a graph.

    -stvn

      You were right. The P at the end does appear to be a typo. What through me off was this dot manpage which lists decorateP as one of the edge attributes. I'm not sure what's going on, but switching to decorate => 1 did solve the problem.

      Cheers,
      Ovid

      New address of my CGI Course.

        What through me off was this dot manpage which lists decorateP as one of the edge attributes.

        I am going to guess that maybe this is where the typo originated then. It looks though like GraphViz just takes arbitrary attributes, doesn't validate them and then passes them onto the GraphViz binary when it attempts to generate the file. Which would explain why it worked to just do 'decorate'.

        -stvn