Changeset 1522:321661278137 in lemon-0.x for doc/graph_io.dox
- Timestamp:
- 06/28/05 19:46:35 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2008
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/graph_io.dox
r1394 r1522 5 5 \page graph-io-page Graph Input-Output 6 6 7 The standard graph IO makes possibleto store graphs and additional maps7 The standard graph IO enables to store graphs and additional maps 8 8 in a flexible and efficient way. 9 9 10 10 \section format The general file format 11 11 12 The graph file contains at most four section in the nextorder:12 The file contains at most four sections in the following order: 13 13 14 14 \li nodeset … … 17 17 \li edges 18 18 19 The nodeset section starts with the \c \@nodeset line. 20 The next line contains the names of the maps separated by whitespaces. 21 Each following line describes a node in the graph, it contains 22 in the right order the values of the maps. The map named "id" should contain 23 unique values because it regarded as ID-map. 19 The nodeset section starts with the following line: 20 21 <tt>\@nodeset</tt> 22 23 The next line contains the names of the nodemaps, separated by whitespaces. Each 24 following line describes a node in the graph: it contains the values of the 25 maps in the right order. The map named "id" should contain unique values 26 because it is regarded as an ID-map. For example: 24 27 25 28 \code … … 32 35 33 36 The edgeset section is very similar to the nodeset section, it has 34 same coloumn oriented structure. It starts with the line \c \@edgeset 35 The next line contains the whitespace separated list of names of the map. 37 the same coloumn oriented structure. It starts with the line 38 39 <tt>\@edgeset</tt> 40 41 The next line contains the whitespace separated list of names of the maps. 36 42 Each of the next lines describes one edge. The first two elements in the line 37 are the ID of the source and target node as they occur in the ID node map. 43 are the IDs of the source and target (or tail and head) node of the edge as they occur in the ID node 44 map. You can also have an optional ID map on the edges for later reference. 38 45 39 46 \code … … 47 54 The next section contains <em>labeled nodes</em> (i.e. nodes having a special 48 55 label on them). The section starts with 49 \c \@nodes. Each of the next lines contains a label for a node in the graph 50 and then the ID described in the nodeset. 56 57 <tt> \@nodes </tt> 58 59 Each of the next lines contains a label for a node in the graph 60 and then the ID described in the nodeset section. 51 61 52 62 \code … … 65 75 \endcode 66 76 67 The file ends with the \c \@end line.68 77 69 78 The file may contain empty lines and comment lines. The comment lines 70 79 start with an \c # character. 71 80 72 \code 73 @end 74 \endcode 81 The file ends with the 82 83 <tt> \@end </tt> 84 85 line. 86 75 87 76 88 \section use Using graph input-output 77 The graph input and output based on writing and readingcommands. The user78 adds writing and reading commands for the reader or writer class, then89 The graph input and output is based on reading and writing commands. The user 90 adds reading and writing commands to the reader or writer class, then he 79 91 calls the \c run() method that executes all the given commands. 80 92 … … 91 103 92 104 The \c writeNodeMap() function declares a \c NodeMap writing command in the 93 \c GraphWriter. You should give a s parameter thename of the map and the map94 object . The NodeMap writing command with name "id" should write a105 \c GraphWriter. You should give a name of the map and the map 106 object as parameters. The NodeMap writing command with name "id" should write a 95 107 unique map because it is regarded as ID map. 96 108 … … 110 122 111 123 \see IdMap, DescriptorMap 124 112 125 \code 113 126 DescriptorMap<ListGraph, Edge, ListGraph::EdgeMap<int> > edgeDescMap(graph); … … 118 131 \endcode 119 132 120 With \c writeNode() and \c writeEdge() functions you can point outNodes and121 Edges in the graph. By example, you can write out the source and target122 of the graph.133 With \c writeNode() and \c writeEdge() functions you can designate Nodes and 134 Edges in the graph. For example, you can write out the source and target node 135 of a maximum flow instance. 123 136 124 137 \code … … 130 143 131 144 After you give all write commands you must call the \c run() member 132 function, which execute all the writercommands.145 function, which executes all the writing commands. 133 146 134 147 \code … … 141 154 If you read a graph you need not read all the maps and items just those 142 155 that you need. The interface of the \c GraphReader is very similar to 143 the GraphWriter but the reading method does not depend on the order the156 the GraphWriter but the reading method does not depend on the order of the 144 157 given commands. 145 158 146 The reader object supposethat each not readed value does not contain159 The reader object assumes that each not readed value does not contain 147 160 whitespaces, therefore it has some extra possibilities to control how 148 161 it should skip the values when the string representation contains spaces. … … 153 166 154 167 The \c readNodeMap() function reads a map from the \c \@nodeset section. 155 If there is a map that you do not want to read from the file and there is156 whitespace in the string represenation of the values then you should168 If there is a map that you do not want to read from the file and there are 169 whitespaces in the string represenation of the values then you should 157 170 call the \c skipNodeMap() template member function with proper parameters. 158 171 159 172 \see QuotedStringReader 173 160 174 \code 161 175 reader.readNodeMap("x-coord", xCoordMap); … … 187 201 188 202 After you give all read commands you must call the \c run() member 189 function, which execute all the commands.203 function, which executes all the commands. 190 204 191 205 \code … … 193 207 \endcode 194 208 195 \section types The background of theReading and Writing196 The \c GraphReader should know how canread a Value from the given map.209 \section types The background of Reading and Writing 210 The \c GraphReader should know how to read a Value from the given map. 197 211 By the default implementation the input operator reads a value from 198 212 the stream and the type of the readed value is the value type of the given map.
Note: See TracChangeset
for help on using the changeset viewer.