logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Graph::Maker::Disk - Creates a graph with nodes positioned in concentric connected rings.

Author

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

Bugs

       Please report any bugs or feature requests to "bug-graph-maker-disk 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.

Functions

new%params
       Creates a disk graph with init nodes on the first cycle, and disks total cycles.  the required parameters
       are graph_maker, disks and init (init >= 2 || init == 0) any others are passed onto Graph's constructor.
       If disks is not given it defaults to 0.  If init is not given it defaults to 0.  The vertex attribute pos
       will be set to an array reference of the nodes d-dimensional position.  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.

Name

       Graph::Maker::Disk - Creates a graph with nodes positioned in concentric connected rings.

Synopsis

       Creates a disk graph with init nodes on the first cycle, and disks total cycles.  A disk graph is an
       extensoin of a wheel (a wheel is a disk with disks=1) wherein there is a central node, then init node,
       then 2*init nodes, ... to 2**disks*init nodes where each node on an inner cycle connects to 2 nodes on
       the outter cycle.  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::Disk;

               my $g = new Graph::Maker('disk', disks => 4, init => 3);
               my $arr = $g->get_vertex_attribute(1, 'pos");
               print "@$arr\n"; # prints out 0 0
               # work with the graph

       As disk graphs are generally associated with geometry the pos attribute is set for each node specifying
       their position (node 1 is at (0,0) and the distance between nodes is 1 unit).

Version

       Version 0.01

See Also