callGraph icon indicating copy to clipboard operation
callGraph copied to clipboard

Use GraphViz2 rather than GraphViz Perl module?

Open mohawk2 opened this issue 1 year ago • 2 comments

I just learned of this project today, and it's really cool!

Thought you'd be interested to know of the GraphViz2 module, which may make things easier/better in this script. Example usage:

From https://github.com/PDLPorters/pdl/blob/master/perldl#L335-L338:

  my $g = PDL::Core::pdumpgraph(PDL::Core::pdumphash($pdl));
  require GraphViz2;
  my $gv = GraphViz2->from_graph(PDL::Core::pdumpgraphvizify($g));
  $gv->run(format => $format, output_file => $file);

The general idiom is you make a Graph object, then annotate it (e.g. with a graphvizify procedure such as https://github.com/PDLPorters/pdl/blob/ac270e21cafeda8726dd64fa4b90e4a6e686c8c2/Basic/Core/Core.pm#L2394-L2439), then GraphViz2 can run with it.

mohawk2 avatar Apr 20 '24 12:04 mohawk2

Hi @mohawk2 Thanks for the feedback! I had considered moving from GraphViz to GraphViz2, but chose not to because of the additional Perl dependencies (Moo and 5.8.8 vs 5.6.0). My assumption is that the more steps are needed to install 'callGraph', the fewer people will spend the effort to install it. Installation of the Moo dependency is trivial for those of us experienced with Perl, but since callGraph supports many languages, most users may be completely new to Perl. For the same reason, I designed the callGraph code as a monolith, as it's then easier for a user to copy between machines or give to a friend

koknat avatar Apr 20 '24 16:04 koknat

Zooming out a bit, I think you'll struggle to find any Perls installed anywhere that are <5.8.8 (released ~20 years ago). Even if you decide to stick with GraphViz, you could eliminate a step for users by using https://metacpan.org/dist/App-FatPacker to package everything into one file. That would then also work with GraphViz2, albeit the file would be bigger.

mohawk2 avatar Jun 20 '24 17:06 mohawk2