Loading...
Searching...
No Matches
BpGraphReader< BGR > Class Template Reference
Input-Output » LEMON Graph Format

## Detailed Description

template<typename BGR>
class lemon::BpGraphReader< BGR >

This utility reads an LGF file.

It can be used almost the same way as `GraphReader`, but it reads the red and blue nodes from separate sections, and these sections can contain different set of maps.

The red and blue node maps are read from the corresponding sections. If a map is defined with the same name in both of these sections, then it can be read as a node map.

`#include <lemon/lgf_reader.h>`

## Public Member Functions

| BpGraphReader (BGR &graph, std::istream &is=std::cin)
| Constructor.
| BpGraphReader (BGR &graph, const std::string &fn)
| Constructor.
| BpGraphReader (BGR &graph, const char *fn)
| Constructor.
| ~BpGraphReader ()
| Destructor.
Reading Rules
template<typename Map>
BpGraphReader & | nodeMap (const std::string &caption, Map &map)
| Node map reading rule.
template<typename Map, typename Converter>
BpGraphReader & | nodeMap (const std::string &caption, Map &map, const Converter &converter=Converter())
| Node map reading rule.
template<typename Map>
BpGraphReader & | redNodeMap (const std::string &caption, Map &map)
| Add a red node map reading rule to the reader.
template<typename Map, typename Converter>
BpGraphReader & | redNodeMap (const std::string &caption, Map &map, const Converter &converter=Converter())
| Red node map reading rule.
template<typename Map>
BpGraphReader & | blueNodeMap (const std::string &caption, Map &map)
| Add a blue node map reading rule to the reader.
template<typename Map, typename Converter>
BpGraphReader & | blueNodeMap (const std::string &caption, Map &map, const Converter &converter=Converter())
| Blue node map reading rule.
template<typename Map>
BpGraphReader & | edgeMap (const std::string &caption, Map &map)
| Edge map reading rule.
template<typename Map, typename Converter>
BpGraphReader & | edgeMap (const std::string &caption, Map &map, const Converter &converter=Converter())
| Edge map reading rule.
template<typename Map>
BpGraphReader & | arcMap (const std::string &caption, Map &map)
| Arc map reading rule.
template<typename Map, typename Converter>
BpGraphReader & | arcMap (const std::string &caption, Map &map, const Converter &converter=Converter())
| Arc map reading rule.
template<typename Value>
BpGraphReader & | attribute (const std::string &caption, Value &value)
| Attribute reading rule.
template<typename Value, typename Converter>
BpGraphReader & | attribute (const std::string &caption, Value &value, const Converter &converter=Converter())
| Attribute reading rule.
BpGraphReader & | node (const std::string &caption, Node &node)
| Node reading rule.
BpGraphReader & | redNode (const std::string &caption, RedNode &node)
| Red node reading rule.
BpGraphReader & | blueNode (const std::string &caption, BlueNode &node)
| Blue node reading rule.
BpGraphReader & | edge (const std::string &caption, Edge &edge)
| Edge reading rule.
BpGraphReader & | arc (const std::string &caption, Arc &arc)
| Arc reading rule.
Select Section by Name
BpGraphReader & | nodes (const std::string &caption)
| Set `@nodes` section to be read.
BpGraphReader & | edges (const std::string &caption)
| Set `@edges` section to be read.
BpGraphReader & | attributes (const std::string &caption)
| Set `@attributes` section to be read.
Using Previously Constructed Node or Edge Set
template<typename Map>
BpGraphReader & | useNodes (const Map &map)
| Use previously constructed node set.
template<typename Map, typename Converter>
BpGraphReader & | useNodes (const Map &map, const Converter &converter=Converter())
| Use previously constructed node set.
template<typename Map>
BpGraphReader & | useEdges (const Map &map)
| Use previously constructed edge set.
template<typename Map, typename Converter>
BpGraphReader & | useEdges (const Map &map, const Converter &converter=Converter())
| Use previously constructed edge set.
BpGraphReader & | skipNodes ()
| Skip the reading of node section.
BpGraphReader & | skipEdges ()
| Skip the reading of edge section.
Execution of the Reader
void | run ()
| Start the batch processing.

## Related Symbols

(Note that these are not member symbols.)
template<typename TBGR>
BpGraphReader< TBGR > | bpGraphReader (TBGR &graph, std::istream &is)
| Return a BpGraphReader class.
template<typename TBGR>
BpGraphReader< TBGR > | bpGraphReader (TBGR &graph, const std::string &fn)
| Return a BpGraphReader class.
template<typename TBGR>
BpGraphReader< TBGR > | bpGraphReader (TBGR &graph, const char *fn)
| Return a BpGraphReader class.

## Constructor & Destructor Documentation

## BpGraphReader() [1/3]

template<typename BGR>

BpGraphReader | ( | BGR & | graph,
|  | std::istream & | is = std::cin )

inline

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

## BpGraphReader() [2/3]

template<typename BGR>

BpGraphReader | ( | BGR & | graph,
|  | const std::string & | fn )

inline

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

## BpGraphReader() [3/3]

template<typename BGR>

BpGraphReader | ( | BGR & | graph,
|  | const char * | fn )

inline

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

## Member Function Documentation

## nodeMap() [1/2]

template<typename BGR>
template<typename Map>

BpGraphReader & nodeMap | ( | const std::string & | caption,
|  | Map & | map )

inline

Add a node map reading rule to the reader.

## nodeMap() [2/2]

template<typename BGR>
template<typename Map, typename Converter>

