2 #include <lemon/smart_graph.h>
3 #include <lemon/invalid.h>
4 #include <lemon/graph_reader.h>
5 #include <lemon/graph_writer.h>
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.readNode("source",s).readNode("target",t)
19 // .readEdgeMap("capacity",cap).run();
22 std::cout << "Hello! We have read a graph from file " << filename<<
23 " and some maps on it: now we write this to the standard output!" <<
27 GraphWriter<SmartGraph> writer(std::cout, graph);
28 writer.writeEdgeMap("multiplicity", cap);
29 // writer.writeNode("source", s);
30 // writer.writeNode("target", t);
33 // LemonReader reader(std::cin);
35 // NodeSetReader<SmartGraph> nodeset(reader, graph);
36 // SmartGraph::NodeMap<int> cost(graph);
37 // nodeset.readMap("cost", cost);
38 // SmartGraph::NodeMap<char> mmap(graph);
39 // nodeset.readMap("mmap", mmap);
41 // EdgeSetReader<SmartGraph> edgeset(reader, graph, nodeset);
42 // SmartGraph::EdgeMap<std::string> description(graph);
43 // edgeset.readMap<QuotedStringReader>("description", description);
45 // NodeReader<SmartGraph> nodes(reader, nodeset);
46 // SmartGraph::Node source;
47 // nodes.readNode("source", source);
48 // SmartGraph::Node target;
49 // nodes.readNode("target", target);
51 // AttributeReader<> attribute(reader, "gui");
52 // std::string author;
53 // attribute.readAttribute<LineReader>("author", author);
55 // attribute.readAttribute("count", count);
57 // PrintReader print(reader);
62 // for (SmartGraph::NodeIt it(graph); it != INVALID; ++it) {
63 // std::cout << cost[it] << ' ' << mmap[it] << std::endl;
66 // for (SmartGraph::EdgeIt it(graph); it != INVALID; ++it) {
67 // std::cout << description[it] << std::endl;
70 // std::cout << "author: " << author << std::endl;
71 // std::cout << "count: " << count << std::endl;
73 // std::cout << "source cost: " << cost[source] << std::endl;
74 // std::cout << "target cost: " << cost[target] << std::endl;
77 } catch (DataFormatError& error) {
78 std::cerr << error.what() << std::endl;