| Line | |
|---|
| 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.writeNode("source", s); |
|---|
| 28 | // writer.writeNode("target", t); |
|---|
| 29 | writer.run(); |
|---|
| 30 | |
|---|
| 31 | } catch (DataFormatError& error) { |
|---|
| 32 | std::cerr << error.what() << std::endl; |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | return 0; |
|---|
| 37 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.