Graph:...y::Edge(3pm)
π Graph:...y::Edge(3pm) π
okay bestie, welcome to the User Contributed Perl Documentation page for Graph:...y::Edge(3pm) β yes that's the manual name, it's giving truncated-but-iconic, and we're gonna get you fluent in it. sit down, hydrate, let's go π«Ά
β¨ NAME β¨
Graph::Easy::Edge β An edge (a path connecting one ore more nodes) π¦
β¨ SYNOPSIS β¨
use Graph::Easy;
my $ssl = Graph::Easy::Edge->new(
label => 'encrypted connection',
style => 'solid',
);
$ssl->set_attribute('color', 'red');
my $src = Graph::Easy::Node->new('source');
my $dst = Graph::Easy::Node->new('destination');
$graph = Graph::Easy->new();
$graph->add_edge($src, $dst, $ssl);
print $graph->as_ascii();
literally the whole plot in ten lines π
β¨ DESCRIPTION β¨
A Graph::Easy::Edge represents an edge between two (or more) nodes in a simple graph. πΈ
Every 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. it's giving main character with a name tag β¨
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. so it lowkey knows every little cell it walks through π§
β¨ METHODS β¨
π error()
$last_error = $edge->error();
$cvt->error($error); # set new messages
$cvt->error(''); # clear error
Returns the last error message, or '' for no error. no drama, just the receipts π
π as_ascii()
my $ascii = $edge->as_ascii();
Returns the edge as a little ascii representation. tiny art, huge vibe π
π as_txt()
my $txt = $edge->as_txt();
Returns the edge as a little Graph::Easy textual representation. periodt βοΈ
π label()
my $label = $edge->label();
Returns the label (also known as 'name') of the edge. yes queen, tell us who you are π
π name()
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. bestie said "consistency is self-care" π
π style()
my $style = $edge->style();
Returns the style of the edge, like 'solid', 'dotted', 'double', etc. outfit check π₯
π nodes()
my @nodes = $edge->nodes();
Returns the source and target node that this edges connects as objects. the two ends of the situationship π«Ά
π bidirectional()
$edge->bidirectional(1);
if ($edge->bidirectional())
{
}
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. arrows on both sides, mutual energy fr fr β
π undirected()
$edge->undirected(1);
if ($edge->undirected())
{
}
Returns true if the edge is undirected, aka has now arrow at all. An optional parameter will set the undirected status of the edge. no arrows, no pressure, just vibes πΈ
π has_ports()
if ($edge->has_ports())
{
...
}
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. it's got boundaries and honestly? good for it π
π start_port()
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. π§
π end_port()
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. π«
π from()
my $from = $edge->from();
Returns the node that this edge starts at. See also to(). π¦
π to()
my $to = $edge->to();
Returns the node that this edge leads to. See also from(). π
π start_at()
$edge->start_at($other);
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. β¨
π end_at()
$edge->end_at($other);
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. π«Ά
π flip()
$edge->flip();
Swaps the start and end nodes on this edge, e.g. reverses the direction of the edge. glow-up but make it directional π
π flow()
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. inherited traits, we love to see it π§¬
π edge_flow()
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. no flow = undef, and that's valid π
π port()
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. compass girlie behavior π§
π get_attributes()
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. the full picture, defaults included π
See also raw_attributes(). π
π raw_attributes()
my $att = $object->get_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. just the ones you actually set, no filler πΈ
See also get_attributes(). π
π attribute related methods
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. π
β¨ EXPORT β¨
None by default. we are not over-sharing here π
β¨ SEE ALSO β¨
Graph::Easy. π¦
β¨ AUTHOR β¨
Copyright (C) 2004 - 2008 by Tels <http://bloodgate.com>. π
See the LICENSE file for more details. π
and that's the whole page bestie, you ate π this was perl v5.36.0, dated 2022-11-20, straight from Graph:...y::Edge(3pm) β now go build a graph and make it iconic, mwah πβ¨
π¦ where this page comes from
- debian bookworm: libgraph-easy-perl 0.76-3 Β· GPL-2.0-or-later
- debian trixie: libgraph-easy-perl 0.76-3 Β· GPL-2.0-or-later
- ubuntu noble: libgraph-easy-perl 0.76-3 Β· GPL-2.0-or-later
- ubuntu resolute: libgraph-easy-perl 0.76-3 Β· GPL-2.0-or-later
- ubuntu stonking: libgraph-easy-perl 0.76-3 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms