Import and Export of Graph Documents

Rocs currently supports import and export of the following file formats:

  • DOT files, also known as Graphviz files

  • GML files

  • Trivial Graph Format files

  • Keyhole Markup Language Format

Trivial Graph File Format

The Trivial Graph Format (TGF) is a simple text-based file format for describing graphs. A TGF file consists of a list of node definitions, that map the node IDs to labels, followed by a list of the edges. In this format it is only possible to have one label per node and one value per edge. Rocs interprets imported graphs as undirected graphs. Exported graphs will contain two edges per connection if connections are bidirectional.

Format Specification

  • The file starts with a list of nodes (one node per line), followed by a line with the only character "#", followed by a list of edges (one edge per line).

  • A node consists of an integer (identifier), followed by a space, followed by an arbitrary string.

  • An edge consists of two integers (identifiers) separated by a space, followed by a space, followed by an arbitrary string. It is assumed that the directed edge points from the first identifier to the second identifier.

Example

1 starting node
2 transmitter
3 sink
#
1 2 blue
2 1 red
2 3 green

DOT Language / Graphviz Graph File Format

The DOT language is a plain text graph description language that allows both,a good human readable representation of graphs as well as an efficient processing by graph layout programs. DOT is the default file format for the Graphviz graph visualization suite, but is also widely used by other graph tools. The usual file endings for DOT are .gv and .dot.

Unsupported Features

Rocs can parse every graph file that contains a graph specified according to the DOT language specification[1]. The support of language features is complete, despite of the following exceptions:

  • subgraph: Due to the lack of a subgraph concept in Rocs, subgraphs are only imported as a set of date elements and connections. Especially, connections to or from subgraphs are not imported.

  • HTML and XML attributes: Attributes (like labels) that contain HTML or XML syntax are read unchanged. Especially, not adjustment of fonts and styles are read from those attributes.

Example

digraph myGraph {
    a -> b -> c;
    b -> d;
}


[1] http://www.graphviz.org/content/dot-language