Graph::Maker::Bipartite(3pm)

Graph::Maker::Bipartite3pm

Creates a bipartite graph with a given distribution.

Usage

Creates a bipartite graph with the given distributions. A bipartite graph is one in which it can be decomposed into two unique sets with edges only between these sets. If the graph is directed then edges are added in both directions to create an undirected graph.

        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

Version

Version 0.01

Functions

new %params

Creates a bipartite graph with the given distributions (seq1 and seq2 respectively) with sets of size N1 and N2 respectfully. The recognized parameters are graph_maker, N1, N2, seq1, and seq2. any others are passed onto Graph's constructor. If N1 is not given it is assumed to be the length of seq1, same for N2. If N1 (N2) is greater than seq1 (seq2) then the remaining values are assumed to be zero. If strict is set then uses a deterministic algorithm to ensure (if possible) the correct degree distribution, otherwise it is not guarenteed that it will have the exact distribution specified. 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. Will croak if strict is turned on and it is unable to create a graph with the given degree sequences with the message "Could not build a graph with the requested sequences (seq1), (seq2)".

Releases

Unchanged in 2 releases since Debian 12 (Bookworm).

  1. 12–13

Author

Matt Spear, "<batman900+cpan at gmail.com>"

Bugs

Quite possibly, but hopefully not.

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.

From libgraph-maker-perl 0.02-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.