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 N is not given, it is assumed to be the length of seq. easy.
  • If N is greater than seq, then the remaining values are assumed to be zero. okay math queen πŸ‘‘
  • If strict is 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_maker is specified, it will be called to create the Graph class (for example if you have a subclass of Graph). fancy πŸ’…
🚨 Will croak if strict is 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 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