NAME
Graph::Maker::Caterpillar - create caterpillar graphs
SYNOPSIS
use Graph::Maker::Caterpillar;
$graph = Graph::Maker->new ('caterpillar', N_list => [3,1,4]);
DESCRIPTION
Graph::Maker::Caterpillar creates Graph.pm caterpillar graphs. A caterpillar graph has a linear spine of vertices and from them leaf nodes can be attached. A caterpillar is specified here as a list of how many vertices at each position. For example
* * *
\ / | N_list => [5,1,1,3]
@---@---@---@
/ \ | total vertices sum(N_list) = 10
* * *
The vertices marked "@" are the spine and those marked "*" are the leaves attached to them. This is equivalent to a chain of star graphs connected at their centres. The N_list count of vertices includes the centre, the same as the N in Graph::Maker::Star includes the centre.
At either end of the chain there's a choice whether to have a 1-vertex on the spine or to take that as a leaf on the second last of the spine. For example the following is equivalent to the 5,1,1,3 above
* *
| | N_list => [1,4,1,1,3]
@---@---@---@---@
/ \ | same as above
* * *
This changes the numbering of the vertices, but the structure is the same (isomorphic).
If N_list is a single element then the graph is a single star the same as Graph::Maker::Star. An empty N_list=>[] gives an empty graph. Likewise a single N_list=>[0], and in general any zeros in N_list are treated as nothing at all for the spine.
FUNCTIONS
$graph = Graph::Maker->new('caterpillar', key => value, ...)-
The key/value parameters are
N_list => arrayref of integers graph_maker => subr(key=>value) constructor, default Graph->newOther parameters are passed to the constructor, either
graph_makerorGraph->new().If the graph is directed (the default) then edges are added in both directions. Option
undirected => 1creates an undirected graph and for it there is a single edge between vertices.
SEE ALSO
Graph::Maker, Graph::Maker::Star
HOME PAGE
http://user42.tuxfamily.org/graph-maker-other/index.html
LICENSE
Copyright 2015, 2016, 2017, 2018, 2019, 2020, 2021 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/.