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[ImportGraph]
GraphTheory[ExportGraph]
Calling Sequence
ImportGraph(filename, format, output=outform)
ExportGraph(G, filename, format)
ExportGraph(G, filename, format, append)
Parameters
G
-
graph, list of graphs, or graph generating function
filename
string, symbol, or function
format
symbol or string
outform
output format, one of graph, list, or iterator
Description
ImportGraph reads one or more graphs from a file. For a file containing a single graph, the supported formats are `dimacs`, `dimacs_relaxed`, `combinatorica`, `edges`, and `dot`. For a file containing multiple graphs, the supported formats are `sparse6` and `graph6`.
The list and iterator output forms only apply to the case of a file with multiple graphs. The list output form returns a list of all graphs in the file, and the iterator output form returns a procedure that generates all the graphs in the file one at a time. For the iterator, the returned procedure called with no arguments simply outputs the next graph, returning FAIL after the final graph in the file has been output.
Note: The list of graphs and graph generating function forms for G only apply to the multiple graph per file formats.
ExportGraph writes a one or more graphs to a file using the specified format. For exporting a single graph to a file, the supported formats are `dimacs` (only for undirected unweighted graphs), `combinatorica` (only for undirected unweighted graphs), edges (only for undirected unweighted graphs), `metapost`, and `dot`. For exporting multiple graphs to a file, the supported formats are `sparse6` and `graph6`, and these can be mixed in a file (either being valid to specify reading both formats).
The literal `append` specifies that the graph(s) should be appended to the specified file, while by default the file is simply overwritten.
To export a graph in Maple's format, use the save command. This saves the entire Maple data structure to a file, including vertex positions (used for drawing) and highlighted vertices. To read it back in later, use the read command.
Examples
File "Graph1.mp" created in metapost format
This creates the file "Graph1.mp" in the current working directory (see currentdir). In Unix, the "mpost" command can then be used to convert a metapost file to PostScript, for inclusion in a LaTeX document.
We have highlighted the star in the Petersen graph and saved it to a file "petersen.txt" in the current working directory. When the file is read, the graph will be reloaded (in the variable P) with the highlighting intact.
See Also
Graph, read, save
Download Help Document