This program gives an example of how to read and write a digraph and additional maps from/to a stream or a file using the LGF format.
The "digraph.lgf" file: 
@nodes
label
0
1
2
3
4
5
6
7
@arcs
                label capacity
0       1       0         16
0       2       1         12
0       3       2         20
1       2       3         10
1       4       4         10
1       5       5         13
2       3       6         10
2       4       7         8
2       6       8         8
5       3       9         20
3       6       10        25
4       7       11        15
5       7       12        15
6       7       13        18
@attributes
source 0
target 7
And the program which reads it and prints the digraph to the standard output: 
#include <iostream>
using namespace lemon;
int main() {
  SmartDigraph::ArcMap<int> cap(g);
  SmartDigraph::Node s, t;
  try {
    digraphReader(g, "digraph.lgf"). 
      arcMap("capacity", cap).       
      node("source", s).             
      node("target", t).             
      run();
    std::cerr << 
"Error: " << error.
what() << std::endl;
    return -1;
  }
  std::cout << "A digraph is read from 'digraph.lgf'." << std::endl;
  std::cout << 
"Number of nodes: " << 
countNodes(g) << std::endl;
  std::cout << 
"Number of arcs: " << 
countArcs(g) << std::endl;
  std::cout << "We can write it to the standard output:" << std::endl;
  digraphWriter(g).                
    arcMap("capacity", cap).       
    node("source", s).             
    node("target", t).             
    run();
  return 0;
}