Graph:...partite(3pm)

✨ Graph:...partite(3pm) β€” bestie edition ✨

okay so real talk: this is User Contributed Perl Documentation, and the page you're holding is Graph:...partite(3pm). It's giving "I make bipartite graphs and I'm lowkey obsessed with degree sequences." Let's get into it πŸ’…


🌸 NAME 🌸

Graph::Maker::Bipartite β€” creates a bipartite graph with a given distribution. That's it, that's the whole name. Short, sweet, iconic.


πŸŽ€ VERSION πŸŽ€

Version 0.01. Baby version, but she's doing her best 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

So here's the vibe: it creates a bipartite graph with the distributions you hand it. A bipartite graph is one where you can split it into two unique sets and the edges only ever go between the sets β€” never inside one set, we don't do that here. And if the graph is directed? Then edges get added in both directions to make it undirected. Balance, harmony, etc ✨

use strict;
use warnings;
use Graph;
use Graph::Maker;
use Graph::Maker::Bipartite;

my (@a, @b);
@a = (2); @b = (1,1);
$g = new Graph::Maker('bipartite', N1 => 5, N2 => 4, seq1 => [@a], seq2 => [@b], undirected => 1);
@a = (2,3,1,2,1); @b = (2,2,1,3,1);
$g2 = new Graph::Maker('bipartite', seq1 => [@a], seq2 => [@b]);
@a = (2,3,1,2,1); @b = (2,2,1,3,1);
$g3 = new Graph::Maker('bipartite', seq1 => [@a], seq2 => [@b], strict => 1, undirected => 1);
# This distribution cannot be satisfied and the resulting graph will be incorrect
@a = (2); @b = (2);
eval {
    $g = new Graph::Maker('bipartite', N1 => 5, N2 => 4, seq1 => [@a], seq2 => [@b], undirected => 1);
};
# $@ has a message informing the graph could not be constructed
# work with the graph

not me just casually showing you a distribution that literally cannot be satisfied and the resulting graph will be incorrect β€” that's the drama, bestie, we keep the receipts πŸ“


πŸ’– FUNCTIONS πŸ’–

🌈 new %params

Creates a bipartite graph with the given distributions (seq1 and seq2 respectively), with sets of size N1 and N2 respectfully. (Respectfully. Say it back.)

The recognized parameters are:

  • graph_maker
  • N1
  • N2
  • seq1
  • seq2

Anything else? Passed straight onto Graph's constructor. She's flexible like that πŸ‘‘

Okay now the deets, because this part actually matters:

  • If N1 is not given, it's assumed to be the length of seq1. Same deal for N2 with seq2.
  • If N1 (N2) is greater than seq1 (seq2), then the remaining values are assumed to be zero.
  • If strict is set, 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 you specified. Read that again. Not guaranteed. 🫠
  • If graph_maker is specified, it gets called to create the Graph class as desired (say, if you've got a subclass of Graph). Defaults to creating a Graph with the parameters specified.
⚠️ big one: it will croak if strict is turned on and it's unable to create a graph with the given degree sequences. The message is exactly: "Could not build a graph with the requested sequences (seq1), (seq2)". No cap.

πŸ‘‘ AUTHOR πŸ‘‘

Matt Spear, "<batman900+cpan at gmail.com>" β€” shoutout to Matt, the main character who wrote this 🫢


πŸ’€ BUGS πŸ’€

Quite possibly, but hopefully not. (The most honest sentence in all of CPAN, honestly 😭)

Please report any bugs or feature requests to "bug-graph-maker-randombipartite at rt.cpan.org", or through 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. Bestie accountability chain, love to see it ✨


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, periodt πŸ’…

This absolute icon of a doc page was generated by perl v5.32.1 on 2021-08-27 β€” so if you're reading this, hi, you're part of the lore now πŸ¦‹πŸ’–

πŸ“¦ where this page comes from