Rev | Line | |
---|
[1528] | 1 | #include <iostream> |
---|
| 2 | #include <lemon/smart_graph.h> |
---|
| 3 | #include <lemon/invalid.h> |
---|
| 4 | #include <lemon/graph_reader.h> |
---|
| 5 | #include <lemon/graph_writer.h> |
---|
| 6 | |
---|
| 7 | |
---|
| 8 | using namespace lemon; |
---|
| 9 | |
---|
| 10 | int main() { |
---|
| 11 | SmartGraph graph; |
---|
| 12 | |
---|
| 13 | try { |
---|
| 14 | std::string filename="sample.lgf"; |
---|
| 15 | GraphReader<SmartGraph> reader(filename,graph); |
---|
| 16 | SmartGraph::EdgeMap<int> cap(graph); |
---|
| 17 | reader.readEdgeMap("capacity",cap); |
---|
| 18 | reader.run(); |
---|
| 19 | |
---|
| 20 | std::cout << "Hello! We have read a graph from file " << filename<< |
---|
| 21 | " and some maps on it: now we write this to the standard output!" << |
---|
| 22 | std::endl; |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | GraphWriter<SmartGraph> writer(std::cout, graph); |
---|
| 26 | writer.writeEdgeMap("multiplicity", cap); |
---|
| 27 | writer.run(); |
---|
| 28 | |
---|
| 29 | } catch (DataFormatError& error) { |
---|
| 30 | std::cerr << error.what() << std::endl; |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | return 0; |
---|
| 35 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.