Graph:...orldHK(3pm)

πŸ’– Graph::Maker::SmallWorldHK πŸ’–

okay bestie, welcome to the Graph::Maker::SmallWorldHK page β€” it's part of the User Contributed Perl Documentation and it lives in section 3pm, which is just fancy speak for "a Perl module manpage". Pull up a chair, grab a boba, we're building tiny worlds together. 🌍✨


πŸŽ€ NAME πŸŽ€

Graph::Maker::SmallWorldHK β€” creates a small world graph according to Holmea, Beom & Kim. that's it, that's the whole job. iconic. πŸ‘‘


✨ VERSION ✨

Version 0.01 β€” baby's first release, we love a debut. πŸΌπŸ’…


🌸 SYNOPSIS 🌸

So here's the vibe: this thing creates a small world graph according to Holmea, Beom & Kim's model. A small world graph has an approximate power law degree distribution and a high clustering coefficient. Holmea, Beom & Kim's can be seen as a super-set of the BA model, because it also lets you run a "triangle formation" phase to bump up the clustering coefficient. 🧚 And heads up: if the graph is directed, edges get added in both directions to create an undirected graph. no half-graphs here, we do it properly. πŸ’ͺ

use strict;
use warnings;
use Graph;
use Graph::Maker;
use Graph::Maker::SmallWorldHK;

my $g = new Graph::Maker('small_world_hk', N => 10, M => 2, M_0 => 1, PR => 0, undirected => 1); # BA's model
my $g2 = new Graph::Maker('small_world_hk', N => 10, M => 2, M_0 => 1, PR => 0.25, undirected => 1);
# work with the graph

see that comment on the first one? PR => 0 and suddenly it's just BA's model. glow-down to glow-up in one parameter. πŸ’€βœ¨


πŸ¦‹ FUNCTIONS πŸ¦‹

πŸ’œ new %params

creates a small world graph with N nodes. it starts off with M_0 nodes, then on each step adds M β€” which is the minimum number of edges per node β€” and probalistically does a triangle formation with probability PR, according to the Holmes, Beom & Kim model. 🫢

the parameters we actually recognize are:

  • N β€” how many nodes you want. if you don't give it, it defaults to 0. (zero nodes. a whole graph of nothing. abstract art, honestly. πŸ™ˆ)
  • M β€” the minimum number of edges per node. if you don't give it, it defaults to 1.
  • M_0 β€” the starting node count. if you don't give it, it defaults to M.
  • PR β€” the probability of doing that triangle formation thing. if you don't give it, it defaults to 0.
  • graph_maker β€” if you specify it, it gets called to create the Graph class however you want (say, if you have a subclass of Graph). by default it just creates a Graph with the parameters you specified.
  • callback β€” lets you simulate the growth of a preferential attachment network. it gets called each time a node is added, so you can watch your little world grow in real time. main character energy fr. πŸŒ±πŸ‘€

anything else you pass in gets handed straight over to Graph's constructor β€” it's not ours to police. πŸ’…


πŸ’– AUTHOR πŸ’–

Matt Spear, "<batman900+cpan at gmail.com>". yes the email really has +cpan in it, that's how you know he's a real one. πŸ¦‡


😭 BUGS 😭

found a bug? want a feature? please report it to "bug-graph-maker-smallworldhk at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Graph-Maker>.

and here's the sweet part: he'll be notified, and then you'll automatically be notified of progress on your bug as he makes changes. it's giving mutuals. it's giving accountability. we 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. πŸͺ slay.


ngl, that's the whole page. no cap, every last parameter is right there. go forth and make tiny worlds bestie πŸŒˆπŸ¦‹

and that's a wrap, babe β€” perl v5.32.1, dated 2021-08-27. periodt. πŸ’…πŸŽ€

πŸ“¦ where this page comes from