Graph::Maker::Circulant - create circulant graph
use Graph::Maker::Circulant; $graph = Graph::Maker->new ('circulant', N=>8, offset_list=>[1,4]);
Graph::Maker::Circulant creates Graph.pm circulant graphs. The graph has vertices 1 to N. Each vertex v has an edge to v+offset, for each offset in the given offset_list. v+offset is taken mod N in the range 1 to N.
Graph::Maker::Circulant
Graph.pm
offset_list
Offsets will usually be 1 <= offset <= N/2. Anything bigger can be reduced mod N, and any bigger than N/2 is equivalent to some -offset, and that is equivalent to an edge v-offset to v. Offset 0 means a self-loop at each vertex.
A single offset_list => [1] gives a cycle the same as Graph::Maker::Cycle. Bigger single offset is a cycle with vertices in a different order, or if offset and N have a common factor then multiple cycles.
offset_list => [1]
In general, if N and all offsets have a common factor g then the effect is g many copies of circulant N/g and offsets/g.
A full offset_list 1..N/2 is the complete graph the same as Graph::Maker::Complete.
If a factor m coprime to N is put through all offset_list then the resulting graph is isomorphic. Edges are m*v to m*v+m*offset which is the same by identifying m*v in the multiple with v in plain. For example circulant N=8 offsets 1,4 is isomorphic to offsets 3,4, the latter being multiple m=3. If an offset list doesn't have 1 but does have some offset coprime to N then dividing through mod N gives an isomorphic graph with 1 in the list.
Circulant N=6 2,3 is isomorphic to the rook grid 3x2 per Graph::Maker::RookGrid.
$graph = Graph::Maker->new('circulant', key => value, ...)
The key/value parameters are
N => integer, number of vertices offset_list => arrayref of integers graph_maker => subr(key=>value) constructor, default Graph->new
Other parameters are passed to the constructor, either graph_maker or Graph->new().
graph_maker
Graph->new()
If the graph is directed (the default) then edges are added both ways between vertices. Option undirected => 1 creates an undirected graph and for it there is a single edge between vertices.
undirected => 1
House of Graphs entries for graphs here, excluding cycles and completes, include
Graph::Maker, Graph::Maker::Cycle, Graph::Maker::Complete, Graph::Maker::RookGrid
Copyright 2018, 2019 Kevin Ryde
This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with This file. If not, see http://www.gnu.org/licenses/.
To install Graph::Maker::Other, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Graph::Maker::Other
CPAN shell
perl -MCPAN -e shell install Graph::Maker::Other
For more information on module installation, please visit the detailed CPAN module installation guide.