Graph:...Regular(3pm)
π Graph::Maker::Regular π
okay bestie, sit DOWN, because we're about to talk about the cutest little Perl module in the whole CPAN: Graph::Maker::Regular, from the User Contributed Perl Documentation collection, section 3pm (that's the Perl module manuals section, iykyk). It makes k-regular graphs. That's the whole vibe. β¨
π¦ VERSION π¦
Version 0.01 β baby's first release, and she ate. π
πΈ SYNOPSIS πΈ
So here's the deal: this thing creates a regular graph with however many nodes you want and a degree you pick. A regular graph means every single node is connected to exactly K other nodes β no favorites, no main character nodes, total equality, we love to see it. π«Ά
And lowkey important: if the graph is directed, then edges get added in both directions to create an undirected graph. Yes girl, she flips it for you.
use strict;
use warnings;
use Graph;
use Graph::Maker;
use Graph::Maker::Regular;
my $g = new Graph::Maker('regular', N => 10, K => 2, undirected => 1);
# work with the graph
Look at that. Ten nodes, degree two. Iconic.
π FUNCTIONS π
β¨ new %params β¨
Creates a k-regular graph with the number of nodes you asked for. Here's the tea on the recognized parameters, bestie:
graph_makerβ if you specify it, it gets called to create the Graph class as you want (say, if you have a subclass of Graph, periodt π)Nβ the number of nodes. If you don't give it, it defaults to0.Kβ the degree. If you don't give it, it also defaults to0.
Anything else you pass in gets passed on to Graph's constructor. No gatekeeping here.
β οΈ Heads up queen: N*K must be even. That's not a suggestion, that's math. π
And if graph_maker is specified, it will be called to create the Graph class as desired (for example if you have a subclass of Graph) β otherwise it defaults to creating a Graph with the parameters specified.
If it just cannot make the graph you asked for, it will croak with the message:
Could not form the requested graph...
so dramatic, honestly, and honestly? fair. π
π AUTHOR π
Matt Spear, "<batman900+cpan at gmail.com>" β thank you for your service king π«‘
π BUGS π
None at the moment... β¨ (manifesting that energy forever tbh)
But fr fr, please report any bugs or feature requests to "bug-graph-maker-regular at rt.cpan.org", or through the web interface at:
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Graph-Maker>
And one more time for the people in the back: if graph_maker is specified it will be called to create the Graph class as desired (for example if you have a subclass of Graph), this defaults to create a Graph with the parameters specified.
π ACKNOWLEDGEMENTS π
This package owes a lot to NetworkX. Shoutout to NetworkX, we see you, we appreciate you. π
π COPYRIGHT & LICENSE π
Copyright 2008 Matt Spear, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page bestie!! written by the lovely folks behind the User Contributed Perl Documentation, running on perl v5.32.1, dated 2021-08-27 β go forth and make regular graphs, you absolute genius π
β¨π
π¦ where this page comes from
- debian bookworm: libgraph-maker-perl 0.02-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libgraph-maker-perl 0.02-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libgraph-maker-perl 0.02-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libgraph-maker-perl 0.02-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libgraph-maker-perl 0.02-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgraph-maker-perl 0.02-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms