Trivial Graph Format

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

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.


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[edit]

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

External links[edit]