Skip Menu |

This queue is for tickets about the GraphViz2 CPAN distribution.

Report information
The Basics
Id: 121600
Status: rejected
Priority: 0/
Queue: GraphViz2

People
Owner: Nobody in particular
Requestors: user42_kevin [...] yahoo.com.au
Cc:
AdminCc:

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



Subject: changing directed-ness
Date: Wed, 10 May 2017 19:24:50 +1000
To: bug-GraphViz2 [...] rt.cpan.org
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
While experimenting with a Parse module, I had the urge to set the directed-ness of the target GraphViz2 according to the data parsed. Is there a way to set directed=>... after the new(), or only from new? I see that changing $graph->global->{'directed'} = 'digraph' has the right effect, but perhaps that's not meant for external use.
I'm marking this as not-a-bug. I confess it didn't ever occur to me anyone would want to change the directedness after calling new(), so I did not add a method to do so. The problem of course is whether or not I should add a method for every possible such attribute, and I really don't like that idea. It'd be overhead which would - I assume - be very rarely used. So, your discovery that directly changing that attribute indirectly is fine by me. Normally of course we advocate the user not make any assumptions about the internal structure of any module's code, but I'm sure that hashref you're fiddling will never change.
Subject: Re: [rt.cpan.org #121600] changing directed-ness
Date: Sat, 13 May 2017 11:58:42 +1000
To: "RSAVAGE via RT" <bug-GraphViz2 [...] rt.cpan.org>
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
"RSAVAGE via RT" <bug-GraphViz2@rt.cpan.org> writes: Show quoted text
> > The problem of course is whether or > not I should add a method for every possible such attribute, and I > really don't like that idea.
What about a default_global() in the style of default_graph()? But perhaps I misunderstand what default_graph() quite means.
Subject: Re: [rt.cpan.org #121600] changing directed-ness
Date: Sat, 13 May 2017 12:37:43 +1000
To: "RSAVAGE via RT" <bug-GraphViz2 [...] rt.cpan.org>
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
Or do you have a plan for what a Parse module might or should do for directed-ness from its input? Your current parse creators are all directed, but say reading .dot which is either directed or undirected ... (though why anyone would read dot into a module whose purpose is to output dot I don't know :-).
Subject: Re: [rt.cpan.org #121600] changing directed-ness
Date: Sun, 14 May 2017 12:04:42 +1000
To: bug-GraphViz2 [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Kevin What you want is already possible! Run the code below both with and without the call to $parser -> graph(...) and view the output. You'll need to set $ENV{DR} first. For me, $DR points to my nginx Doc Root, /run/shm/html, i.e. the place in Debian's RAM disk where I have my web site. You could try setting it to '.', say. The reason you can't do it the way you were thinking is that the call to GraphViz2::Parse::ISA -> new creates an instance of GraphViz2, and within the sub BUILD() of GraphViz2, the code starts to output DOT commands, including setting the directedness. So, I've circumvented that by generating a GraphViz2 object before instantiating a GraphViz2::Parse::ISA object. #!/usr/bin/env perl use 5.018; use feature 'say'; use strict; use warnings; use GraphViz; use GraphViz2::Parse::ISA; # ----------------- my($graph) = GraphViz2 -> new ( edge => {color => 'grey'}, global => {directed => 0}, # Was 1. graph => {rankdir => 'BT'}, logger => '', node => {color => 'red', shape => 'Mrecord'}, # Was blue. ); my($parser) = GraphViz2::Parse::ISA -> new(graph => $graph); $parser -> add(class => 'GraphViz2::Parse::ISA'); my($graph) = $parser -> generate_graph; $graph -> run(format => 'svg', output_file => "$ENV{DR}/x.svg"); On 13/05/17 12:00, Kevin Ryde via RT wrote: Show quoted text
> Queue: GraphViz2 > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=121600 > > > "RSAVAGE via RT" <bug-GraphViz2@rt.cpan.org> writes:
>> >> The problem of course is whether or >> not I should add a method for every possible such attribute, and I >> really don't like that idea.
> > What about a default_global() in the style of default_graph()? > But perhaps I misunderstand what default_graph() quite means. >
-- Ron Savage - savage.net.au
Subject: Re: [rt.cpan.org #121600] changing directed-ness
Date: Mon, 15 May 2017 18:51:20 +1000
To: "ron\ [...] savage.net.au via RT" <bug-GraphViz2 [...] rt.cpan.org>
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
"ron@savage.net.au via RT" <bug-GraphViz2@rt.cpan.org> writes: Show quoted text
> > The reason you can't do it the way you were thinking is that the call to > GraphViz2::Parse::ISA -> new creates an instance of GraphViz2, and > within the sub BUILD() of GraphViz2, the code starts to output DOT > commands, including setting the directedness.
Hmm. I was unsure quite where the outputting quite began. Show quoted text
> So, I've circumvented that > by generating a GraphViz2 object before instantiating a > GraphViz2::Parse::ISA object.
I'd probably be closer to the file reading like GraphViz2::Parse::Yacc, if you imagined that in its read_file() you learn whether directed or undirected. The input I'm thinking is graph6, sparse6 and digraph6 formats all in one. Their ideas and encodings are close and some of the nauty tools have options to spit out either. digraph6 is directed and the others are undirected (distinguished by the first char of input). I might either keep them separate or do something which works and worry later ...
Subject: Re: [rt.cpan.org #121600] changing directed-ness
Date: Tue, 16 May 2017 09:06:24 +1000
To: bug-GraphViz2 [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Kevin I've never heard of those formats. I suggest you open the file, read 1 char, close the file, and go from there, having enough info (I guess) to set things up properly. On 15/05/17 18:53, Kevin Ryde via RT wrote: Show quoted text
> Queue: GraphViz2 > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=121600 > > > "ron@savage.net.au via RT" <bug-GraphViz2@rt.cpan.org> writes:
>> >> The reason you can't do it the way you were thinking is that the call to >> GraphViz2::Parse::ISA -> new creates an instance of GraphViz2, and >> within the sub BUILD() of GraphViz2, the code starts to output DOT >> commands, including setting the directedness.
> > Hmm. I was unsure quite where the outputting quite began. >
>> So, I've circumvented that >> by generating a GraphViz2 object before instantiating a >> GraphViz2::Parse::ISA object.
> > I'd probably be closer to the file reading like GraphViz2::Parse::Yacc, > if you imagined that in its read_file() you learn whether directed or > undirected. > > The input I'm thinking is graph6, sparse6 and digraph6 formats all in > one. Their ideas and encodings are close and some of the nauty tools > have options to spit out either. digraph6 is directed and the others > are undirected (distinguished by the first char of input). I might > either keep them separate or do something which works and worry later > ... >
-- Ron Savage - savage.net.au