List of all members | Public Member Functions | Related Functions
GraphReader< GR > Class Template Reference

Detailed Description

template<typename GR>
class lemon::GraphReader< GR >

This utility reads an LGF file.

It can be used almost the same way as DigraphReader. The only difference is that this class can handle edges and edge maps as well as arcs and arc maps.

The columns in the @edges (or @arcs) section are the edge maps. However, if there are two maps with the same name prefixed with '+' and '-', then these can be read into an arc map. Similarly, an attribute can be read into an arc, if it's value is an edge label prefixed with '+' or '-'.

#include <lemon/lgf_reader.h>

Public Member Functions

 GraphReader (GR &graph, std::istream &is=std::cin)
 Constructor. More...
 
 GraphReader (GR &graph, const std::string &fn)
 Constructor. More...
 
 GraphReader (GR &graph, const char *fn)
 Constructor. More...
 
 ~GraphReader ()
 Destructor.
 
Reading Rules
template<typename Map >
GraphReadernodeMap (const std::string &caption, Map &map)
 Node map reading rule. More...
 
template<typename Map , typename Converter >
GraphReadernodeMap (const std::string &caption, Map &map, const Converter &converter=Converter())
 Node map reading rule. More...
 
template<typename Map >
GraphReaderedgeMap (const std::string &caption, Map &map)
 Edge map reading rule. More...
 
template<typename Map , typename Converter >
GraphReaderedgeMap (const std::string &caption, Map &map, const Converter &converter=Converter())
 Edge map reading rule. More...
 
template<typename Map >
GraphReaderarcMap (const std::string &caption, Map &map)
 Arc map reading rule. More...
 
template<typename Map , typename Converter >
GraphReaderarcMap (const std::string &caption, Map &map, const Converter &converter=Converter())
 Arc map reading rule. More...
 
template<typename Value >
GraphReaderattribute (const std::string &caption, Value &value)
 Attribute reading rule. More...
 
template<typename Value , typename Converter >
GraphReaderattribute (const std::string &caption, Value &value, const Converter &converter=Converter())
 Attribute reading rule. More...
 
GraphReadernode (const std::string &caption, Node &node)
 Node reading rule. More...
 
GraphReaderedge (const std::string &caption, Edge &edge)
 Edge reading rule. More...
 
GraphReaderarc (const std::string &caption, Arc &arc)
 Arc reading rule. More...
 
Select Section by Name
GraphReadernodes (const std::string &caption)
 Set @nodes section to be read. More...
 
GraphReaderedges (const std::string &caption)
 Set @edges section to be read. More...
 
GraphReaderattributes (const std::string &caption)
 Set @attributes section to be read. More...
 
Using Previously Constructed Node or Edge Set
template<typename Map >
GraphReaderuseNodes (const Map &map)
 Use previously constructed node set. More...
 
template<typename Map , typename Converter >
GraphReaderuseNodes (const Map &map, const Converter &converter=Converter())
 Use previously constructed node set. More...
 
template<typename Map >
GraphReaderuseEdges (const Map &map)
 Use previously constructed edge set. More...
 
template<typename Map , typename Converter >
GraphReaderuseEdges (const Map &map, const Converter &converter=Converter())
 Use previously constructed edge set. More...
 
GraphReaderskipNodes ()
 Skip the reading of node section. More...
 
GraphReaderskipEdges ()
 Skip the reading of edge section. More...
 
Execution of the Reader
void run ()
 Start the batch processing. More...
 

Related Functions

(Note that these are not member functions.)

template<typename TGR >
GraphReader< TGR > graphReader (TGR &graph, std::istream &is)
 Return a GraphReader class. More...
 
template<typename TGR >
GraphReader< TGR > graphReader (TGR &graph, const std::string &fn)
 Return a GraphReader class. More...
 
template<typename TGR >
GraphReader< TGR > graphReader (TGR &graph, const char *fn)
 Return a GraphReader class. More...
 

Constructor & Destructor Documentation

GraphReader ( GR &  graph,
std::istream &  is = std::cin 
)
inline

Construct an undirected graph reader, which reads from the given input stream.

GraphReader ( GR &  graph,
const std::string &  fn 
)
inline

Construct an undirected graph reader, which reads from the given file.

GraphReader ( GR &  graph,
const char *  fn 
)
inline

Construct an undirected graph reader, which reads from the given file.

Member Function Documentation

GraphReader& nodeMap ( const std::string &  caption,
Map &  map 
)
inline

Add a node map reading rule to the reader.

GraphReader& nodeMap ( const std::string &  caption,
Map &  map,
const Converter &  converter = Converter() 
)
inline

Add a node map reading rule with specialized converter to the reader.

GraphReader& edgeMap ( const std::string &  caption,
Map &  map 
)
inline

Add an edge map reading rule to the reader.

GraphReader& edgeMap ( const std::string &  caption,
Map &  map,
const Converter &  converter = Converter() 
)
inline

Add an edge map reading rule with specialized converter to the reader.

GraphReader& arcMap ( const std::string &  caption,
Map &  map 
)
inline

Add an arc map reading rule to the reader.

GraphReader& arcMap ( const std::string &  caption,
Map &  map,
const Converter &  converter = Converter() 
)
inline

Add an arc map reading rule with specialized converter to the reader.

GraphReader& attribute ( const std::string &  caption,
Value &  value 
)
inline

Add an attribute reading rule to the reader.

GraphReader& attribute ( const std::string &  caption,
Value &  value,
const Converter &  converter = Converter() 
)
inline

Add an attribute reading rule with specialized converter to the reader.

GraphReader& node ( const std::string &  caption,
Node &  node 
)