TGF (.tgf) Graph Format - Maple Programming Help

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

TGF (.tgf) Graph Format

TGF file format

Description

 • TGF (Trivial Graph Format) is a simple text-based file format for storing a single graph.
 • It also allows the application of labels to vertices and edges.
 • The format does not specify whether the graph is directed or undirected.
 • 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 TGF file encoding a directed graph.

 > $G≔\mathrm{Import}\left("example/digraph.tgf",\mathrm{base}=\mathrm{datadir}\right)$
 ${G}{≔}{\mathrm{Graph 1: a directed unweighted graph with 11 vertices and 12 arc\left(s\right)}}$ (1)
 > $\mathrm{GraphTheory}:-\mathrm{DrawGraph}\left(G,\mathrm{style}=\mathrm{spring}\right)$

Export the Dyck graph to a TGF file in the home directory of the current user.

 > $\mathrm{DG}≔\mathrm{GraphTheory}:-\mathrm{SpecialGraphs}:-\mathrm{DyckGraph}\left(\right)$
 ${\mathrm{DG}}{≔}{\mathrm{Graph 2: an undirected unweighted graph with 32 vertices and 48 edge\left(s\right)}}$ (2)
 > $\mathrm{Export}\left("dyck.tgf",\mathrm{DG},\mathrm{base}=\mathrm{homedir}\right)$
 ${437}$ (3)