Trivial Graph Format (TGF) is a simple text-based
adjacency list
In graph theory and computer science, an adjacency list is a collection of unordered lists used to represent a finite graph. Each unordered list within an adjacency list describes the set of neighbors of a particular vertex in the graph. This is ...
file format for describing
graphs
Graph may refer to:
Mathematics
*Graph (discrete mathematics), a structure made of vertices and edges
**Graph theory, the study of such graphs and their properties
*Graph (topology), a topological space resembling a graph in the sense of discre ...
, widely used because of its simplicity.
Format
The format consists of a list of
node
In general, a node is a localized swelling (a "knot") or a point of intersection (a vertex).
Node may refer to:
In mathematics
*Vertex (graph theory), a vertex in a mathematical graph
*Vertex (geometry), a point where two or more curves, lines, ...
definitions, which map node IDs to labels, followed by a list of edges, which specify node pairs and an optional edge label. Because of its lack of standardization, the format has many variations. For instance, some implementations of the format require the node IDs to be integers, while others allow more general alphanumeric identifiers.
Each node definition is a single line of text starting with the node ID, separated by a space from its label.
The node definitions are separated from the edge definitions by a line containing the "#" character.
Each edge definition is another line of text, starting with the two IDs for the endpoints of the edge separated by a space. If the edge has a label, it appears on the same line after the endpoint IDs.
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.
Example
A simple graph with two nodes and one edge might look like:
1 First node
2 Second node
#
1 2 Edge between the two
See also
*
yEd
yEd is a general-purpose diagramming program with a multi-document interface.
It is a cross-platform application written in Java (programming language), Java that runs on Windows, Linux, Mac OS, and other platforms that support the Java Virtual ...
, a graph editor that can handle TGF file format.
References
External links
Using TGF in the yFiles Graph Drawing library
{{Graph representations
Graph description languages