JGF - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

JGF (.jgf) Graph Format

JGF file format

Description

 • JGF (JSON Graph Format) is a JSON-based file format for storing one or more graphs.
 • It also allows the application of labels to vertices and edges.
 • The format supports directed and undirected graphs, and permits the association of arbitrary metadata with vertices and edges.
 • 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 JGF displaying the relationships of various mammal species.

 > $\mathrm{Mammals}≔\mathrm{Import}\left("example/mammals.jgf",\mathrm{base}=\mathrm{datadir}\right)$
 ${\mathrm{Mammals}}{≔}{\mathrm{Graph 1: a directed graph with 18 vertices and 17 arc\left(s\right)}}$ (1)
 > $\mathrm{GraphTheory}:-\mathrm{DrawGraph}\left(\mathrm{Mammals},\mathrm{style}=\mathrm{spring}\right)$
 > $\mathrm{RPS}≔\mathrm{Import}\left("example/RockPaperScissors.jgf",\mathrm{base}=\mathrm{datadir}\right)$
 ${\mathrm{RPS}}{≔}{\mathrm{Graph 2: a directed graph with 3 vertices and 3 arc\left(s\right)}}$ (2)
 > $\mathrm{GraphTheory}:-\mathrm{DrawGraph}\left(\mathrm{RPS}\right)$

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

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

References

 JSON Graph Format Specification, http://jsongraphformat.info/.