Maple Professionel
Maple Académique
Maple Edition Étudiant
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professionel
MapleSim Académique
Maple T.A. - Suite d'examens de classement
Maple T.A. MAA Placement Test Suite
Möbius - Didacticiels de mathématiques en ligne
Machine Design / Industrial Automation
Aéronautique
Ingénierie des véhicules
Robotics
Energie
System Simulation and Analysis
Model development for HIL
Modélisation du procédé pour la conception de systèmes de contrôle
Robotics/Motion Control/Mechatronics
Other Application Areas
Enseignement des mathématiques
Enseignement de l’ingénierie
Enseignement secondaire et supérieur (CPGE, BTS)
Tests et évaluations
Etudiants
Modélisation financière
Recherche opérationnelle
Calcul haute performance
Physique
Webinaires en direct
Webinaires enregistrés
Agenda des évènements
Forum MaplePrimes
Blog Maplesoft
Membres Maplesoft
Maple Ambassador Program
MapleCloud
Livres blancs techniques
Bulletin électronique
Livres Maple
Math Matters
Portail des applications
Galerie de modèles MapleSim
Cas d'Etudes Utilisateur
Exploring Engineering Fundamentals
Concepts d’enseignement avec Maple
Centre d’accueil utilisateur Maplesoft
Centre de ressources pour enseignants
Centre d’assistance aux étudiants
GraphTheory[IsHamiltonian]
Calling Sequence
IsHamiltonian(G)
IsHamiltonian(G, C)
Parameters
G
-
unweighted graph
C
(optional) name
Description
A graph G on n vertices is Hamiltonian if there exists a cycle in G containing each of the n vertices once.
The IsHamiltonian(G) function returns true if the graph is Hamiltonian and false otherwise. If G is Hamiltonian and a name C is specified as a second argument, then C is assigned a list of vertices of a Hamiltonian cycle of the graph starting and ending with the first vertex in G. For example, if the graph G is the triangle graph created with Graph({{1,2},{1,3},{2,3}}), the cycle is output as .
The algorithm works for directed graphs and it ignores the edge weights of weighted graphs.
The algorithm first checks whether G is disconnected or whether it has any articulation points. If so, then G is not Hamiltonian. Then it tests whether the minimum degree of G is at least where is the number of vertices. If so G is Hamiltonian. Then, if G is not too sparse, the algorithm checks whether the independence number of G is greater than . If so, then G is not Hamiltonian. Failing these checks, the algorithm does a simple exhaustive search for a Hamiltonian cycle using depth-first-search. By setting infolevel[IsHamiltonian] to an integer greater than 1 a message will be displayed stating how the graph was proven, or disproven, to be Hamiltonian.
An example of a graph which is Hamiltonian for which it will take exponential time to find a Hamiltonian cycle is the hypercube in d dimensions which has vertices and edges. The algorithm has no difficulty in finding a Hamiltonian cycle for where and but for , , and it takes a long time.
Examples
IsHamiltonian: "graph satisfies MinimumDegree(G) >= NumberOfVertices(G)/2 ==> it is hamiltonian"
IsHamiltonian: "graph satisfies IndependenceNumber(G) > NumberOfVertices(G)/2 ==> it's not hamiltonian"
See Also
DrawGraph, HighlightTrail, IsEulerian, SpecialGraphs[HypercubeGraph], TravelingSalesman
Download Help Document