@uedgeset
uedgeset_name
, but the uedgeset_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 connected nodes' id and the mapped values for each map.
The section can handle the directed as a syntactical sugar. Two undirected edge map describes one directed edge map. This two maps are the forward map and the backward map and the names of this map is near the same just with a prefix '+'
or '-'
character difference.
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 uicted edge which is mapped to this value.
The undirected 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 > | |
UEdgeSetReader (LemonReader &_reader, Graph &_graph, const NodeLabelReader &_nodeLabelReader, const std::string &_name=std::string(), const DefaultSkipper &_skipper=DefaultSkipper()) | |
Constructor. | |
virtual | ~UEdgeSetReader () |
Destructor. | |
template<typename Map > | |
UEdgeSetReader & | readUEdgeMap (std::string label, Map &map) |
Add a new undirected edge map reader command for the reader. | |
template<typename ItemReader , typename Map > | |
UEdgeSetReader & | readUEdgeMap (std::string label, Map &map, const ItemReader &ir=ItemReader()) |
Add a new undirected edge map reader command for the reader. | |
template<typename ItemReader > | |
UEdgeSetReader & | skipUEdgeMap (std::string label, const ItemReader &ir=ItemReader()) |
template<typename Map > | |
UEdgeSetReader & | readEdgeMap (std::string label, Map &map) |
template<typename ItemReader , typename Map > | |
UEdgeSetReader & | readEdgeMap (std::string label, Map &map, const ItemReader &ir=ItemReader()) |
template<typename ItemReader > | |
UEdgeSetReader & | 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, UEdge &uedge) const |
Gives back the undirected edge by its label. | |
void | readLabel (std::istream &is, Edge &edge) const |
Gives back the directed 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. |
UEdgeSetReader | ( | LemonReader & | _reader, | |
Graph & | _graph, | |||
const NodeLabelReader & | _nodeLabelReader, | |||
const std::string & | _name = std::string() , |
|||
const DefaultSkipper & | _skipper = DefaultSkipper() | |||
) | [inline] |
Constructor for UEdgeSetReader. It creates the UEdgeSetReader and attach it into the given LemonReader. The undirected edgeset reader will add the read undirected 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 uedgset_name
are the same.
virtual ~UEdgeSetReader | ( | ) | [inline, virtual] |
Destructor for UEdgeSetReader.
UEdgeSetReader& readUEdgeMap | ( | std::string | label, | |
Map & | map | |||
) | [inline] |
Add a new edge undirected map reader command for the reader.
UEdgeSetReader& readUEdgeMap | ( | std::string | label, | |
Map & | map, | |||
const ItemReader & | ir = ItemReader() | |||
) | [inline] |
Add a new edge undirected map reader command for the reader.
UEdgeSetReader& skipUEdgeMap | ( | std::string | label, | |
const ItemReader & | ir = ItemReader() | |||
) | [inline] |
Add a new undirected edge map skipper command for the reader.
UEdgeSetReader& readEdgeMap | ( | std::string | label, | |
Map & | map | |||
) | [inline] |
Add a new directed edge map reader command for the reader.
UEdgeSetReader& readEdgeMap | ( | std::string | label, | |
Map & | map, | |||
const ItemReader & | ir = ItemReader() | |||
) | [inline] |
Add a new directed edge map reader command for the reader.
UEdgeSetReader& skipEdgeMap | ( | std::string | label, | |
const ItemReader & | ir = ItemReader() | |||
) | [inline] |
Add a new directed 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 @uedgeset
, and the header line's name and the edgeset's name are the same. The sections with @edgeset 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 undirected edge by its id. It is possible only if an "label" named map was read.
void readLabel | ( | std::istream & | is, | |
UEdge & | uedge | |||
) | const [inline] |
It reads an id from the stream and gives back which undirected edge belongs to it. It is possible only if there was read an "label" named map.
void readLabel | ( | std::istream & | is, | |
Edge & | edge | |||
) | const [inline] |
It reads an id from the stream and gives back which directed edge belongs to it. The directed edge id is the '+'
or '-'
character and the undirected edge id. It is possible only if there was read an "label" named map.