Graph:...:Force(3pm)
π Graph::Easy::Layout::Force π
okay so bestie, welcome to Graph::Easy::Layout::Force, which is literally the force-based layouter for Graph::Easy β and yeah, this is the Graph:...:Force(3pm) page, we're just folding the manual name in up here like a cute lil name tag π
It's a Perl module, it's part of the User Contributed Perl Documentation, and it is obsessed with one thing: figuring out where your nodes should go. β¨
π SYNOPSIS π
here's the whole vibe, copy-paste ready, no cap:
use Graph::Easy;
my $graph = Graph::Easy->new();
$graph->add_edge ('Bonn', 'Berlin');
$graph->add_edge ('Bonn', 'Ulm');
$graph->add_edge ('Ulm', 'Berlin');
$graph->layout( type => 'force' );
print $graph->as_ascii( );
# prints:
# +------------------------+
# | v
# +------+ +-----+ +--------+
# | Bonn | --> | Ulm | --> | Berlin |
# +------+ +-----+ +--------+
look at that ASCII graph. iconic. it ate. π
π¦ DESCRIPTION π¦
Graph::Easy::Layout::Force contains routines that calculate a force-based layout for a graph. periodt.
so here's the tea π β nodes repell each other (yes, the original spells it that way and we respect the original spelling, fr fr), while the edges connecting them draw them together. it's giving magnets. it's giving "I love you but also please get out of my personal space."
The layouter calculates the forces on each node, then moves them around according to these forces until things have settled down. like, until everyone stops fidgeting and the graph chills out. β¨
and ngl, this whole thing is used automatically by Graph::Easy β so you don't even have to call it yourself, it just shows up and does the work like a true main character π
β¨ EXPORT β¨
Exports nothing.
literally nothing. zero. it's a humble queen. no exports, no drama, just vibes π«Ά
πΈ SEE ALSO πΈ
Graph::Easy.
that's it, that's the whole list π
π METHODS π
This module injects the following methods into Graph::Easy:
π« _layout_force()
Calculates the node position with a force-based method.
one method, one job, and she does it beautifully. π
π AUTHOR π
Copyright (C) 2004 - 2007 by Tels <http://bloodgate.com>.
See the LICENSE file for information.
β οΈ okay bestie, real talk β if you're reusing this, go actually read the LICENSE file. the manpage says to, and the manpage is not playing around. π
and that's the whole page!! π¦
cute lil sign-off time: this doc is from perl v5.36.0, dated 2022-11-20, and it lives at the Graph:...:Force(3pm) address β same as where we started, because everything comes full circle, slay πβ¨π
π¦ 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