<sect1>
<title>Scripting API for Graph Backend</title>

<para>
    The data structure properties dialog allows access to configure settings specific to the Graph backend.
    There, with <guilabel>Graph Type</guilabel> you can select the type of the graph. The meaning of these types is as follows:
</para>
<itemizedlist>
    <listitem><para>
    <guilabel>Graph</guilabel>: Graph at which same edges (with respect to start and end points) may not exist multiple times.
    </para></listitem>
    <listitem><para>
    <guilabel>Multigraph</guilabel>: Graph at which same edges (with respect to start and end points) may exist multiple times.
    </para></listitem>
</itemizedlist>

<sect2>
<title>Graph Data Structure</title>
<para>
A graph objects holds the information of a data structure of type <quote>Graph</quote>.
</para>

<sect3>
<title>Properties</title>
<itemizedlist>

    <listitem>
        <para>
        <emphasis>name</emphasis> :
        </para>
        <para>The unique name of this data structure.</para>
    </listitem>

</itemizedlist>
</sect3>

<sect3>
<title>Methods</title>
<variablelist>

    <varlistentry>
    <term>nodes()</term>
    <listitem>
        <para>Return list all nodes in the graph.</para>
    <funcsynopsis><funcprototype>
    <funcdef>array <function>nodes</function></funcdef>
    <paramdef></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>nodes(type)</term>
    <listitem>
        <para>Return list all nodes in the graph of specified type.</para>
    <funcsynopsis><funcprototype>
    <funcdef>array <function>nodes</function></funcdef>
    <paramdef>int <parameter><replaceable>type</replaceable></parameter></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>edges()</term>
    <listitem>
        <para>Return list all edges in the graph.</para>
    <funcsynopsis><funcprototype>
    <funcdef>array <function>edges</function></funcdef>
    <paramdef></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>edges(type)</term>
    <listitem>
        <para>Return list all edges in the graph of specified type.</para>
    <funcsynopsis><funcprototype>
    <funcdef>array <function>edges</function></funcdef>
        <paramdef>int <parameter><replaceable>type</replaceable></parameter></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>createNode(type)</term>
    <listitem>
        <para>Create a new node of the specified type and return the created node. If the type is not registered, no node is created.</para>
    <funcsynopsis><funcprototype>
    <funcdef>GraphNode <function>createNode</function></funcdef>
        <paramdef>int <parameter><replaceable>type</replaceable></parameter></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>createNode()</term>
    <listitem>
        <para>Create a new node of default type and return the created node.</para>
    <funcsynopsis><funcprototype>
    <funcdef>GraphNode <function>createNode</function></funcdef>
    <paramdef></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>createEdge(from, to, type)</term>
    <listitem>
        <para>Create an edge from node "from" to node "to" of the specified type and return the created edge. If the type is not registered, no edge is created.</para>
    <funcsynopsis><funcprototype>
    <funcdef>GraphEdge <function>createEdge</function></funcdef>
        <paramdef>GraphNode <parameter><replaceable>from</replaceable></parameter></paramdef>
        <paramdef>GraphNode <parameter><replaceable>to</replaceable></parameter></paramdef>
        <paramdef>int <parameter><replaceable>type</replaceable></parameter></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>createEdge(from, to)</term>
    <listitem>
        <para>Create an edge from node "from" to node "to" of default type and return the created edge.</para>
    <funcsynopsis><funcprototype>
    <funcdef>GraphEdge <function>createEdge</function></funcdef>
        <paramdef>GraphNode <parameter><replaceable>from</replaceable></parameter></paramdef>
        <paramdef>GraphNode <parameter><replaceable>to</replaceable></parameter></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>distances(from)</term>
    <listitem>
        <para>Returns an array of shortest path lengths from this node to every other node in the graph.</para>
    <funcsynopsis><funcprototype>
    <funcdef>Array <function>distances</function></funcdef>
        <paramdef>GraphNode <parameter><replaceable>from</replaceable></parameter></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

</variablelist>
</sect3>
</sect2>

<sect2>
<title>Graph Node</title>
<para>
A node is the data element of a graph.
</para>

<sect3>
<title>Properties</title>
<itemizedlist>

    <listitem>
        <para>
        <emphasis>width</emphasis> :
        </para>
        <para>The size of this data element.</para>
    </listitem>

    <listitem>
        <para>
        <emphasis>x</emphasis> :
        </para>
        <para>The x-coordinate of this data element.</para>
    </listitem>

    <listitem>
        <para>
        <emphasis>y</emphasis> :
        </para>
        <para>The y-coordinate of this data element.</para>
    </listitem>

    <listitem>
        <para>
        <emphasis>id</emphasis> :
        </para>
        <para>The unique identifier of this data element.</para>
    </listitem>

    <listitem>
        <para>
        <emphasis>color</emphasis> :
        </para>
        <para>The color of this data element stated as hexadecimal value.</para>
    </listitem>
