TGF, the "Trivial Graph Format," supports the pure graph structure together with (at most) one label per graph element. Anything related to position, dimension, or visual representation is ignored. Also, TGF does not provide support for nested graph structures.
Example 8.9, “TGF representation” shows the TGF representation for the example graph from Figure 8.3, “A simple graph”.
A TGF file is written using class TGFIOHandler
.
The code fragment in Example 8.10, “Instantiating a TGFIOHandler” shows how to instantiate
a TGFIOHandler and using it to write a graph to file.
Example 8.10. Instantiating a TGFIOHandler
// Instantiate a TGF I/O handler and write the graph to file. IOHandler ioh = new TGFIOHandler(); writeGraphToFile(graph, ioh, "MyTGF.tgf");
By means of the setter methods listed in API Excerpt 8.5, “Setter methods from class TGFIOHandler” both writing and reading of node labels and edge labels, respectively can be controlled.
API Excerpt 8.5. Setter methods from class TGFIOHandler
void setIgnoreEdgeLabels(boolean ignore) void setIgnoreNodeLabels(boolean ignore)
Due to the lack of support for both coordinates and dimensions reading a graph from a TGF file can result in a representation that differs from the exported graph.
|
Copyright ©2004-2008, yWorks GmbH. All rights reserved. |