oracular (3) Graph::Maker::Degree.3pm.gz

Provided by: libgraph-maker-perl_0.02-2_all bug

NAME

       Graph::Maker::Degree - Creates a graph from a degree distribution.

VERSION

       Version 0.01

SYNOPSIS

       Creates a graph with the given degree distribution. If the graph is directed, then edges sare added in
       both directions to create an undirected graph.

               use strict;
               use warnings;
               use Graph;
               use Graph::Maker;
               use Graph::Maker::Degree;

               my (@a, @b);
               @a = (2,1,1);
               $g = new Graph::Maker('degree', N => 5, seq => [@a], undirected => 1);
               @a = (2,3,1,1,1);
               $g = new Graph::Maker('degree', seq => [@a], strict => 1, undirected => 1);
               ok(&checkgraph());
               # a 3-regular graph
               @a = (3,3,3,3,3,3,3,3,3,3,3,3);
               $g = new Graph::Maker('degree', seq => [@a], strict => 1, undirected => 1);
               # This will croak.
               eval {
               @a = (2,2);
               $g = new Graph::Maker('degree', N => 5, seq => [@a], undirected => 1);
               };
               warn $@;
               # work with the graph

FUNCTIONS

   new %params
       Creates a graph with the given degree distribution (seq) with N nodes. The recognized parameters are
       graph_maker, N and seq, and any others that are passed onto Graph's constructor. If N is not given, it is
       assumed to be the length of seq. If N is greater than seq, 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 guaranteed that it will have the exact distribution specified. If
       graph_maker is specified, it will be called to create the Graph class (for example if you have a subclass
       of Graph). Will croak if strict is turned on and it is unable to create a graph with the given degree
       sequences with either the message "Could not build a graph with the requested sequences (seq1), (seq2)"
       or "seq must be an array reference and be a valid degree sequence".

BUGS

       Please report any bugs or feature requests to "bug-graph-maker-smallworldws at rt.cpan.org", or through
       the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Graph-Maker>.  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.

ACKNOWLEDGEMENTS

       This package owes a lot to NetworkX.

       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.