- Main Page
- Modules
- Classes
- Namespaces
- Files
- Related Pages

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Classes | Files | Functions
LEMON Graph Format
Input-Output

## Detailed Description

This group contains methods for reading and writing LEMON Graph Format.

## Classes
class | DigraphReader< DGR >
| LGF reader for directed graphs More...
class | GraphReader< GR >
| LGF reader for undirected graphs More...
class | BpGraphReader< BGR >
| LGF reader for bipartite graphs More...
class | SectionReader
| Section reader class. More...
class | LgfContents
| Reader for the contents of the LGF file. More...
class | DigraphWriter< DGR >
| LGF writer for directed graphs More...
class | GraphWriter< GR >
| LGF writer for undirected graphs More...
class | BpGraphWriter< BGR >
| LGF writer for undirected bipartite graphs More...
class | SectionWriter
| Section writer class. More...

## Files
file | lgf_reader.h
| LEMON Graph Format reader.
file | lgf_writer.h
| LEMON Graph Format writer.

## Functions
template<typename TDGR >
DigraphReader< TDGR > | digraphReader (TDGR &digraph, std::istream &is)
| Return a DigraphReader class. More...
template<typename TGR >
GraphReader< TGR > | graphReader (TGR &graph, std::istream &is)
| Return a GraphReader class. More...
template<typename TBGR >
BpGraphReader< TBGR > | bpGraphReader (TBGR &graph, std::istream &is)
| Return a BpGraphReader class. More...
SectionReader | sectionReader (std::istream &is)
| Return a SectionReader class. More...
template<typename TDGR >
DigraphWriter< TDGR > | digraphWriter (const TDGR &digraph, std::ostream &os)
| Return a DigraphWriter class. More...
template<typename TGR >
GraphWriter< TGR > | graphWriter (const TGR &graph, std::ostream &os)
| Return a GraphWriter class. More...
template<typename TBGR >
BpGraphWriter< TBGR > | bpGraphWriter (const TBGR &graph, std::ostream &os)
| Return a BpGraphWriter class. More...
SectionWriter | sectionWriter (std::ostream &os)
| Return a SectionWriter class. More...

## Function Documentation

DigraphReader< TDGR > digraphReader | ( | TDGR & | digraph,
|  | std::istream & | is
| ) |  |
| related

This function just returns a DigraphReader class.

With this function a digraph can be read from an LGF file or input stream with several maps and attributes. For example, there is network flow problem on a digraph, i.e. a digraph with a capacity map on the arcs and source and target nodes. This digraph can be read with the following code:

* ListDigraph digraph;
* ListDigraph::ArcMap<int> cm(digraph);
* ListDigraph::Node src, trg;
* digraphReader(digraph, std::cin).
* arcMap("capacity", cap).
* node("source", src).
* node("target", trg).
* run();
*

For a complete documentation, please see the DigraphReader class documentation.

Warning
  Don't forget to put the run() to the end of the parameter list.

See Also
  digraphReader(TDGR& digraph, const std::string& fn)
  digraphReader(TDGR& digraph, const char* fn)

GraphReader< TGR > graphReader | ( | TGR & | graph,
|  | std::istream & | is
| ) |  |
| related

This function just returns a GraphReader class.

With this function a graph can be read from an LGF file or input stream with several maps and attributes. For example, there is weighted matching problem on a graph, i.e. a graph with a weight map on the edges. This graph can be read with the following code:

* ListGraph graph;
* ListGraph::EdgeMap<int> weight(graph);
* graphReader(graph, std::cin).
* edgeMap("weight", weight).
* run();
*

For a complete documentation, please see the GraphReader class documentation.

Warning
  Don't forget to put the run() to the end of the parameter list.

See Also
  graphReader(TGR& graph, const std::string& fn)
  graphReader(TGR& graph, const char* fn)

BpGraphReader< TBGR > bpGraphReader | ( | TBGR & | graph,
|  | std::istream & | is
| ) |  |
| related

