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

## Detailed Description

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

This utility writes an LGF file.

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

The arc maps are written into the file as two columns, the caption of the columns are the name of the map prefixed with `'+'` and `'-'`. The arcs are written into the `@attributes` section as a `'+'` or a `'-'` prefix (depends on the direction of the arc) and the label of corresponding edge.

`#include <lemon/lgf_writer.h>`

## Public Member Functions

| GraphWriter (const GR &graph, std::ostream &os=std::cout)
| Constructor.
| GraphWriter (const GR &graph, const std::string &fn)
| Constructor.
| GraphWriter (const GR &graph, const char *fn)
| Constructor.
| ~GraphWriter ()
| Destructor.
Writing Rules
template<typename Map>
GraphWriter & | nodeMap (const std::string &caption, const Map &map)
| Node map writing rule.
template<typename Map, typename Converter>
GraphWriter & | nodeMap (const std::string &caption, const Map &map, const Converter &converter=Converter())
| Node map writing rule.
template<typename Map>
GraphWriter & | edgeMap (const std::string &caption, const Map &map)
| Edge map writing rule.
template<typename Map, typename Converter>
GraphWriter & | edgeMap (const std::string &caption, const Map &map, const Converter &converter=Converter())
| Edge map writing rule.
template<typename Map>
GraphWriter & | arcMap (const std::string &caption, const Map &map)
| Arc map writing rule.
template<typename Map, typename Converter>
GraphWriter & | arcMap (const std::string &caption, const Map &map, const Converter &converter=Converter())
| Arc map writing rule.
template<typename Value>
GraphWriter & | attribute (const std::string &caption, const Value &value)
| Attribute writing rule.
template<typename Value, typename Converter>
GraphWriter & | attribute (const std::string &caption, const Value &value, const Converter &converter=Converter())
| Attribute writing rule.
GraphWriter & | node (const std::string &caption, const Node &node)
| Node writing rule.
GraphWriter & | edge (const std::string &caption, const Edge &edge)
| Edge writing rule.
GraphWriter & | arc (const std::string &caption, const Arc &arc)
| Arc writing rule.
Section Captions
GraphWriter & | nodes (const std::string &caption)
| Add an additional caption to the `@nodes` section.
GraphWriter & | edges (const std::string &caption)
| Add an additional caption to the `@edges` section.
GraphWriter & | attributes (const std::string &caption)
| Add an additional caption to the `@attributes` section.
Skipping Section
GraphWriter & | skipNodes ()
| Skip writing the node set.
GraphWriter & | skipEdges ()
| Skip writing edge set.
Execution of the Writer
void | run ()
| Start the batch processing.
std::ostream & | ostream ()
| Give back the stream of the writer.

## Related Symbols

(Note that these are not member symbols.)
template<typename TGR>
GraphWriter< TGR > | graphWriter (const TGR &graph, std::ostream &os)
| Return a GraphWriter class.
template<typename TGR>
GraphWriter< TGR > | graphWriter (const TGR &graph, const std::string &fn)
| Return a GraphWriter class.
template<typename TGR>
GraphWriter< TGR > | graphWriter (const TGR &graph, const char *fn)
| Return a GraphWriter class.

## Constructor & Destructor Documentation

## GraphWriter() [1/3]

template<typename GR>

GraphWriter | ( | const GR & | graph,
|  | std::ostream & | os = std::cout )

inline

Construct an undirected graph writer, which writes to the given output stream.

## GraphWriter() [2/3]

template<typename GR>

GraphWriter | ( | const GR & | graph,
|  | const std::string & | fn )

inline

Construct a undirected graph writer, which writes to the given output file.

## GraphWriter() [3/3]

template<typename GR>

GraphWriter | ( | const GR & | graph,
|  | const char * | fn )

inline

Construct a undirected graph writer, which writes to the given output file.

## Member Function Documentation

## nodeMap() [1/2]

template<typename GR>
template<typename Map>

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

inline

Add a node map writing rule to the writer.

## nodeMap() [2/2]

template<typename GR>
template<typename Map, typename Converter>

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

inline

Add a node map writing rule with specialized converter to the writer.

## edgeMap() [1/2]

template<typename GR>
template<typename Map>

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

inline

Add an edge map writing rule to the writer.

## edgeMap() [2/2]

template<typename GR>
template<typename Map, typename Converter>

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

inline

Add an edge map writing rule with specialized converter to the writer.

## arcMap() [1/2]

template<typename GR>
template<typename Map>

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

inline

Add an arc map writing rule to the writer.

## arcMap() [2/2]

template<typename GR>
template<typename Map, typename Converter>

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

inline

Add an arc map writing rule with specialized converter to the writer.

## attribute() [1/2]

template<typename GR>
template<typename Value>

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

inline

Add an attribute writing rule to the writer.

## attribute() [2/2]

template<typename GR>
template<typename Value, typename Converter>

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

inline

Add an attribute writing rule with specialized converter to the writer.

## node()

template<typename GR>

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

inline

Add a node writing rule to the writer.

## edge()

template<typename GR>

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

inline

Add an edge writing rule to writer.

## arc()

template<typename GR>

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

inline

Add an arc writing rule to writer.

## nodes()

template<typename GR>

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

inline

Add an additional caption to the `@nodes` section.

## edges()

template<typename GR>

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

inline

Add an additional caption to the `@edges` section.

## attributes()

template<typename GR>

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

inline

Add an additional caption to the `@attributes` section.

## skipNodes()

template<typename GR>

GraphWriter & skipNodes | ( |  | ) |

inline

The `@nodes` section will not be written to the stream.

## skipEdges()

template<typename GR>

GraphWriter & skipEdges | ( |  | ) |

inline

The `@edges` section will not be written to the stream.

## run()

template<typename GR>

void run | ( |  | ) |

inline

This function starts the batch processing.

## ostream()

template<typename GR>

std::ostream & ostream | ( |  | ) |

inline

Give back the stream of the writer

## Friends And Related Symbol Documentation

## graphWriter() [1/2]

template<typename TGR>

GraphWriter< TGR > graphWriter | ( | const TGR & | graph,
|  | const std::string & | fn )

related

This function just returns a GraphWriter class.

See also
  graphWriter(const TGR& graph, std::ostream& os)

## graphWriter() [2/2]

template<typename TGR>

GraphWriter< TGR > graphWriter | ( | const TGR & | graph,
|  | const char * | fn )

related

This function just returns a GraphWriter class.

See also
  graphWriter(const TGR& graph, std::ostream& os)