Graph::Easy::Edge - An edge (a path connecting one ore more nodes)
my $ssl = Graph::Easy::Edge->new(
label => 'encrypted connection',
style => 'solid',
my $src = Graph::Easy::Node->new('source');
my $dst = Graph::Easy::Node->new('destination');
$graph = Graph::Easy->new();
$graph->add_edge($src, $dst, $ssl);
A Graph::Easy::Edge represents an edge between two (or more) nodes in a simple graph.
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.
During the layout phase, 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 messages
$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 $txt = $edge->as_txt();
Returns the edge as a little Graph::Easy textual representation.
my $label = $edge->label();
Returns the label (also known as 'name') of the edge.
my $label = $edge->name();
To make the interface more consistent, the name() method of an edge can also be called, and it will returned either the edge label, or the empty string if the edge doesn't have a label.
my $style = $edge->style();
Returns the style of the edge, like 'solid', 'dotted', 'double', etc.
my @nodes = $edge->nodes();
Returns the source and target node that this edges connects as objects.
Returns true if the edge is bidirectional, aka has arrow heads on both ends. An optional parameter will set the bidirectional status of the edge.
Returns true if the edge is undirected, aka has now arrow at all. An optional parameter will set the undirected status of the edge.
Return true if the edge has restriction on the starting or ending port, e.g. either the start or end attribute is set on this edge.
my $port = $edge->start_port();
Return undef if the edge does not have a fixed start port, otherwise returns the port as "side, number", for example "south, 0".
my $port = $edge->end_port();
Return undef if the edge does not have a fixed end port, otherwise returns the port as "side, number", for example "south, 0".
my $from = $edge->from();
Returns the node that this edge starts at. See also to().
my $to = $edge->to();
Returns the node that this edge leads to. See also from().
my $other = $edge->start_at('some node');
Set the edge's start point to the given node. If given a node name, will add that node to the graph first.
Returns the new edge start point node.
my $other = $edge->end_at('some other node');
Set the edge's end point to the given node. If given a node name, will add that node to the graph first.
Returns the new edge end point node.
Swaps the start and end nodes on this edge, e.g. reverses the direction of the edge.
my $flow = $edge->flow();
Returns the flow for this edge, honoring inheritance. An edge without a specific flow set will inherit the flow from the node it comes from.
my $flow = $edge->edge_flow();
Returns the flow for this edge, or undef if it has none set on either the object itself or its class.
my ($side, $number) = $edge->port('start');
my ($side, $number) = $edge->port('end');
Return the side and port number where this edge starts or ends.
Returns undef for $side if the edge has no port restriction. The returned side will be one absolute direction of east, west, north or south, depending on the port restriction and flow at that edge.
my $att = $object->get_attributes();
Return all effective attributes on this object (graph/node/group/edge) as an anonymous hash ref. This respects inheritance and default values.
See also raw_attributes().
Return all set attributes on this object (graph/node/group/edge) as an anonymous hash ref. This respects inheritance, but does not include default values for unset attributes.
See also get_attributes().
You can call all the various attribute related methods like set_attribute(), get_attribute(), etc. on an edge, too. For example:
$edge->set_attribute('label', 'by train');
my $attr = $edge->get_attributes();
my $raw_attr = $edge->raw_attributes();
You can find more documentation in Graph::Easy.
None by default.
Copyright (C) 2004 - 2008 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.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.