NAME
Graph::Edge - object class for an edge in a directed graph
SYNOPSIS
use Graph::Node;
use Graph::Edge;
$parent = new Graph::Node('LABEL' => 'Parent Node');
$child = new Graph::Node('LABEL' => 'Child Node');
$edge = new Graph::Edge('FROM' => $parent,
'TO' => $child);
$parent->save('simple.daVinci', 'daVinci');
DESCRIPTION
The Graph::Edge
is a class implementing an edge, or arc, in a directed graph. A graph is constructed using Node and Edge objects, with nodes being defined with the Graph::Node class.
An Edge takes four standard attributes: ID, LABEL, FROM, and TO. In addition, you may also define any number of custom attributes. Attributes are manipulated using the setAttribute, getAttribute methods, which are defined in the base class, Graph::Element.
CONSTRUCTOR
$edge = new Graph::Edge( . . . );
This creates a new instance of the Graph::Edge object class, used in conjunction with the Graph::Node class to construct directed graphs.
You must specify the FROM
and TO
attributes of an edge when creating it:
$edge = new Graph::Edge('FROM' => $parent,
'TO' => $child,
'ID' => 'identifier'
);
where the $parent
and $child
are Graph::Node objects. The ID
attribute is optional, and must be a unique string identifying the edge. If you do not specify the ID
attribute, the edge will be assigned a unique identifier automatically.
SEE ALSO
- Graph::Node
-
for a description of the Node class.
- Graph::Element
-
for a description of the base class, including the attribute methods.
AUTHOR
Neil Bowers <neilb@cre.canon.co.uk>
COPYRIGHT
Copyright (c) 1997 Canon Research Centre Europe. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.