@edgeset
edgeset_name
, but the edgeset_name
may be empty.The first line of the section contains the names of the maps separated with white spaces. Each next lines describes an edge in the edgeset. The line contains the source and the target nodes' id and the mapped values for each map.
If the edgeset contains an "label"
named map then it will be regarded as id map. This map should contain only unique values and when the readLabel()
member will read a value from the given stream it will give back that edge which is mapped to this value.
The edgeset reader needs a node id reader to identify which nodes have to be connected. If a NodeSetReader reads an "label" named map, it will be able to resolve the nodes by ids. #include <lemon/lemon_reader.h>
Public Member Functions | |
template<typename NodeLabelReader > | |
EdgeSetReader (LemonReader &_reader, Graph &_graph, const NodeLabelReader &_nodeLabelReader, const std::string &_name=std::string(), const DefaultSkipper &_skipper=DefaultSkipper()) | |
Constructor. | |
virtual | ~EdgeSetReader () |
Destructor. | |
template<typename Map > | |
EdgeSetReader & | readEdgeMap (std::string label, Map &map) |
template<typename ItemReader , typename Map > | |
EdgeSetReader & | readEdgeMap (std::string label, Map &map, const ItemReader &ir=ItemReader()) |
template<typename ItemReader > | |
EdgeSetReader & | skipEdgeMap (std::string label, const ItemReader &ir=ItemReader()) |
bool | isLabelReader () const |
Returns true if the edgeset can give back the edge by its label. | |
void | readLabel (std::istream &is, Edge &edge) const |
Gives back the edge by its label. | |
Protected Member Functions | |
virtual bool | header (const std::string &line) |
Gives back true when the SectionReader can process the section with the given header line. | |
virtual void | read (std::istream &is) |
Reader function of the section. |
EdgeSetReader | ( | LemonReader & | _reader, | |
Graph & | _graph, | |||
const NodeLabelReader & | _nodeLabelReader, | |||
const std::string & | _name = std::string() , |
|||
const DefaultSkipper & | _skipper = DefaultSkipper() | |||
) | [inline] |
Constructor for EdgeSetReader. It creates the EdgeSetReader and attach it into the given LemonReader. The edgeset reader will add the read edges to the given Graph. It will use the given node id reader to read the source and target nodes of the edges. The reader will read the section only if the _name
and the edgset_name
are the same.
virtual ~EdgeSetReader | ( | ) | [inline, virtual] |
Destructor for EdgeSetReader.
EdgeSetReader& readEdgeMap | ( | std::string | label, | |
Map & | map | |||
) | [inline] |
Add a new edge map reader command for the reader.
EdgeSetReader& readEdgeMap | ( | std::string | label, | |
Map & | map, | |||
const ItemReader & | ir = ItemReader() | |||
) | [inline] |
Add a new edge map reader command for the reader.
EdgeSetReader& skipEdgeMap | ( | std::string | label, | |
const ItemReader & | ir = ItemReader() | |||
) | [inline] |
Add a new edge map skipper command for the reader.
virtual bool header | ( | const std::string & | line | ) | [inline, protected, virtual] |
It gives back true when the header line starts with @edgeset
, and the header line's name and the edgeset's name are the same. The sections with @uedgeset head line could be read with this section reader too.
Implements SectionReader.
virtual void read | ( | std::istream & | is | ) | [inline, protected, virtual] |
It reads the content of the section.
Implements SectionReader.
bool isLabelReader | ( | ) | const [inline] |
Returns true if the edgeset can give back the edge by its label. It is possible only if an "label" named map was read.
void readLabel | ( | std::istream & | is, | |
Edge & | edge | |||
) | const [inline] |
It reads an id from the stream and gives back which edge belongs to it. It is possible only if there was read an "label" named map.