\begin{manual}

\resetmancounter

\section*{Attributed Graphs ( GraphML\_graph )}
\label{Attributed Graphs}
\label{GraphML_graph}

\mansection{Definition}


\ensuremath{\mathit{GraphML\nspaceunderscore\_graph}} extends both
\ensuremath{\mathit{graphml\nspaceunderscore\_attributes}\Ltemplateless \mathit{string}\Ltemplategreater } and \ensuremath{\mathit{graphml\nspaceunderscore\_parseinfo}\Ltemplateless \mathit{string}\Ltemplategreater },
and thus inherits from \ensuremath{\mathit{graphml\nspaceunderscore\_structure}\Ltemplateless \mathit{string}\Ltemplategreater }.
An instance \ensuremath{\mathit{gm}} of \ensuremath{\mathit{GraphML\nspaceunderscore\_graph}} is a data structure that holds 
references to a \ensuremath{\mathit{graph}} and associated \ensuremath{\mathit{node\nspaceunderscore\_}} and 
\ensuremath{\mathit{edge\nspaceunderscore\_array}}s.

Any of the following types may be used for attribute data: 
\ensuremath{\mathit{int}}, \ensuremath{\mathit{long}}, \ensuremath{\mathit{float}}, \ensuremath{\mathit{double}}, \ensuremath{\mathit{string}} (i.e.\ \ensuremath{\mathit{leda\nspaceunderscore\_string}}), 
or \ensuremath{\mathit{bool}}.  Types are identified by instances of 
\begin{quote}
\ensuremath{\mathit{GraphML\nspaceunderscore\_graph}\DP\ \mathit{gm\nspaceunderscore\_data\nspaceunderscore\_type}\ =\ }\\
\qquad\ensuremath{\{bool\nspaceunderscore\_data,} \ensuremath{int\nspaceunderscore\_data,} \ensuremath{long\nspaceunderscore\_data,} \ensuremath{float\nspaceunderscore\_data,} \ensuremath{double\nspaceunderscore\_data,} \ensuremath{
string\nspaceunderscore\_data\}}.
\end{quote}

 



\mansection{Types}

\typemember{\ensuremath{\mathit{GraphML\nspaceunderscore\_graph}\DP\ \mathit{gm\nspaceunderscore\_handle\nspaceunderscore\_type}}}
{
    type for data handles (references to arrays of attribute data)
   

}

\setlength{\declwidth}{1cm}\computewidths

\mansection{Creation}

\create{\ensuremath{\mathit{GraphML\nspaceunderscore\_graph}}}{\ensuremath{\mathit{gm}}}{\ensuremath{\mathit{graph}\&\ G}}
{
    creates an instance \ensuremath{\mathit{gm}} of type \ensuremath{\mathit{GraphML\nspaceunderscore\_graph}} for graph \ensuremath{G}.
     

}

\setlength{\typewidth}{1cm}\setlength{\callwidth}{1cm}\computewidths

\mansection{Operations}


    \headerline{adding attribute data}
     



\function[\ensuremath{\mathit{typename}\ T}]{\ensuremath{\mathit{gm\nspaceunderscore\_handle\nspaceunderscore\_type}}}
{\ensuremath{\mathit{gm}\nspacedot.}new\nspaceunderscore\_data}
{\ensuremath{\mathit{string}\ \mathit{name},} \ensuremath{\mathit{gm\nspaceunderscore\_data\nspaceunderscore\_type}\ \mathit{type},} \ensuremath{\mathit{node\nspaceunderscore\_array}\Ltemplateless T\Ltemplategreater \&\ \mathit{data},} \ensuremath{T\ \mathit{default\nspaceunderscore\_value},} \ensuremath{\mathit{string}\ \mathit{desc}}}
{
    adds a new node attribute to \ensuremath{\mathit{gm}}, and returns
    a handle which identifies this attribute and can be
    used as argument for \ensuremath{\mathit{del\nspaceunderscore\_node\nspaceunderscore\_data}}.
    \\
    PRECONDITION:\\
    Template parameter \ensuremath{T} must match \ensuremath{\mathit{type}}.
     

}

\function[\ensuremath{\mathit{typename}\ T}]{\ensuremath{\mathit{gm\nspaceunderscore\_handle\nspaceunderscore\_type}}}
{\ensuremath{\mathit{gm}\nspacedot.}new\nspaceunderscore\_data}
{\ensuremath{\mathit{string}\ \mathit{name},} \ensuremath{\mathit{gm\nspaceunderscore\_data\nspaceunderscore\_type}\ \mathit{type},} \ensuremath{\mathit{edge\nspaceunderscore\_array}\Ltemplateless T\Ltemplategreater \&\ \mathit{data},} \ensuremath{T\ \mathit{default\nspaceunderscore\_value},} \ensuremath{\mathit{string}\ \mathit{desc}}}
{
    adds a new edge attribute to \ensuremath{\mathit{gm}}, and returns
    a handle that identifies this attribute and can be
    used as argument for \ensuremath{\mathit{del\nspaceunderscore\_edge\nspaceunderscore\_data}}.
    \\
    PRECONDITION:\\
    Template parameter \ensuremath{T} must match \ensuremath{\mathit{type}}.
     

}


    \headerline{accessing attribute data}
     



