Changeset 1115:444f69240539 in lemon-0.x for src/work/deba/graph_io_test.cc
- Timestamp:
- 02/01/05 16:56:37 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1514
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/deba/graph_io_test.cc
r1037 r1115 19 19 20 20 SmartGraph::NodeMap<int> id(graph); 21 reader. readNodeMap("id", id);21 reader.addNodeMap("id", id); 22 22 23 23 SmartGraph::NodeMap<int> cost(graph); 24 reader. readNodeMap("cost", cost);24 reader.addNodeMap("cost", cost); 25 25 26 26 SmartGraph::NodeMap<string> color(graph); 27 reader. readNodeMap("color", color);27 reader.addNodeMap("color", color); 28 28 29 29 SmartGraph::NodeMap<string> description(graph); 30 reader. readNodeMap<QuotedStringReader>("description", description);30 reader.addNodeMap<QuotedStringReader>("description", description); 31 31 32 32 SmartGraph::EdgeMap<char> mmap(graph); 33 reader. readEdgeMap("mmap", mmap);33 reader.addEdgeMap("mmap", mmap); 34 34 35 35 reader.skipEdgeMap<QuotedStringReader>("description"); 36 36 37 37 SmartGraph::Node source; 38 reader. readNode("source", source);38 reader.addNode("source", source); 39 39 40 40 SmartGraph::Edge newedge; 41 reader. readEdge("newedge", newedge);41 reader.addEdge("newedge", newedge); 42 42 43 43 try { … … 48 48 cerr << e.what() << endl; 49 49 } 50 50 51 for (SmartGraph::NodeIt it(graph); it != INVALID; ++it) { 51 52 cout << cost[it] << ' ' << color[it] << ' ' << description[it] << endl; … … 53 54 54 55 for (SmartGraph::EdgeIt it(graph); it != INVALID; ++it) { 55 cout << mmap[it] << ' ' << id[graph.source(it)] << ' ' << id[graph.target(it)] << endl; 56 cout << mmap[it] << ' ' << id[graph.source(it)] << ' ' << 57 id[graph.target(it)] << endl; 56 58 } 57 59 58 cout << id[source] << ' ' << cost[source] << ' ' << color[source] << ' ' << description[source] << endl; 59 cout << mmap[newedge] << ' ' << id[graph.source(newedge)] << ' ' << id[graph.target(newedge)] << endl; 60 cout << id[source] << ' ' << cost[source] << ' ' << 61 color[source] << ' ' << description[source] << endl; 62 cout << mmap[newedge] << ' ' << id[graph.source(newedge)] << 63 ' ' << id[graph.target(newedge)] << endl; 60 64 61 65 ofstream output("copy.lgf"); 62 66 GraphWriter<SmartGraph> writer(output, graph); 63 67 64 DescriptorMap<SmartGraph, SmartGraph::Node, SmartGraph::NodeIt, SmartGraph::NodeMap<int> > node_ids(graph); 68 DescriptorMap<SmartGraph, SmartGraph::Node, SmartGraph::NodeMap<int> > 69 node_ids(graph); 65 70 66 writer. writeNodeMap("id", node_ids);67 writer. writeNodeMap<QuotedStringWriter>("format", description);71 writer.addNodeMap("id", node_ids); 72 writer.addNodeMap<QuotedStringWriter>("format", description); 68 73 69 DescriptorMap<SmartGraph, SmartGraph::Edge, SmartGraph::EdgeIt, SmartGraph::EdgeMap<int>> edge_ids(graph);74 IdMap<SmartGraph, SmartGraph::Edge > edge_ids(graph); 70 75 71 writer. writeEdgeMap("id", edge_ids);72 writer. writeEdgeMap("chars", mmap);76 writer.addEdgeMap("id", edge_ids); 77 writer.addEdgeMap("chars", mmap); 73 78 74 writer. writeNode("source", node_ids.inverse()[3]);75 writer.writeEdge("elek", edge_ids.inverse()[6]);79 writer.addNode("source", node_ids.inverse()[3]); 80 // writer.addEdge("elek", edge_ids.inverse()[6]); 76 81 writer.write(); 77 82
Note: See TracChangeset
for help on using the changeset viewer.