NAME
Graph::Geometric - create and work with geometric graphs
SYNOPSIS
use Graph::Geometric;
# Generate a truncated regular icosahedron
my $g = icosahedron->truncated;
# Count the faces
print scalar $g->faces;
DESCRIPTION
Graph::Geometric
is an extension of Graph to support working with geometric (topologic) graphs. In addition to vertices and edges, Graph::Geometric
has a concept of faces to ease handling of geometric graphs. Graph::Geometric
does not provide coordinates for vertices as it is supposed to be used for topology analysis of geometric shapes.
As of now, Graph::Geometric
does not allow for arbitrary graph construction. Geometric graphs have to be built from simple polyhedra (constructors listed below) or derived from them by using modifiers such as stellation or truncation. Removal of vertices and faces is also supported.
ON THE STABILITY OF API
As Graph::Geometric
is in its early stages of development, not much of API stability can be promised. In particular, method names are likely to be changed for the sake of homogeneity. Names of generated vertices and order of faces returned by faces()
as well are likely to change. Some syntax sugar may also appear.
CONSTRUCTORS
antiprism( $N )
Given N, creates an N-gonal antiprism. If N is not given, returns a code reference to itself.
bifrustum( $N )
Given N, creates an N-gonal bifrustum. If N is not given, returns a code reference to itself. Since Graph::Geometric
does not provide coordinates, bifrustum is simply a prism with side faces cut in half.
bipyramid( $N )
Given N, creates an N-gonal bipyramid. If N is not given, returns a code reference to itself.
cucurbituril( $N )
Given N, creates a geometric graph representing chemical structure of cucurbit[N]uril. Cucurbiturils do not exacly fit the definition of polyhedra, but have nevertheless interesting structures. If N is not given, returns a cucurbit[5]uril, the smallest naturally occurring cucurbituril.
cupola( $N )
Given N, creates an N-gonal cupola. If N is not given, returns a code reference to itself.
dodecahedron()
Creates a regular dodecahedron.
gyrobicupola( $N )
Given N, creates an N-gonal gyrobicupola. If N is not given, returns a code reference to itself. Implementation detail: gyrobicupola is constructed by creating a bifrustum and removing every second edge on top and bottom faces.
icosahedron()
Creates a regular icosahedron.
icosidodecahedron()
Creates an icosidodecahedron.
octahedron()
Creates a regular octahedron.
orthobicupola( $N )
Given N, creates an N-gonal orthobicupola. If N is not given, returns a code reference to itself. Implementation detail: orthobicupola is constructed by creating a bifrustum and removing every second edge on top and bottom faces.
prism( $N )
Given N, creates an N-gonal prism. If N is not given, returns a code reference to itself.
pyramid( $N )
Given N, creates an N-gonal pyramid. If N is not given, returns a code reference to itself.
rhombic_dodecahedron()
Creates a rhombic dodecahedron.
rotunda( $N )
Given N, creates an N-gonal rotunda. If N is not given, returns a code reference to itself.
tetrahedron()
Creates a regular tetrahedron.
trapezohedron( $N )
Creates an N-gonal trapezohedron. If N is not given, returns a code reference to itself.
ACCESSORS
faces( @vertices )
Returns an array of arrays listing vertices in each of polyhedron's faces. Vertex lists are returned sorted, they do not maintain the order of vertices in faces. Experimental: given a list of vertices, select only faces containing all of them.
GRAPH METHODS
deep_copy()
Creates a deep copy of a Graph::Geometric object.
delete_edge( $u, $v )
Deletes an edge by merging its vertices. Given edge is assumed to exist, a check will be implemented later. Modifies and returns the original object.
delete_face( $face )
Deletes a given face from polyhedra. A face is defined by an unordered list of vertices. Does nothing if a given face does not exist. Modifies and returns the original object.
delete_vertex( $v )
Handles vertex deletion by merging neighbouring faces. Modifies and returns the original object.
has_face( $face )
Returns true if a given face exists, false otherwise.
GEOMETRIC METHODS
carve_face( $u, $v )
Given a graph and a pair of vertices lying on the same face, add a new edge splitting the face in two. Subroutine dies if there is no face containing both vertices.
elongate( $cycle )
Elongate the given polyhedron. If given a face, elongates the polyhedron by extruding it. If given a non-face cycle, elongates the polyhedron by cutting accross the given cycle and inserting a prism in between. If not given anything, attempts to elongate according to the type of given polyhedron. I.e., pyramids are elongated by extruding their faces and so on. Subroutine dies if it encounters a polyhedron of a type unknown to it.
rectify()
Given a polyhedron, performs its rectification. Modifies and returns the original object.
stellate( @faces )
Given a polyhedron and a list of faces, performs stellation of specified faces. If no faces are given, all faces are stellated. Modifies and returns the original object.
truncate( @vertices )
Given a polyhedron and a list of vertices, performs truncation of specified vertices. If no vertices are given, all vertices are stellated. Modifies and returns the original object.
dual()
Given a polyhedron, returns its dual as a new object. The original object is not modified.
OPERATORS
The following class methods take a single Graph::Geometric object, copy it, perform a certain operation and return the results. They allow for such syntactically sweet calls like:
my $cuboctahedron1 = rectified tetragonal prism;
my $cuboctahedron2 = rectified octahedron;
my $truncated_icosahedron = truncated icosahedron;
elongated()
Copies the given polyhedron, elongates it and returns the elongated polyhedron. This subroutine does not accept any parameters, thus if nonstandard elongation is wanted, other methods have to be used.
rectified()
Copies the given polyhedron, rectifies it and returns the rectified polyhedron.
stellated()
Copies the given polyhedron, stellates all its faces and returns the stellated polyhedron.
truncated()
Copies the given polyhedron, truncates all its vertices and returns the truncated polyhedron.
PROPERTIES
is_isogonal()
Tests if a given polyhedron is isogonal (vertex-transitive) by checking whether all its vertices belong to the same symmetry orbit. Requires Graph::Nauty to locate symmetry orbits of a graph.
is_isotoxal()
Tests if a given polyhedron is isotoxal (edge-transitive) by checking whether all its edges belong to the same symmetry orbit. Requires Graph::Nauty to locate symmetry orbits of a graph. Implementation detail: figure is rectified and tested for being isogonal.
is_isohedral()
Tests if a given polyhedron is isohedral (face-transitive) by checking whether all its faces belong to the same symmetry orbit. Requires Graph::Nauty to locate symmetry orbits of a graph. Implementation detail: dual of a figure is tested for being isogonal.
is_regular()
Tests if given polyhedron is regular. A regular polyhedron is vertex-transitive, edge-transitive and face-transitive. Requires Graph::Nauty to locate symmetry orbits of a graph.
is_quasiregular()
Tests if given quasiregular is regular. A quasiregular polyhedron is vertex-transitive and edge-transitive, has two kinds of faces. Requires Graph::Nauty to locate symmetry orbits of a graph.
AUTHORS
Andrius Merkys, <merkys@cpan.org>