\function{\ensuremath{\mathit{list}\Ltemplateless \mathit{gm\nspaceunderscore\_handle\nspaceunderscore\_type}\Ltemplategreater }}
{\ensuremath{\mathit{gm}\nspacedot.}node\nspaceunderscore\_data\nspaceunderscore\_handles}
{$\,$}
{
    returns the list of handles 
    for all node attributes referenced by \ensuremath{\mathit{gm}}.
     

}

\function{\ensuremath{\mathit{list}\Ltemplateless \mathit{gm\nspaceunderscore\_handle\nspaceunderscore\_type}\Ltemplategreater }}
{\ensuremath{\mathit{gm}\nspacedot.}edge\nspaceunderscore\_data\nspaceunderscore\_handles}
{$\,$}
{
    returns the list of handles 
    for all edge attributes referenced by \ensuremath{\mathit{gm}}.
     

}


The following methods check whether their argument is
a valid node data handle.  In case it is not, the LEDA \ensuremath{\mathit{error\nspaceunderscore\_handler}}
is invoked.  These tests can be turned off using flag
{\tt -DLEDA\_CHECKING\_OFF} during compilation.
   



\function{\ensuremath{\mathit{gm\nspaceunderscore\_data\nspaceunderscore\_type}}}
{\ensuremath{\mathit{gm}\nspacedot.}data\nspaceunderscore\_type}
{\ensuremath{\mathit{gm\nspaceunderscore\_handle\nspaceunderscore\_type}\ \mathit{handle}}}
{
    returns the data type of the attribute identified by \ensuremath{\mathit{handle}}.
     

}

\function{\ensuremath{\mathit{string}}}
{\ensuremath{\mathit{gm}\nspacedot.}data\nspaceunderscore\_name}
{\ensuremath{\mathit{gm\nspaceunderscore\_handle\nspaceunderscore\_type}\ \mathit{handle}}}
{
    returns the name of the attribute identified by \ensuremath{\mathit{handle}}.
     

}

\function{\ensuremath{\mathit{string}}}
{\ensuremath{\mathit{gm}\nspacedot.}data\nspaceunderscore\_desc}
{\ensuremath{\mathit{gm\nspaceunderscore\_handle\nspaceunderscore\_type}\ \mathit{handle}}}
{
    returns the description of the attribute identified by \ensuremath{\mathit{handle}}.
     

}

\function[\ensuremath{\mathit{typename}\ T}]{\ensuremath{\mathit{node\nspaceunderscore\_array}\Ltemplateless T\Ltemplategreater \&}}
{\ensuremath{\mathit{gm}\nspacedot.}node\nspaceunderscore\_data}
{\ensuremath{\mathit{gm\nspaceunderscore\_handle\nspaceunderscore\_type}\ \mathit{handle}}}
{
    returns the array of values of the attribute identified by 
    \ensuremath{\mathit{handle}}.\\
    PRECONDITION:\\
    \ensuremath{\mathit{handle}} is a valid \emph{node} data handle.
    This template is implemented only for types \ensuremath{\mathit{bool}}, \ensuremath{\mathit{int}}, \ensuremath{\mathit{long}}, 
    \ensuremath{\mathit{float}}, \ensuremath{\mathit{double}}, and \ensuremath{\mathit{string}}.
     

}

\function[\ensuremath{\mathit{typename}\ T}]{\ensuremath{\mathit{edge\nspaceunderscore\_array}\Ltemplateless T\Ltemplategreater \&}}
{\ensuremath{\mathit{gm}\nspacedot.}edge\nspaceunderscore\_data}
{\ensuremath{\mathit{gm\nspaceunderscore\_handle\nspaceunderscore\_type}\ \mathit{handle}}}
{
    returns the array of values of the attribute identified by 
    \ensuremath{\mathit{handle}}.\\
    PRECONDITION:\\
    \ensuremath{\mathit{handle}} is a valid \emph{edge} data handle.
    This template is implemented only for types \ensuremath{\mathit{bool}}, \ensuremath{\mathit{int}}, \ensuremath{\mathit{long}}, 
    \ensuremath{\mathit{float}}, \ensuremath{\mathit{double}}, and \ensuremath{\mathit{string}}.
     

}

\function[\ensuremath{\mathit{typename}\ T}]{\ensuremath{T\&}}
{\ensuremath{\mathit{gm}\nspacedot.}data\nspaceunderscore\_default}
{\ensuremath{\mathit{gm\nspaceunderscore\_handle\nspaceunderscore\_type}\ \mathit{handle}}}
{
    returns the default value of the attribute identified by \ensuremath{\mathit{handle}}.
    This template is implemented only for types \ensuremath{\mathit{bool}}, \ensuremath{\mathit{int}}, \ensuremath{\mathit{long}}, 
    \ensuremath{\mathit{float}}, \ensuremath{\mathit{double}}, and \ensuremath{\mathit{string}}.
     

}


    \headerline{removing attribute data}
     



\function{\ensuremath{\mathit{bool}}}
{\ensuremath{\mathit{gm}\nspacedot.}del\nspaceunderscore\_data}
{\ensuremath{\mathit{gm\nspaceunderscore\_handle\nspaceunderscore\_type}\ \mathit{handle}}}
{
    removes the references to a data attribute 
    (identified by \ensuremath{\mathit{handle}}) from \ensuremath{\mathit{gm}}.
    Returns true if and only if the removal has been successful
    (i.e.\ \ensuremath{\mathit{handle}} corresponds to an existing data attribute).
     

}

\end{manual}