This function just returns a BpGraphReader class.

With this function a graph can be read from an LGF file or input stream with several maps and attributes. For example, there is bipartite weighted matching problem on a graph, i.e. a graph with a weight map on the edges. This graph can be read with the following code:

* ListBpGraph graph;
* ListBpGraph::EdgeMap<int> weight(graph);
* bpGraphReader(graph, std::cin).
* edgeMap("weight", weight).
* run();
*

For a complete documentation, please see the BpGraphReader class documentation.

Warning
  Don't forget to put the run() to the end of the parameter list.

See Also
  bpGraphReader(TBGR& graph, const std::string& fn)
  bpGraphReader(TBGR& graph, const char* fn)

SectionReader sectionReader | ( | std::istream & | is | ) |
| related

This function just returns a SectionReader class.

Please see SectionReader documentation about the custom section input.

See Also
  sectionReader(const std::string& fn)
  sectionReader(const char *fn)

DigraphWriter< TDGR > digraphWriter | ( | const TDGR & | digraph,
|  | std::ostream & | os
| ) |  |
| related

This function just returns a DigraphWriter class.

With this function a digraph can be write to a file or output stream in LGF format with several maps and attributes. For example, with the following code a network flow problem can be written to the standard output, i.e. a digraph with a capacity map on the arcs and source and target nodes:

* ListDigraph digraph;
* ListDigraph::ArcMap<int> cap(digraph);
* ListDigraph::Node src, trg;
* // Setting the capacity map and source and target nodes
* digraphWriter(digraph, std::cout).
* arcMap("capacity", cap).
* node("source", src).
* node("target", trg).
* run();
*

For a complete documentation, please see the DigraphWriter class documentation.

Warning
  Don't forget to put the run() to the end of the parameter list.

See Also
  digraphWriter(const TDGR& digraph, const std::string& fn)
  digraphWriter(const TDGR& digraph, const char* fn)

GraphWriter< TGR > graphWriter | ( | const TGR & | graph,
|  | std::ostream & | os
| ) |  |
| related

This function just returns a GraphWriter class.

With this function a graph can be write to a file or output stream in LGF format with several maps and attributes. For example, with the following code a weighted matching problem can be written to the standard output, i.e. a graph with a weight map on the edges:

* ListGraph graph;
* ListGraph::EdgeMap<int> weight(graph);
* // Setting the weight map
* graphWriter(graph, std::cout).
* edgeMap("weight", weight).
* run();
*

For a complete documentation, please see the GraphWriter class documentation.

Warning
  Don't forget to put the run() to the end of the parameter list.

See Also
  graphWriter(const TGR& graph, const std::string& fn)
  graphWriter(const TGR& graph, const char* fn)

BpGraphWriter< TBGR > bpGraphWriter | ( | const TBGR & | graph,
|  | std::ostream & | os
| ) |  |
| related

This function just returns a BpGraphWriter class.

With this function a bipartite graph can be write to a file or output stream in LGF format with several maps and attributes. For example, with the following code a bipartite weighted matching problem can be written to the standard output, i.e. a graph with a weight map on the edges:

* ListBpGraph graph;
* ListBpGraph::EdgeMap<int> weight(graph);
* // Setting the weight map
* bpGraphWriter(graph, std::cout).
* edgeMap("weight", weight).
* run();
*

For a complete documentation, please see the BpGraphWriter class documentation.

Warning
  Don't forget to put the run() to the end of the parameter list.

See Also
  bpGraphWriter(const TBGR& graph, const std::string& fn)
  bpGraphWriter(const TBGR& graph, const char* fn)

SectionWriter sectionWriter | ( | std::ostream & | os | ) |
| related

This function just returns a SectionWriter class.

Please see SectionWriter documentation about the custom section output.

See Also
  sectionWriter(const std::string& fn)
  sectionWriter(const char *fn)