Graph::Easy::Edge - An edge (a path from one node to another)
use Graph::Easy; my $ssl = Graph::Easy::Edge->new( label => 'encrypted connection', style => '-->', color => 'red', ); my $src = Graph::Easy::Node->new( name => 'source', ); my $dst = Graph::Easy::Node->new( name => 'destination', ); $graph = Graph::Easy->new(); $graph->add_edge($src, $dst, $ssl); print $graph->as_ascii();
A Graph::Easy::Edge represents an edge between two (or more) nodes in a simple graph.
Graph::Easy::Edge
Each edge has a direction (from source to destination, or back and forth), plus a style (line width and style), colors etc. It can also have a label, e.g. a text associated with it.
Each edge also contains a list of path-elements (also called cells), which make up the path from source to destination.
$last_error = $edge->error(); $cvt->error($error); # set new messags $cvt->error(''); # clear error
Returns the last error message, or '' for no error.
my $ascii = $edge->as_ascii();
Returns the edge as a little ascii representation.
my $label = $edge->label();
Returns the label (also known as 'name') of the edge.
my $style = $edge->style();
Returns the style of the edge, like '--', '==', '..', '- '.
my @nodes = $edge->to_nodes();
Return the nodes this edge connects to, as objects.
my @nodes = $edge->from_nodes();
Return the nodes (that connections come from) as objects.
my @nodes = $edge->nodes();
Return all the nodes connected (in either direction) by this edge as objects.
$edge->add_cell( $cell );
Add a new cell to the edge. $cell should be an Graph::Easy::Path object.
$cell
$edge->clear_cells();
Removes all belonging cells.
my $cells = $edge->cells();
Returns a hash containing all the cells this edge currently occupies. Keys on the hash are of the form of $x,$y e.g. 5,3 denoting cell at X = 5 and Y = 3. The values of the hash are the cell objects.
$x,$y
5,3
None by default.
Edges that join another edge.
Graph::Easy.
Copyright (C) 2004 - 2005 by Tels http://bloodgate.com.
See the LICENSE file for more details.
To install Graph::Easy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Graph::Easy
CPAN shell
perl -MCPAN -e shell install Graph::Easy
For more information on module installation, please visit the detailed CPAN module installation guide.