Graph:...Uniform(3pm)
π« Graph::Maker::Uniform π«
okay bestie, welcome to the perl manual page for Graph::Maker::Uniform β user contributed perl documentation, we love to see it π
β¨ NAME β¨
Graph::Maker::Uniform β it creates a graph distributed randomly over the d-dimensional grid. periodt. π
πΈ VERSION πΈ
Version 0.01 β baby's first version number, iconic honestly π¦
π«Ά SYNOPSIS π«Ά
So here's the vibe: this makes a uniform graph with nodes scattered randomly over a dims-dimensional unit cube. A uniform graph distributes nodes randomly (generally uniformally) over a unit cube in some number of dimensions, where nodes are connected iff they're within rad units of distance of each other, and no nodes are within repel distance of each other. And if the graph is directed? Then edges get added in both directions to create an undirected graph. slay. π
use strict;
use warnings;
use Graph;
use Graph::Maker;
use Graph::Maker::Uniform;
use Math::Random::Free qw/random_normal/;
my (@a, @b);
@a = (2); @b = (1,1);
$g = new Graph::Maker('uniform', N => 100, radius => 0.1, undirected => 1);
@a = (2,3,1,2,1); @b = (2,2,1,3,1);
$g2 = new Graph::Maker('uniform',
N => 100,
rad => 0.15,
dims => 3,
repel => 0.01,
random => sub { random_normal($_[0], 0, 0.5) }
); # make the nodes distributed over the cube with a gaussian (normal) distribution
# work with the graph
look at that random sub making a whole gaussian (normal) distribution like it's nothing ππ
β FUNCTIONS β
π§ new %params
Creates a uniform graph with N nodes randomly distributed over a dims-dimensional unit cube, where nodes are connected if they're within rad euclidian (L2) units of distance, and no nodes are within repel distance of each other according to the random distribution.
The recognized parameters are N, rad, dims, repel, graph_maker, and random. any others are passed onto Graph's constructor. iykyk. π
Here's the tea on the defaults, bestie:
- If
Nis not given it defaults to0. - if
radis not given it defaults to0. - If
dimsis not given it defaults to2. - If
repelis not given it defaults to0. - if
randomis not given it defaults to uniform (Math::Random::Free::random_uniform(dims, 0, 1)), ifrandomis given it is passed the number of random numbers that should be returned.
The vertex attribute pos will be set to an array reference of the node's d-dimensional position. yes queen, your coordinates are stored πβ¨
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.
random
not me pointing out that lone random line at the end of this section β it's in the original, so it stays, fr fr π
π AUTHOR π
Matt Spear, "<batman900+cpan at gmail.com>" β give him his flowers πΈ
π BUGS π
Please report any bugs or feature requests to "bug-graph-maker-uniform at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Graph-Maker> β wait no, no links here, so just: the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Graph-Maker. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. teamwork makes the dream work π«Ά
π 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. same terms as Perl itself, we love a permissive queen π
and that's the whole page, bestie!! this beauty is running on perl v5.32.1 and was dated 2021-08-27 β mwah, no cap, go build some graphs π β¨π¦
π¦ 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