GraphML (.graphml) Graph Format - Maple Programming Help

Home : Support : Online Help : Programming : Input and Output : File Formats : Formats/GraphML

GraphML (.graphml) Graph Format

GraphML file format

Description

 • GraphML is an XML-based file format for storing a single undirected or directed graph.
 • The GraphTheory[ImportGraph] and GraphTheory[ExportGraph] commands can read from and write to this format.
 • The general-purpose commands Import and Export also support this format.

Examples

Import a GraphML file encoding the Petersen graph.

 > $\mathrm{Petersen}≔\mathrm{Import}\left("example/petersen.graphml",\mathrm{base}=\mathrm{datadir}\right)$
 ${\mathrm{Petersen}}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 10 vertices and 15 edge\left(s\right)}}$ (1)
 > $\mathrm{GraphTheory}:-\mathrm{DrawGraph}\left(\mathrm{Petersen},\mathrm{style}=\mathrm{spring}\right)$

Export the Clebsch graph to a GraphML file in the home directory of the current user.

 > $\mathrm{CG}≔\mathrm{GraphTheory}:-\mathrm{SpecialGraphs}:-\mathrm{ClebschGraph}\left(\right)$
 ${\mathrm{CG}}{≔}{\mathrm{Graph 2: an undirected unweighted graph with 16 vertices and 40 edge\left(s\right)}}$ (2)
 > $\mathrm{Export}\left("clebsch.graphml",\mathrm{CG},\mathrm{base}=\mathrm{homedir}\right)$
 ${4351}$ (3)

References

 GraphML Specification, graphdrawing.org.