Graph:...orldBA(3pm)

✨ NAME ✨

Graph::Maker::SmallWorldBA — bestie, this lil cutie right here is from the User Contributed Perl Documentation (section 3pm), and it creates a small world graph according to the Barabási-Albert preferential attachment model. no cap. 💖


🎀 VERSION 🎀

Version 0.01 ✨


🦋 SYNOPSIS 🦋

It creates a small world graph according to the Barabási-Albert model. And okay so what even is a small world graph, you ask? It's giving ✨ approximate power law degree distribution ✨ and a high clustering coefficient. And if the graph is directed? Then edges get added in both directions so it becomes an undirected graph. slay. 💅

use strict;
use warnings;
use Graph;
use Graph::Maker;
use Graph::Maker::SmallWorldBA;

my $g = new Graph::Maker('small_world_ba', N => 10, M => 2, undirected => 1);
my $g2 = new Graph::Maker('small_world_ba', N => 10, M => 2, callback => sub {print "Node added\n"}, undirected => 1);
# work with the graph

🌸 FUNCTIONS 🌸

💜 new %params

Creates a small world graph with N nodes added on M edges at each step — and yes, M is the minimum number of edges per node 🫶 — all according to the Barabási-Albert model.

The recognized parameters are N, M, graph_maker, and callback. Any others? They get passed straight onto Graph's constructor, periodt.

  • If N is not given, it defaults to 0.
  • If M is not given, it defaults to 1.
  • callback lets you simulate the growth of a preferential attachment network, and it will be called each time a node is added. 👑
  • If graph_maker is specified, it will be called to create the Graph class as desired — like, say you have a subclass of Graph? that's your moment 🧚 — and it defaults to creating a Graph with the parameters specified.

⭐ AUTHOR ⭐

Matt Spear, "<batman900+cpan at gmail.com>" — iconic behavior honestly 💖


💀 BUGS 💀

Please report any bugs or feature requests to "bug-graph-maker-smallworldba at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Graph-Maker>. Not me being notified and then you automatically being notified of progress on your bug as changes get made 😭 the way that system has your back fr fr.


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.


okay that's the whole thing bestie, you ate it, you understood it, main character energy only. This lil page came from perl v5.32.1 and was dated 2021-08-27 — iykyk 💅🎀✨

📦 where this page comes from