doc/graph_io.dox
changeset 2540 8ab1d3d7dea7
parent 2391 14a343be7a5a
child 2553 bfced05fa852
equal deleted inserted replaced
18:340ce80efffd 19:abf938e94eef
   333 should provide a nested template class Reader for each type, and a 
   333 should provide a nested template class Reader for each type, and a 
   334 DefaultReader for skipping a value.
   334 DefaultReader for skipping a value.
   335 
   335 
   336 The specialization of writing is very similar to that of reading.
   336 The specialization of writing is very similar to that of reading.
   337 
   337 
   338 \section u Undirected graphs
   338 \section undir Undirected and Bipartite graphs
   339 
   339 
   340 In a file describing an undirected graph (ugraph, for short) you find an
   340 In a file describing an undirected graph (ugraph, for short) you find an
   341 \c uedgeset section instead of the \c edgeset section. The first line of
   341 \c uedgeset section instead of the \c edgeset section. The first line of
   342 the section describes the names of the maps on the undirected egdes and all
   342 the section describes the names of the maps on the undirected egdes and all
   343 next lines describe one undirected edge with the the incident nodes and the
   343 next lines describe one undirected edge with the the incident nodes and the
   344 values of the map.
   344 values of the map.
   345 
   345 
   346 The format handles directed edge maps as a syntactical sugar???, if there
   346 The format could store directed edge maps, if there are two maps with 
   347 are two maps with names being the same with a \c '+' and a \c '-' prefix
   347 names being the same with a \c '+' and a \c '-' prefix then this could 
   348 then this will be read as a directed map.
   348 be read as such a map.
   349 
   349 
   350 \code
   350 \code
   351 @uedgeset
   351 @uedgeset
   352              label      capacity        +flow   -flow
   352              label      capacity        +flow   -flow
   353 32   2       1          4.3             2.0     0.0
   353 32   2       1          4.3             2.0     0.0
   382 reader.readUEdgeMap("capacity", capacityMap);
   382 reader.readUEdgeMap("capacity", capacityMap);
   383 reader.readEdgeMap("flow", flowMap);
   383 reader.readEdgeMap("flow", flowMap);
   384 ...
   384 ...
   385 reader.readUEdge("u_edge", u_edge);
   385 reader.readUEdge("u_edge", u_edge);
   386 reader.readEdge("edge", edge);
   386 reader.readEdge("edge", edge);
       
   387 \endcode
       
   388 
       
   389 The undirected bipartite graphs could be read with the \c BpUGraph
       
   390 class and it has specialized nodeset section, which should be start
       
   391 with \c "@bpnodeset". This section is separated to two
       
   392 subsections. The header line of these sections start with "&anodeset"
       
   393 or "&bnodeset" and after that the line contains the names of the
       
   394 regular and A-node or B-node maps accordingly. The lines of each
       
   395 section contains the mapped values. The labels of the graph should be
       
   396 unique overall both subsections.
       
   397 
       
   398 \code
       
   399 @bpnodeset
       
   400 &anodeset label   coords	radius
       
   401 	  0       (0, 0)	14.0
       
   402 	  1       (0, 1)	12.0
       
   403 &bnodeset label	  coords
       
   404 	  2       (1, 0)
       
   405 	  3       (1, 1)
       
   406 \endcode
       
   407 
       
   408 The reading can be done with \ref lemon::BpUGraphReader::readANodeMap() 
       
   409 "readANodeMap()", \ref lemon::BpUGraphReader::readBNodeMap() 
       
   410 "readBNodeMap()" or \ref lemon::BpUGraphReader::readNodeMap() 
       
   411 "readNodeMap()" members.
       
   412 
       
   413 \code
       
   414 reader.readNodeMap("coords", coords);
       
   415 reader.readAnodeMap("radius", radius);
   387 \endcode
   416 \endcode
   388 
   417 
   389 \section advanced Advanced features
   418 \section advanced Advanced features
   390 
   419 
   391 The graph reader and writer classes give an easy way to read and write
   420 The graph reader and writer classes give an easy way to read and write