BpGraphReader & nodeMap | ( | const std::string & | caption,
|  | Map & | map,
|  | const Converter & | converter = Converter() )

inline

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

## redNodeMap()

template<typename BGR>
template<typename Map, typename Converter>

BpGraphReader & redNodeMap | ( | const std::string & | caption,
|  | Map & | map,
|  | const Converter & | converter = Converter() )

inline

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

## blueNodeMap()

template<typename BGR>
template<typename Map, typename Converter>

BpGraphReader & blueNodeMap | ( | const std::string & | caption,
|  | Map & | map,
|  | const Converter & | converter = Converter() )

inline

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

## edgeMap() [1/2]

template<typename BGR>
template<typename Map>

BpGraphReader & edgeMap | ( | const std::string & | caption,
|  | Map & | map )

inline

Add an edge map reading rule to the reader.

## edgeMap() [2/2]

template<typename BGR>
template<typename Map, typename Converter>

BpGraphReader & edgeMap | ( | const std::string & | caption,
|  | Map & | map,
|  | const Converter & | converter = Converter() )

inline

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

## arcMap() [1/2]

template<typename BGR>
template<typename Map>

BpGraphReader & arcMap | ( | const std::string & | caption,
|  | Map & | map )

inline

Add an arc map reading rule to the reader.

## arcMap() [2/2]

template<typename BGR>
template<typename Map, typename Converter>

BpGraphReader & arcMap | ( | const std::string & | caption,
|  | Map & | map,
|  | const Converter & | converter = Converter() )

inline

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

## attribute() [1/2]

template<typename BGR>
template<typename Value>

BpGraphReader & attribute | ( | const std::string & | caption,
|  | Value & | value )

inline

Add an attribute reading rule to the reader.

## attribute() [2/2]

template<typename BGR>
template<typename Value, typename Converter>

BpGraphReader & attribute | ( | const std::string & | caption,
|  | Value & | value,
|  | const Converter & | converter = Converter() )

inline

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

## node()

template<typename BGR>

BpGraphReader & node | ( | const std::string & | caption,
|  | Node & | node )

inline

Add a node reading rule to reader.

## redNode()

template<typename BGR>

BpGraphReader & redNode | ( | const std::string & | caption,
|  | RedNode & | node )

inline

Add a red node reading rule to reader.

## blueNode()

template<typename BGR>

BpGraphReader & blueNode | ( | const std::string & | caption,
|  | BlueNode & | node )

inline

Add a blue node reading rule to reader.

## edge()

template<typename BGR>

BpGraphReader & edge | ( | const std::string & | caption,
|  | Edge & | edge )

inline

Add an edge reading rule to reader.

## arc()

template<typename BGR>

BpGraphReader & arc | ( | const std::string & | caption,
|  | Arc & | arc )

inline

Add an arc reading rule to reader.

## nodes()

template<typename BGR>

BpGraphReader & nodes | ( | const std::string & | caption | ) |

inline

Set `@nodes` section to be read.

## edges()

template<typename BGR>

BpGraphReader & edges | ( | const std::string & | caption | ) |

inline

Set `@edges` section to be read.

## attributes()

template<typename BGR>

BpGraphReader & attributes | ( | const std::string & | caption | ) |

inline

Set `@attributes` section to be read.

## useNodes() [1/2]

template<typename BGR>
template<typename Map>

BpGraphReader & useNodes | ( | const Map & | map | ) |

inline

Use previously constructed node set, and specify the node label map.

## useNodes() [2/2]

template<typename BGR>
template<typename Map, typename Converter>

BpGraphReader & useNodes | ( | const Map & | map,
|  | const Converter & | converter = Converter() )

inline

Use previously constructed node set, and specify the node label map and a functor which converts the label map values to `std::string`.

## useEdges() [1/2]

template<typename BGR>
template<typename Map>

BpGraphReader & useEdges | ( | const Map & | map | ) |

inline

Use previously constructed edge set, and specify the edge label map.

## useEdges() [2/2]

template<typename BGR>
template<typename Map, typename Converter>

BpGraphReader & useEdges | ( | const Map & | map,
|  | const Converter & | converter = Converter() )

inline

Use previously constructed edge set, and specify the edge label map and a functor which converts the label map values to `std::string`.

## skipNodes()

template<typename BGR>

BpGraphReader & skipNodes | ( |  | ) |

inline

Omit the reading of the node section. This implies that each node map reading rule will be abandoned, and the nodes of the graph will not be constructed, which usually cause that the edge set could not be read due to lack of node name could not be read due to lack of node name resolving. Therefore `skipEdges()` function should also be used, or `useNodes()` should be used to specify the label of the nodes.

## skipEdges()

template<typename BGR>

BpGraphReader & skipEdges | ( |  | ) |

inline

Omit the reading of the edge section. This implies that each edge map reading rule will be abandoned, and the edges of the graph will not be constructed.

## run()

template<typename BGR>

void run | ( |  | ) |

inline

This function starts the batch processing

## Friends And Related Symbol Documentation

## bpGraphReader() [1/2]

template<typename TBGR>

BpGraphReader< TBGR > bpGraphReader | ( | TBGR & | graph,
|  | const std::string & | fn )

related

This function just returns a BpGraphReader class.

See also
  bpGraphReader(TBGR& graph, std::istream& is)

## bpGraphReader() [2/2]

template<typename TBGR>

BpGraphReader< TBGR > bpGraphReader | ( | TBGR & | graph,
|  | const char * | fn )

related

This function just returns a BpGraphReader class.

See also
  bpGraphReader(TBGR& graph, std::istream& is)