</itemizedlist>
</sect3>

<sect3>
<title>Methods</title>
<variablelist>

    <varlistentry>
    <term>neighbors()</term>
    <listitem>
        <para>Return list all nodes connected to this node. This method respects if edges are directed.</para>
    <funcsynopsis><funcprototype>
    <funcdef>array <function>neighbors</function></funcdef>
    <paramdef></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>edges()</term>
    <listitem>
        <para>Return a list of all edges (incoming and outgoing) of this node.</para>
    <funcsynopsis><funcprototype>
    <funcdef>array <function>edges</function></funcdef>
    <paramdef></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>edges(type)</term>
    <listitem>
        <para>Return a list of all edges (incoming and outgoing) of this node of a specified type.</para>
    <funcsynopsis><funcprototype>
    <funcdef>array <function>edges</function></funcdef>
        <paramdef>int <parameter><replaceable>type</replaceable></parameter></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>inEdges()</term>
    <listitem>
        <para>Return a list of incoming edges of this node.</para>
    <funcsynopsis><funcprototype>
    <funcdef>array <function>inEdges</function></funcdef>
    <paramdef></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>inEdges(type)</term>
    <listitem>
        <para>Return a list of all incoming edges of this node of a specified type.</para>
    <funcsynopsis><funcprototype>
    <funcdef>array <function>inEdges</function></funcdef>
        <paramdef>int <parameter><replaceable>type</replaceable></parameter></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>outEdges()</term>
    <listitem>
        <para>Return a list of all outgoing edges of this node.</para>
    <funcsynopsis><funcprototype>
    <funcdef>array <function>outEdges</function></funcdef>
    <paramdef></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>outEdges(type)</term>
    <listitem>
        <para>Return a list of all outgoing edges of this node of a specified type.</para>
    <funcsynopsis><funcprototype>
    <funcdef>array <function>outEdges</function></funcdef>
        <paramdef>int <parameter><replaceable>type</replaceable></parameter></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>edgesTo(target)</term>
    <listitem>
        <para>Return a list of all edges of this node to the specified node.</para>
    <funcsynopsis><funcprototype>
    <funcdef>array <function>edgesTo</function></funcdef>
        <paramdef>GraphNode <parameter><replaceable>target</replaceable></parameter></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>
</variablelist>
</sect3>
</sect2>


<sect2>
<title>Graph Edge</title>
<para>
An Edge is the connection of two GraphNodes. Edges can be directed or undirected, depending on their type.
</para>

<sect3>
<title>Properties</title>
<itemizedlist>
    <listitem>
        <para>
        <emphasis>width</emphasis> :
        </para>
        <para>The width of the connection.</para>
    </listitem>

    <listitem>
        <para>
        <emphasis>directed</emphasis> :
        </para>
        <para>If true, the connection is directed. Otherwise is connection is undirected.</para>
    </listitem>

    <listitem>
        <para>
        <emphasis>from</emphasis> :
        </para>
        <para>Start of the connection.</para>
    </listitem>

    <listitem>
        <para>
        <emphasis>to</emphasis> :
        </para>
        <para>End of the connection</para>
    </listitem>

    <listitem>
        <para>
        <emphasis>color</emphasis> :
        </para>
        <para>ID of the connection type.</para>
    </listitem>
</itemizedlist>
</sect3>


<sect3>
<title>Methods</title>
<variablelist>

    <varlistentry>
    <term>remove()</term>
    <listitem>
        <para>Remove this connection.</para>
    <funcsynopsis><funcprototype>
    <funcdef>void <function>remove</function></funcdef>
    <paramdef></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>add_property(name, value)</term>
    <listitem>
        <para>Add a new property to the connection.</para>
    <funcsynopsis><funcprototype>
    <funcdef>void <function>add_property</function></funcdef>
        <paramdef>string <parameter><replaceable>name</replaceable></parameter></paramdef>
        <paramdef>string <parameter><replaceable>value</replaceable></parameter></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

    <varlistentry>
    <term>remove_property(name)</term>
    <listitem>
        <para>Remove an existing property from the connection.</para>
    <funcsynopsis><funcprototype>
    <funcdef>void <function>remove_property</function></funcdef>
        <paramdef>string <parameter><replaceable>name</replaceable></parameter></paramdef>
    </funcprototype>
    </funcsynopsis>
    </listitem>
    </varlistentry>

</variablelist>
</sect3>
</sect2>

</sect1>
