If you don't need very sophisticated behaviour then you can use the versions of the public function readGraph() to read a graph (or a max flow instance etc).
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 GraphReader
is very similar to the GraphWriter but the reading method does not depend on the order the given commands (i.e. you don't have to insist on the order in which the maps are given in the file).
The reader object assumes that not readed values do not contain whitespaces, therefore it has some extra possibilities to control how it should skip the values when the string representation contains spaces.
reader.readNodeMap("coords", coords);
reader.readNodeMap<QuotedStringReader>("label", labelMap);
reader.skipNodeMap<QuotedStringReader>("description");
reader.readNodeMap("color", colorMap);
reader.readNode("source", sourceNode);
reader.readNode("target", targetNode);
reader.readEdge("observed", edge);
|
Public Member Functions |
| GraphReader (std::istream &_is, typename SmartParameter< Graph >::Type _graph, const DefaultSkipper &_skipper=DefaultSkipper()) |
| Construct a new GraphReader.
|
| GraphReader (const std::string &_filename, typename SmartParameter< Graph >::Type _graph, const DefaultSkipper &_skipper=DefaultSkipper()) |
| Construct a new GraphReader.
|
| GraphReader (LemonReader &_reader, typename SmartParameter< Graph >::Type _graph, const DefaultSkipper &_skipper=DefaultSkipper()) |
| Construct a new GraphReader.
|
| ~GraphReader () |
| Destruct the graph reader.
|
template<typename Map> |
GraphReader & | readNodeMap (std::string name, Map &map) |
| Give a new node map reading command to the reader.
|
template<typename Reader, typename Map> |
GraphReader & | readNodeMap (std::string name, Map &map, const Reader &reader=Reader()) |
| Give a new node map reading command to the reader.
|
template<typename Reader> |
GraphReader & | skipNodeMap (std::string name, const Reader &reader=Reader()) |
| Give a new node map skipping command to the reader.
|
template<typename Map> |
GraphReader & | readEdgeMap (std::string name, Map &map) |
| Give a new edge map reading command to the reader.
|
template<typename Reader, typename Map> |
GraphReader & | readEdgeMap (std::string name, Map &map, const Reader &reader=Reader()) |
| Give a new edge map reading command to the reader.
|
template<typename Reader> |
GraphReader & | skipEdgeMap (std::string name, const Reader &reader=Reader()) |
| Give a new edge map skipping command to the reader.
|
GraphReader & | readNode (std::string name, Node &node) |
| Give a new labeled node reading command to the reader.
|
GraphReader & | readEdge (std::string name, Edge &edge) |
| Give a new labeled edge reading command to the reader.
|
template<typename Value> |
GraphReader & | readAttribute (std::string name, Value &value) |
| Give a new attribute reading command.
|
template<typename Reader, typename Value> |
GraphReader & | readAttribute (std::string name, Value &value, const Reader &reader) |
| Give a new attribute reading command.
|
| operator LemonReader & () |
| Conversion operator to LemonReader.
|
void | run () |
| Executes the reading commands.
|
Node | readId (std::istream &is, Node) const |
| Gives back the node by its id.
|
Edge | readId (std::istream &is, Edge) const |
| Gives back the edge by its id.
|