Graph:...r::Dot(3pm)
π NAME π
Graph::Writer::Dot β bestie, it writes out a directed graph in Dot format. That's the whole vibe. (And yes, you're on the Graph:...r::Dot(3pm) page, welcome, pull up a chair π«Ά)
β¨ SYNOPSIS β¨
use Graph;
use Graph::Writer::Dot;
$graph = Graph->new();
# add edges and nodes to the graph
$writer = Graph::Writer::Dot->new();
$writer->write_graph($graph, 'mygraph.dot');
Like, that's it. That's the whole ritual. π
πΈ DESCRIPTION πΈ
Graph::Writer::Dot is a class for writing out a directed graph in the file format used by the dot tool (part of the AT+T graphviz package). So it's giving "your graph, but make it visual."
One tiny little requirement though, no biggie: the graph must be an instance of the Graph class β which is actually a whole set of classes developed by Jarkko Hietaniemi. Iconic lineage, honestly. π
π METHODS π
π§ new()
Constructor energy β¨ β it generates a brand new writer instance for you.
$writer = Graph::Writer::Dot->new();
It can take one optional argument that tells it to cluster nodes in subgraphs by using the attribute you pass as the value. Watch:
$writer = Graph::Writer::Dot->new(cluster => 'group');
So what happens there: it will group together all the nodes that have the same value in the 'group' attribute. Matching vibes get grouped. π«Ά
π write_graph()
Write a specific graph out to a named file, periodt:
$writer->write_graph($graph, $file);
The $file argument can either be a filename, or a filehandle for a file you already opened. Flexible queen. π
π SEE ALSO π
- www.graphviz.org β the home page for the AT+T graphviz toolkit that includes the
dottool. Go look, it's giving legendary. β¨ Graphβ Jarkko Hietaniemi's modules for representing directed graphs, available from CPAN undermodules/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 forGraph::Writer::Dot
π REPOSITORY π
https://github.com/neilb/Graph-ReadWrite
π AUTHOR π
Neil Bowers <neil@bowers.com> π
π¦ COPYRIGHT π¦
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.
Okay so lowkey important: that "same terms as Perl itself" bit is the actual license situation, don't skip it bestie π«Ά
And that's the whole page!! This was perl v5.32.1, dated 2021-09-19 β yes I remembered the version and the date, main character energy only π
β¨ go write some dot files, ily, bye ππ¦
π¦ where this page comes from
- debian bookworm: libgraph-readwrite-perl 2.10-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libgraph-readwrite-perl 2.10-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libgraph-readwrite-perl 2.10-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libgraph-readwrite-perl 2.10-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libgraph-readwrite-perl 2.10-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgraph-readwrite-perl 2.10-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms