<chapter id="import-export">
<title>Import and Export</title>
<sect1 id="import-export-projects">
    <title>Exchange &rocs; Projects</title>
    <para>
        &rocs; projects can be imported and exported as archived <literal>.tar.gz</literal> files.
        These archives can be used to exchange projects.
        Import and Export can be done with <menuchoice><guimenu>Graph Document</guimenu> <guimenuitem>Import Graph</guimenuitem></menuchoice> and <menuchoice><guimenu>Graph Document</guimenu> <guimenuitem>Export Graph as</guimenuitem></menuchoice>, respectively.
    </para>
</sect1>

<sect1 id="import-export-graphs">
    <title>Import and Export of Graph Documents</title>
    <para>&rocs; currently supports import and export of the following file formats:</para>
    <itemizedlist>
        <listitem><para>DOT files, also known as Graphviz files</para></listitem>
        <listitem><para>GML files</para></listitem>
        <listitem><para>Trivial Graph Format files</para></listitem>
        <listitem><para>Keyhole Markup Language Format</para></listitem>
    </itemizedlist>

<sect2 id="format-specification-tgf">
<title>Trivial Graph File Format</title>
<para>
    The <emphasis>Trivial Graph Format</emphasis> (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.
</para>

<sect3>
<title>Format Specification</title>
    <itemizedlist>
        <listitem><para>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).</para></listitem>
        <listitem><para>A node consists of an integer (identifier), followed by a space, followed by an arbitrary string.</para></listitem>
        <listitem><para>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.</para></listitem>
    </itemizedlist>
</sect3>
<sect3>
<title>Example</title>
<programlisting>
1 starting node
2 transmitter
3 sink
#
1 2 blue
2 1 red
2 3 green
</programlisting>
</sect3>
</sect2>

<sect2 id="format-specification-dot">
<title>DOT Language / Graphviz Graph File Format</title>
<para>
    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 <emphasis>.gv</emphasis> and <emphasis>.dot</emphasis>.
</para>

<sect3>
<title>Unsupported Features</title>
<para>
    &rocs; can parse every graph file that contains a graph specified according to the DOT language specification<footnote><para>http://www.graphviz.org/content/dot-language</para></footnote>.
    The support of language features is complete, despite of the following exceptions:
</para>
    <itemizedlist>
        <listitem><para>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.</para></listitem>
        <listitem><para>&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.</para></listitem>
    </itemizedlist>
</sect3>
<sect3>
<title>Example</title>
<programlisting>
digraph myGraph {
    a -> b -> c;
    b -> d;
}
</programlisting>
</sect3>
</sect2>

</sect1>
</chapter>