A sample file.
5 #include <lemon/maps.h>
6 #include <lemon/error.h>
7 #include <lemon/list_graph.h>
8 #include <lemon/graph_reader.h>
9 #include <lemon/graph_utils.h>
11 using namespace lemon;
13 typedef ListGraph Graph;
14 typedef xy<double> Coordinates;
15 typedef Graph::NodeMap<Coordinates> CoordinatesMap;
16 typedef Graph::Node Node;
17 typedef Graph::EdgeIt EdgeIt;
18 typedef Graph::NodeIt NodeIt;
20 class CoordReaderMap: public MapBase <Node, double>
26 CoordReaderMap(char xory, CoordinatesMap & coordmap): cm(coordmap)
35 throw UninitializedParameter() ;
39 void set(Node node, double coord)
50 throw UninitializedParameter() ;
60 CoordReaderMap xreader('x',cm);
61 CoordReaderMap yreader('y',cm);
63 std::ifstream is("graphocska.lemon");
65 GraphReader<Graph> reader(is, g);
66 reader.addNodeMap("coordinates_x", xreader);
67 reader.addNodeMap("coordinates_y", yreader);
69 std::cout << "Megvagyok" << std::endl;
71 for (NodeIt i(g); i!=INVALID; ++i)
72 std::cout << " " << g.id(i) << " " << cm[i];
73 std::cout << std::endl;