diff -r 7ceab500e1f6 -r 1aa71600000c demo/reader_writer_demo.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/demo/reader_writer_demo.cc Fri Jul 01 16:10:46 2005 +0000 @@ -0,0 +1,83 @@ +#include +#include +#include +#include +#include + + +using namespace lemon; + +int main() { + SmartGraph graph; + + try { + std::string filename="sample.lgf"; + GraphReader reader(filename,graph); + SmartGraph::EdgeMap cap(graph); + reader.readEdgeMap("capacity",cap); +// reader.readNode("source",s).readNode("target",t) +// .readEdgeMap("capacity",cap).run(); + reader.run(); + + std::cout << "Hello! We have read a graph from file " << filename<< + " and some maps on it: now we write this to the standard output!" << + std::endl; + + + GraphWriter writer(std::cout, graph); + writer.writeEdgeMap("multiplicity", cap); +// writer.writeNode("source", s); +// writer.writeNode("target", t); + writer.run(); + +// LemonReader reader(std::cin); + +// NodeSetReader nodeset(reader, graph); +// SmartGraph::NodeMap cost(graph); +// nodeset.readMap("cost", cost); +// SmartGraph::NodeMap mmap(graph); +// nodeset.readMap("mmap", mmap); + +// EdgeSetReader edgeset(reader, graph, nodeset); +// SmartGraph::EdgeMap description(graph); +// edgeset.readMap("description", description); + +// NodeReader nodes(reader, nodeset); +// SmartGraph::Node source; +// nodes.readNode("source", source); +// SmartGraph::Node target; +// nodes.readNode("target", target); + +// AttributeReader<> attribute(reader, "gui"); +// std::string author; +// attribute.readAttribute("author", author); +// int count; +// attribute.readAttribute("count", count); + +// PrintReader print(reader); + +// reader.run(); + + +// for (SmartGraph::NodeIt it(graph); it != INVALID; ++it) { +// std::cout << cost[it] << ' ' << mmap[it] << std::endl; +// } + +// for (SmartGraph::EdgeIt it(graph); it != INVALID; ++it) { +// std::cout << description[it] << std::endl; +// } + +// std::cout << "author: " << author << std::endl; +// std::cout << "count: " << count << std::endl; + +// std::cout << "source cost: " << cost[source] << std::endl; +// std::cout << "target cost: " << cost[target] << std::endl; + +// std::cout.flush(); + } catch (DataFormatError& error) { + std::cerr << error.what() << std::endl; + } + + + return 0; +}