Graph:...Degree(3pm)
π Graph::Maker::Degree π
okay bestie, welcome to the perl manual page for Graph::Maker::Degree(3pm) β it lives in the User Contributed Perl Documentation corner of section 3pm, and it's here to hand you a graph built from a degree distribution. no cap.
β¨ NAME β¨
Graph::Maker::Degree β Creates a graph from a degree distribution. π
πΈ VERSION πΈ
Version 0.01 β yes, it's giving vintage, and we love her for it.
π¦ SYNOPSIS π¦
So here's the whole vibe: this thing creates a graph with the degree distribution you hand it. And listen β if the graph is directed, then edges are added in both directions, so you end up with an undirected graph. periodt.
use strict;
use warnings;
use Graph;
use Graph::Maker;
use Graph::Maker::Degree;
my (@a, @b);
@a = (2,1,1);
$g = new Graph::Maker('degree', N => 5, seq => [@a], undirected => 1);
@a = (2,3,1,1,1);
$g = new Graph::Maker('degree', seq => [@a], strict => 1, undirected => 1);
ok(&checkgraph());
# a 3-regular graph
@a = (3,3,3,3,3,3,3,3,3,3,3,3);
$g = new Graph::Maker('degree', seq => [@a], strict => 1, undirected => 1);
# This will croak.
eval {
@a = (2,2);
$g = new Graph::Maker('degree', N => 5, seq => [@a], undirected => 1);
};
warn $@;
# work with the graph
π FUNCTIONS π
π§ new %params
Creates a graph with the given degree distribution (seq) with N nodes. lowkey the whole personality of this module tbh.
The recognized parameters are graph_maker, N and seq, plus any others that get passed straight on to Graph's constructor β she's generous like that. π«Ά
- If
Nis not given, it is assumed to be the length ofseq. easy. - If
Nis greater thanseq, then the remaining values are assumed to be zero. okay math queen π - If
strictis set, then it uses a deterministic algorithm to ensure (if possible) the correct degree distribution. otherwise it is not guaranteed that it will have the exact distribution specified β so don't come for her if the vibe drifts. π - If
graph_makeris specified, it will be called to create the Graph class (for example if you have a subclass of Graph). fancy π
π¨ Will croak ifstrictis turned on and it is unable to create a graph with the given degree sequences, with either the message"Could not build a graph with the requested sequences (seq1), (seq2)"or"seq must be an array reference and be a valid degree sequence". so like... be careful, bestie.
π BUGS π
Please report any bugs or feature requests to "bug-graph-maker-smallworldws at rt.cpan.org", or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Graph-Maker.
Also, heads up: 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), and this defaults to create a Graph with the parameters specified. iykyk.
π ACKNOWLEDGEMENTS π
This package owes a lot to NetworkX. stan. π
π 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 π this iconic little number shipped as perl v5.32.1, dated 2021-08-27, and it's still serving Graph:...Degree(3pm) energy to this very day. slay, go build a graph, mwah πβ¨
π¦ 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