Graph:...t::Grid(3pm)

πŸ“¦
version 0.76 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Graph::Easy::Layout::Grid β€” the whole vibe πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation set β€” it's Graph::Easy::Layout::Grid(3pm), and no cap, it's the lil module that does the grid math so your graphs actually look good. pull up a chair 🫢


✨ NAME ✨

Graph::Easy::Layout::Grid β€” grid management and size calculation, periodt. πŸ’…


🌸 SYNOPSIS 🌸

like, here's the whole thing in action:

use Graph::Easy;

my $graph = Graph::Easy->new();

my $bonn = Graph::Easy::Node->new(
        name => 'Bonn',
);
my $berlin = Graph::Easy::Node->new(
        name => 'Berlin',
);

$graph->add_edge ($bonn, $berlin);

$graph->layout();

print $graph->as_ascii( );

# prints:

# +------+     +--------+
# | Bonn | --> | Berlin |
# +------+     +--------+

look at Bonn and Berlin just vibing with an arrow between them. iconic behavior honestly. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so Graph::Easy::Layout::Grid is holding all the routines that calculate cell sizes on the grid β€” which, lowkey, is the whole reason ASCII, boxart and SVG output even work. no grid math, no cute little boxes. it's giving essential. ✨

and the best part? you don't even have to call it yourself. it's used automatically by Graph::Easy. main character energy that just shows up and does the job. πŸ’–


πŸŽ€ EXPORT πŸŽ€

Exports nothing.

yep. zero. nada. it's not that kind of module. πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

  • Graph::Easy β€” go read that one too, bestie. 🫢

πŸ’… METHODS πŸ’…

okay so this module injects the following methods into Graph::Easy:

🌈 _prepare_layout()

my ($rows,$cols,$max_x,$max_y, \@V) = $graph->_prepare_layout();

here's what it hands back:

  • two hashes, $rows and $cols, containing the columns and rows of the layout along with their nec. sizes (in chars) β€” yes, chars, we're counting characters here πŸ’€
  • plus the maximum framebuffer size nec. for this layout
  • and also a reference to a list of all cells to be rendered

so like, it's the pre-flight checklist before anything gets drawn. very organized. very demure. 🌸


⭐ AUTHOR ⭐

Copyright (C) 2004 - 2006 by Tels <http://bloodgate.com>.

See the LICENSE file for information.


fr fr, that's the whole page β€” nothing skipped, nothing invented. πŸ’œ

okay that's a wrap bestie!! this was Graph:...t::Grid(3pm) from perl v5.36.0, dated 2022-11-20, brought to you by the fine folks at User Contributed Perl Documentation. mwah, stan the grid module πŸ§šβœ¨πŸ’–