Graph:...r::VCG(3pm)

✨ NAME ✨

Graph::Writer::VCG β€” bestie, it writes out a directed graph in VCG format πŸ’…

(it's a Perl module, part of the User Contributed Perl Documentation, and yes we're doing this whole page together, no skipping 🫢)


🌸 SYNOPSIS 🌸

use Graph;
use Graph::Writer::VCG;

$graph = Graph->new();
# add edges and nodes to the graph

$writer = Graph::Writer::VCG->new();
$writer->write_graph($graph, 'mygraph.vcg');

like… that's it. that's the whole vibe. graph in, file out. iconic honestly ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so Graph::Writer::VCG is a class whose whole personality is writing out a directed graph in the file format used by the VCG tool β€” which was originally developed for Visualising Compiler Graphs. no cap, that's literally what VCG stands for, it's giving "acronym that ate" πŸ’€

the graph you hand it must be an instance of the Graph class, which is actually a whole set of classes developed by Jarkko Hietaniemi. love that for us πŸŽ€

and listen β€” if you've defined any attributes for the graph, the nodes, or the edges, they will get written out to the file, as long as they're attributes that VCG actually understands. so don't come at it with your made-up custom attrs and expect magic, bestie πŸ™ˆ


πŸ‘‘ METHODS πŸ‘‘

πŸ’– new()

Constructor energy β€” it generates a brand new writer instance ✨

$writer = Graph::Writer::VCG->new();

and the tea is: this doesn't take any arguments. zero. none. it's low maintenance, we stan 🫢


πŸ’œ write_graph()

writes a specific graph out to a named file:

$writer->write_graph($graph, $file);

the $file argument can either be a filename, or a filehandle for a file you already opened earlier. flexible king behaviour honestly πŸ‘‘


πŸ’€ KNOWN BUGS AND LIMITATIONS πŸ’€

bestie, sit down, we gotta talk about the flaws. it's not perfect, but we love it anyway 😭

  • Attributes with non-atomic values aren't currently handled. this includes the loc, classname, colorentry, and infoname attributes for graphs, and the loc attribute for nodes,
ngl that trailing comma is just how the original left it and we're keeping every detail, so. it stays. πŸ’…
  • Can currently only handle graph, node, and edge elements and their attributes. so it doesn't know about foldnode_defaults and things like that. it's got a very specific skill set and it's sticking to it πŸ™ˆ

πŸ”₯ SEE ALSO πŸ”₯

  • http://www.cs.uni-sb.de/RW/users/sander/html/gsvcg1.html β€” the home page for VCG.
  • Graph β€” Jarkko Hietaniemi's modules for representing directed graphs, available from CPAN under modules/by-module/Graph/
  • Algorithms in Perl β€” the O'Reilly book which has a chapter on directed graphs, which is based around Jarkko's modules.
  • Graph::Writer β€” the base-class for Graph::Writer::VCG

🌈 REPOSITORY 🌈

https://github.com/neilb/Graph-ReadWrite β€” go look, go star, go read the source, main character behaviour ✨


πŸŽ€ AUTHOR πŸŽ€

Neil Bowers <neil@bowers.com> πŸ’–


Copyright (c) 2001-2012, Neil Bowers. All rights reserved. Copyright (c) 2001, Canon Research Centre Europe. All rights reserved.

This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


and that's the whole page bestie πŸ’… this lil doc is from perl v5.32.1, dated 2021-09-19, filed under the User Contributed Perl Documentation β€” now go write some graphs, you absolute icon πŸ¦‹πŸŒΈβœ¨

πŸ“¦ where this page comes from