Jump to content

Trivial Graph Format

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Joey-das-WBF (talk | contribs) at 07:02, 11 May 2016 (Changed description of a link). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Trivial Graph Format (TGF) is a simple text-based file format for describing graphs. It consists of a list of node definitions, which map node IDs to labels, followed by a list of edges, which specify node pairs and an optional edge label. Node IDs can be arbitrary identifiers, whereas labels for both nodes and edges are plain strings.

The graph may be interpreted as a directed or undirected graph. For directed graphs, to specify the concept of bi-directionality in an edge, one may either specify two edges (forward and back) or differentiate the edge by means of a label. For more powerful specification of graphs, see the other graph file formats below.

Example

A simple graph with 2 nodes and 1 edge might look like this:

1 First node
2 Second node
#
1 2 Edge between the two

The # sign marks the end of the node list and the start of the edge list.

See also

  • yEd, a graph editor that can handle TGF file format.