athos@1528: #include athos@1528: #include athos@1528: #include athos@1528: #include athos@1528: #include athos@1528: athos@1528: athos@1528: using namespace lemon; athos@1528: athos@1528: int main() { athos@1528: SmartGraph graph; athos@1528: athos@1528: try { athos@1528: std::string filename="sample.lgf"; athos@1528: GraphReader reader(filename,graph); athos@1528: SmartGraph::EdgeMap cap(graph); athos@1528: reader.readEdgeMap("capacity",cap); athos@1528: // reader.readNode("source",s).readNode("target",t) athos@1528: // .readEdgeMap("capacity",cap).run(); athos@1528: reader.run(); athos@1528: athos@1528: std::cout << "Hello! We have read a graph from file " << filename<< athos@1528: " and some maps on it: now we write this to the standard output!" << athos@1528: std::endl; athos@1528: athos@1528: athos@1528: GraphWriter writer(std::cout, graph); athos@1528: writer.writeEdgeMap("multiplicity", cap); athos@1528: // writer.writeNode("source", s); athos@1528: // writer.writeNode("target", t); athos@1528: writer.run(); athos@1528: athos@1528: // LemonReader reader(std::cin); athos@1528: athos@1528: // NodeSetReader nodeset(reader, graph); athos@1528: // SmartGraph::NodeMap cost(graph); athos@1528: // nodeset.readMap("cost", cost); athos@1528: // SmartGraph::NodeMap mmap(graph); athos@1528: // nodeset.readMap("mmap", mmap); athos@1528: athos@1528: // EdgeSetReader edgeset(reader, graph, nodeset); athos@1528: // SmartGraph::EdgeMap description(graph); athos@1528: // edgeset.readMap("description", description); athos@1528: athos@1528: // NodeReader nodes(reader, nodeset); athos@1528: // SmartGraph::Node source; athos@1528: // nodes.readNode("source", source); athos@1528: // SmartGraph::Node target; athos@1528: // nodes.readNode("target", target); athos@1528: athos@1528: // AttributeReader<> attribute(reader, "gui"); athos@1528: // std::string author; athos@1528: // attribute.readAttribute("author", author); athos@1528: // int count; athos@1528: // attribute.readAttribute("count", count); athos@1528: athos@1528: // PrintReader print(reader); athos@1528: athos@1528: // reader.run(); athos@1528: athos@1528: athos@1528: // for (SmartGraph::NodeIt it(graph); it != INVALID; ++it) { athos@1528: // std::cout << cost[it] << ' ' << mmap[it] << std::endl; athos@1528: // } athos@1528: athos@1528: // for (SmartGraph::EdgeIt it(graph); it != INVALID; ++it) { athos@1528: // std::cout << description[it] << std::endl; athos@1528: // } athos@1528: athos@1528: // std::cout << "author: " << author << std::endl; athos@1528: // std::cout << "count: " << count << std::endl; athos@1528: athos@1528: // std::cout << "source cost: " << cost[source] << std::endl; athos@1528: // std::cout << "target cost: " << cost[target] << std::endl; athos@1528: athos@1528: // std::cout.flush(); athos@1528: } catch (DataFormatError& error) { athos@1528: std::cerr << error.what() << std::endl; athos@1528: } athos@1528: athos@1528: athos@1528: return 0; athos@1528: }