Scroll to navigation

Graph::Maker::Disk(3pm) User Contributed Perl Documentation Graph::Maker::Disk(3pm)

NAME

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

VERSION

Version 0.01

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).

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.

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.

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.

2021-08-27 perl v5.32.1