NAME
Graph::Undirected::Hamiltonicity - decide whether a given Graph::Undirected contains a Hamiltonian Cycle.
VERSION
Version 0.17
SYNOPSIS
This module decides whether a given Graph::Undirected contains a Hamiltonian Cycle.
use Graph::Undirected;
use Graph::Undirected::Hamiltonicity;
# Create and initialize an undirected graph.
my $g = Graph::Undirected->new( vertices => [ 0..3 ] );
$g->add_edge(0,1);
$g->add_edge(0,3);
$g->add_edge(1,2);
$g->add_edge(1,3);
if ( graph_is_hamiltonian( $g ) ) {
say "The graph contains a Hamiltonian Cycle.";
} else {
say "The graph does not contain a Hamiltonian Cycle.";
}
EXPORT
This module exports only one subroutine -- graph_is_hamiltonian()
SUBROUTINES
graph_is_hamiltonian
Takes a Graph::Undirected object.
Returns 1 if the graph contains a Hamiltonian Cycle, 0 otherwise.
SUPPORT
Please report issues on GitHub.
AUTHOR
Ashwin Dixit, <ashwin at CPAN dot org>