diff -r 8f589de42c76 -r 7d028a73d7f2 doc/graph_io.dox
--- a/doc/graph_io.dox Mon Jul 04 17:51:07 2005 +0000
+++ b/doc/graph_io.dox Tue Jul 05 14:36:10 2005 +0000
@@ -4,8 +4,10 @@
\page graph-io-page Graph Input-Output
-The standard graph IO enables to store graphs and additional maps
-in a flexible and efficient way.
+The standard graph IO enables one to store graphs and additional maps
+(i.e. functions on the nodes or edges) in a flexible and efficient way.
+Before you read this page you should be familiar with LEMON
+\ref graphs "graphs" and \ref maps-page "maps".
\section format The general file format
@@ -17,14 +19,21 @@
\li edges
\li attributes
-The nodeset section starts with the following line:
+Some of these sections can be omitted, but you will basicly need the nodeset
+section (unless your graph has no nodes at all) and the edgeset section
+(unless your graph has no edges at all).
+
+The nodeset section describes the nodes of your graph: it identifies the nodes
+and gives the maps defined on them, if any. It starts with the
+following line:
\@nodeset
The next line contains the names of the nodemaps, separated by whitespaces. Each
following line describes a node in the graph: it contains the values of the
maps in the right order. The map named "id" should contain unique values
-because it is regarded as an ID-map. For example:
+because it is regarded as an ID-map. These ids need not be numbers but they
+must identify the nodes uniquely for later reference. For example:
\code
@nodeset
@@ -39,10 +48,12 @@
\@edgeset
-The next line contains the whitespace separated list of names of the maps.
-Each of the next lines describes one edge. The first two elements in the line
-are the IDs of the source and target (or tail and head) node of the edge as they occur in the ID node
-map. You can also have an optional ID map on the edges for later reference.
+The next line contains the whitespace separated list of names of the edge
+maps. Each of the next lines describes one edge. The first two elements in
+the line are the IDs of the source and target (or tail and head) nodes of the
+edge as they occur in the ID node map of the nodeset section. You can also
+have an optional ID map on the edges for later reference (which has to be
+unique in this case).
\code
@edgeset
@@ -52,13 +63,14 @@
3 12 g 3.4 g-edge
\endcode
-The next section contains labeled nodes (i.e. nodes having a special
+The \e nodes section contains labeled (distinguished) nodes
+(i.e. nodes having a special
label on them). The section starts with
\@nodes
Each of the next lines contains a label for a node in the graph
-and then the ID described in the nodeset section.
+and then the ID as described in the \e nodeset section.
\code
@nodes
@@ -66,12 +78,12 @@
target 12
\endcode
-The last section describes the labeled edges
+The last section describes the labeled (distinguished) edges
(i.e. edges having a special label on them). It starts with \c \@edges
and then each line contains the name of the edge and the ID.
\code
-@nodes
+@edges
observed c
\endcode
@@ -80,8 +92,8 @@
start with an \c # character.
The attributes section can handle some information about the graph. It
-contains in each line an key and the mapped value to key. The key should
-be a string without whitespace, the value can be from various type.
+contains key-value pairs in each line (a key and the mapped value to key). The
+key should be a string without whitespaces, the value can be of various types.
\code
@attributes
@@ -91,27 +103,28 @@
version 12
\endcode
-\code
-@end
-\endcode
-=======
-The file ends with the
-
\@end
line.
\section use Using graph input-output
-The graph input and output is based on reading and writing commands. The user
-adds reading and writing commands to the reader or writer class, then he
-calls the \c run() method that executes all the given commands.
+
+The easiest way of using graph input and output is using the versions of the
+ public \ref readGraph() and \ref writeGraph() functions; if you don't need
+ very sophisticated behaviour then you might be satisfied with
+ those. Otherwise go on reading this page.
+
+The graph input and output is based on reading and writing
+commands. The user gives reading and writing commands to the reader or
+writer class, then he calls the \c run() method that executes all the given
+commands.
\subsection write Writing a graph
The \c GraphWriter class provides the graph output. To write a graph
you should first give writing commands to the writer. You can declare
-write command as \c NodeMap or \c EdgeMap writing and labeled Node and
+writing command as \c NodeMap or \c EdgeMap writing and labeled Node and
Edge writing.
\code
@@ -119,9 +132,9 @@
\endcode
The \c writeNodeMap() function declares a \c NodeMap writing command in the
-\c GraphWriter. You should give a name of the map and the map
+\c GraphWriter. You should give a name to the map and the map
object as parameters. The NodeMap writing command with name "id" should write a
-unique map because it is regarded as ID map.
+unique map because it will be regarded as an ID map.
\see IdMap, DescriptorMap
@@ -174,7 +187,7 @@
\subsection reading Reading a graph
-The given file format may contain several maps and labeled nodes or edges.
+The file to be read may contain several maps and labeled nodes or edges.
If you read a graph you need not read all the maps and items just those
that you need. The interface of the \c GraphReader is very similar to
the GraphWriter but the reading method does not depend on the order of the
@@ -188,7 +201,7 @@
GraphReader reader(std::cin, graph);
\endcode
-The \c readNodeMap() function reads a map from the \c \@nodeset section.
+The \c readNodeMap() function reads a map from the \c nodeset section.
If there is a map that you do not want to read from the file and there are
whitespaces in the string represenation of the values then you should
call the \c skipNodeMap() template member function with proper parameters.
@@ -239,14 +252,17 @@
reader.run();
\endcode
+\anchor rwbackground
\section types Background of Reading and Writing
+
+
To read a map (on the nodes or edges)
the \c GraphReader should know how to read a Value from the given map.
By the default implementation the input operator reads a value from
the stream and the type of the readed value is the value type of the given map.
When the reader should skip a value in the stream, because you do not
want to store it in a map, the reader skips a character sequence without
-whitespace.
+whitespaces.
If you want to change the functionality of the reader, you can use
template parameters to specialize it. When you give a reading
@@ -264,7 +280,7 @@
\endcode
For example, the \c "strings" nodemap contains strings and you do not need
-the value of the string just the length. Then you can implement own Reader
+the value of the string just the length. Then you can implement an own Reader
struct.
\code
@@ -284,21 +300,22 @@
The global functionality of the reader class can be changed by giving a
special template parameter to the GraphReader class. By default, the
template parameter is \c DefaultReaderTraits. A reader traits class
-should provide an inner template class Reader for each type, and an
+should provide an inner template class Reader for each type, and a
DefaultReader for skipping a value.
-The specialization of writing should be very similar to that of reading.
+The specialization of writing is very similar to that of reading.
-\section undir Undir graphs
+\section undir Undirected graphs
-In the undir graph format there is an \c undiredgeset section instead of
-the \c edgeset section. The first line of the section describes the
-undirected egdes' names and all next lines describes one undirected edge
-with the the incident nodes and the values of the map.
+In a file describing an undirected graph (undir graph, for short) you find an
+\c undiredgeset section instead of the \c edgeset section. The first line of
+the section describes the names of the maps on the undirected egdes and all
+next lines describe one undirected edge with the the incident nodes and the
+values of the map.
-The format handles the directed edge maps as a syntactical sugar, if there
-is two map which names are the same with a \c '+' and a \c '-' prefix
-then it can be read as an directed map.
+The format handles directed edge maps as a syntactical sugar???, if there
+are two maps with names being the same with a \c '+' and a \c '-' prefix
+then this will be read as a directed map.
\code
@undiredgeset
@@ -308,9 +325,9 @@
21 12 8 3.4 0.0 0.0
\endcode
-The \c edges section changed to \c undiredges section. This section
+The \c edges section is changed to \c undiredges section. This section
describes labeled edges and undirected edges. The directed edge label
-should start with a \c '+' and a \c '-' prefix what decide the direction
+should start with a \c '+' or a \c '-' prefix to decide the direction
of the edge.
\code
@@ -337,12 +354,13 @@
\section advanced Advanced features
-The graph reader and writer classes gives an easy way to read and write
-graphs. But sometimes we want more advanced features. This way we can
-use the more general lemon reader and writer interface.
+The graph reader and writer classes give an easy way to read and write
+graphs. But sometimes we want more advanced features. In this case we can
+use the more general lemon reader and writer interface.
-The lemon format is an section oriented file format. It contains one or
-more section, each starts with a line with \c \@ first character.
+The LEMON file format is a section oriented file format. It contains one or
+more sections, each starting with a line identifying its type
+(the word starting with the \c \@ character).
The content of the section this way cannot contain line with \c \@ first
character. The file may contains comment lines with \c # first character.
@@ -351,7 +369,7 @@
classes which can be attached to a \c LemonReader or a \c LemonWriter.
There are default section readers and writers for reading and writing
-item sets, and labeled items in the graph. These reads and writes
+item sets, and labeled items in the graph. These read and write
the format described above. Other type of data can be handled with own
section reader and writer classes which are inherited from the
\c LemonReader::SectionReader or the \c LemonWriter::SectionWriter classes.
@@ -392,11 +410,11 @@
The other advanced stuff of the generalized file format is that
multiple edgesets can be stored to the same nodeset. It can be used
-by example as a network traffic matrix.
+for example as a network traffic matrix.
-In example there is a network with symmetric links and there are assymetric
+In our example there is a network with symmetric links and there are assymetric
traffic request on the network. This construction can be stored in an
-undirected graph and in an directed NewEdgeSetAdaptor class. The example
+undirected graph and in a directed NewEdgeSetAdaptor class. The example
shows the input with the LemonReader class:
\code
@@ -417,7 +435,7 @@
Because the GraphReader and the UndirGraphReader can be converted
to LemonReader and it can resolve the ID's of the items, the previous
-result can be achived with the UndirGraphReader class also.
+result can be achived with the UndirGraphReader class, too.
\code