Trivial Graph Format

Trivial Graph Format (TGF) is a simple text-based adjacency list file format for describing graphs,{{r|rt15}} widely used because of its simplicity.{{r|pitas}}

Format

The format 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. Because of its lack of standardization, the format has many variations.{{r|rt15}} For instance, some implementations of the format require the node IDs to be integers,{{r|kde}} 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.{{r|kde}}

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, a graph editor that can handle TGF file format.

References

{{reflist|refs=

{{citation

| last1 = Canabrava | first1 = Tomaz

| last2 = Cord-Landwehr | first2 = Andreas

| contribution = Chapter 4. Import and Export

| contribution-url = https://docs.kde.org/trunk5/en/kdeedu/rocs/import-export.html

| date = April 10, 2016

| title = The Rocs Handbook, Revision Rocs 2.1.50 (Applications 16.04)}}

{{citation

| last = Pitas | first = Ioannis

| contribution = 1.5 Graph storage formats and visualization

| contribution-url = https://books.google.com/books?id=BvYYCwAAQBAJ&pg=PA14

| isbn = 9781498719056

| page = 14

| publisher = CRC Press

| series = Chapman & Hall/CRC Data Mining and Knowledge Discovery Series

| title = Graph-Based Social Media Analysis

| volume = 39

| year = 2016}}

{{citation

| last1 = Roughan | first1 = Matthew

| last2 = Tuke | first2 = Jonathan

| contribution = The Hitchhikers Guide to Sharing Graph Data

| contribution-url = http://www.maths.adelaide.edu.au/matthew.roughan/Papers/hitch_hikers_guide.pdf

| date = August 2015

| doi = 10.1109/ficloud.2015.76

| publisher = IEEE

| title = 2015 3rd International Conference on Future Internet of Things and Cloud| s2cid = 14560300

}}

}}