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[MinimalSpanningTree]
GraphTheory[KruskalsAlgorithm]
GraphTheory[PrimsAlgorithm]
Calling Sequence
MinimalSpanningTree(G)
MinimalSpanningTree(G,w,animate)
KruskalsAlgorithm(G,w,animate)
PrimsAlgorithm(G,w,animate)
Parameters
G
-
an undirected graph, weighted or unweighted
w
(optional) name
animate
(optional) literal animate indicating that an animation of the algorithm should be returned instead of the tree.
Description
MinimalSpanningTree, KruskalsAlgorithm, and PrimsAlgorithm all return a spanning tree of the undirected graph G with minimum possible weight. If the graph G is unweighted, each edge is considered to have weight 1.
If the optional parameter w is given, it is assigned the weight of the minimal spanning tree.
If the literal animate, or animate=true is given, an animation of the application of the algorithm will be returned instead of the minimal spanning tree.
The routine PrimsAlgorithm uses Prim's algorithm for computing the minimal spanning tree and the routine KruskalsAlgorithm uses Kruskal's algorithm. The routine MinimalSpanningTree uses Kruskal's algorithm.
Setting infolevel[KruskalsAlgorithm] := 4; and infolevel[PrimsAlgorithm] := 4; results in some information being printed out, indicating the steps of the respective algorithms.
Examples
Note: To animate the example above, open this help page as a worksheet, click the plot in the worksheet, and use the controls in the animation toolbar above the worksheet.
KruskalsAlgorithm: "constructing minimal spanning tree on 100 vertices." KruskalsAlgorithm: "using Kruskal's algorithm at time 0.251" KruskalsAlgorithm: "making heap of 2485 edges at time: 0.261" KruskalsAlgorithm: "finding the edges at time: 0.298" KruskalsAlgorithm: "exiting Kruskal's algorithm at time 0.343"
See Also
AllPairsDistance, Diameter, SpanningTree, WeightMatrix
Download Help Document