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 given file format 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 UndirGraphReader
is very similar to the UndirGraphWriter but the reading method does not depend on the order of the given commands.
The reader object suppose that each not readed value does 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);
The reading of the directed edge maps is just a syntactical sugar. It reads two undirected edgemaps into a directed edge map. The undirected edge maps' name should be start with the '+'
and the '-'
character and the same.
reader.readNode("source", sourceNode);
reader.readNode("target", targetNode);
reader.readUndirEdge("observed", undirEdge);
|
Public Member Functions |
| UndirGraphReader (std::istream &_is, Graph &_graph, const DefaultSkipper &_skipper=DefaultSkipper()) |
| Construct a new UndirGraphReader.
|
| UndirGraphReader (const std::string &_filename, Graph &_graph, const DefaultSkipper &_skipper=DefaultSkipper()) |
| Construct a new UndirGraphReader.
|
| UndirGraphReader (LemonReader &_reader, Graph &_graph, const DefaultSkipper &_skipper=DefaultSkipper()) |
| Construct a new UndirGraphReader.
|
| ~UndirGraphReader () |
| Destruct the graph reader.
|
template<typename Map> |
UndirGraphReader & | readNodeMap (std::string name, Map &map) |
| Give a new node map reading command to the reader.
|
template<typename Reader, typename Map> |
UndirGraphReader & | readNodeMap (std::string name, Map &map, const Reader &reader=Reader()) |
| Give a new node map reading command to the reader.
|
template<typename Reader> |
UndirGraphReader & | skipNodeMap (std::string name, const Reader &reader=Reader()) |
| Give a new node map skipping command to the reader.
|
template<typename Map> |
UndirGraphReader & | readUndirEdgeMap (std::string name, Map &map) |
| Give a new undirected edge map reading command to the reader.
|
template<typename Reader, typename Map> |
UndirGraphReader & | readUndirEdgeMap (std::string name, Map &map, const Reader &reader=Reader()) |
| Give a new undirected edge map reading command to the reader.
|
template<typename Reader> |
UndirGraphReader & | skipUndirEdgeMap (std::string name, const Reader &reader=Reader()) |
| Give a new undirected edge map skipping command to the reader.
|
template<typename Map> |
UndirGraphReader & | readEdgeMap (std::string name, Map &map) |
| Give a new edge map reading command to the reader.
|
template<typename Reader, typename Map> |
UndirGraphReader & | readEdgeMap (std::string name, Map &map, const Reader &reader=Reader()) |
| Give a new edge map reading command to the reader.
|
template<typename Reader> |
UndirGraphReader & | skipEdgeMap (std::string name, const Reader &reader=Reader()) |
| Give a new edge map skipping command to the reader.
|
UndirGraphReader & | readNode (std::string name, Node &node) |
| Give a new labeled node reading command to the reader.
|
UndirGraphReader & | readEdge (std::string name, Edge &edge) |
| Give a new labeled edge reading command to the reader.
|
UndirGraphReader & | readUndirEdge (std::string name, UndirEdge &edge) |
| Give a new labeled undirected edge reading command to the reader.
|
template<typename Value> |
UndirGraphReader & | readAttribute (std::string name, Value &value) |
| Give a new attribute reading command.
|
template<typename Reader, typename Value> |
UndirGraphReader & | 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.
|
UndirEdge | readId (std::istream &is, UndirEdge) const |
| Gives back the undirected edge by its id.
|