NAME
GraphViz::Graph - Object Oriented interface to graphviz.
VERSION
Version 0.02
SYNOPSIS
use GraphViz::Graph;
my $graph = GraphViz::Graph->new('filename-without-suffix');
# Create nodes:
my $nd_1 = $graph->node(…);
my $nd_2 = $graph->node(…);
# Connect nodes:
$graph->edge($nd_1, $nd_2);
# Create .dot file, run graphviz/dot to
# create filename-without-suffix.png:
$graph->create('png');
METHODS
new
my $graph = GraphViz::Graph->new('FileNameBase');
Start a graph. 'FileNameBase'
is the base name for the produced dot and png/pdf/svg… etc. output file.
label
GraphViz::Graph->label({text => 'Graph Title'}');
GraphViz::Graph->label({html => '<font point-size="20">Say <font face="Courier">Hello World</font></font>'}');
Add a label to a graph. Most probably used as a title.
node
my $nd_foo = GraphViz::Graph->node();
# … later:
$nd_foo -> label({html=>"<b>Bold</b><i>Italic</i>"});
Add a node to a graph
edge
Add an edge to a graph.
my $nd_one = $graph->node();
my $nd_two = $graph->node();
my $nd_three = $graph->node();
$nd_one->label({html=>"…"});
$nd_two->label({html=>"<table>
<tr><td port='port_f'>f</td><td>g</td></tr>
</table>"});
$graph->edge($nd_one, $nd_two->port('port_f')):
$graph->edge($nd_two, $nd_three);
node_or_port_to_string_
This function is internally used by the constructur (new()
) of GraphViz::Graph::Edge.
Copyright
Copyright © 2017 René Nyffenegger, Switzerland. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: http://www.perlfoundation.org/artistic_license_2_0
Testing
The tests need Test::Files.