src/work/deba/graph_io_test.cc
changeset 1115 444f69240539
parent 1037 3eaff8d04171
child 1210 f02396423239
     1.1 --- a/src/work/deba/graph_io_test.cc	Tue Feb 01 15:51:22 2005 +0000
     1.2 +++ b/src/work/deba/graph_io_test.cc	Tue Feb 01 15:56:37 2005 +0000
     1.3 @@ -18,27 +18,27 @@
     1.4    GraphReader<SmartGraph> reader(input, graph);
     1.5  
     1.6    SmartGraph::NodeMap<int> id(graph);
     1.7 -  reader.readNodeMap("id", id);
     1.8 +  reader.addNodeMap("id", id);
     1.9  
    1.10    SmartGraph::NodeMap<int> cost(graph);
    1.11 -  reader.readNodeMap("cost", cost);
    1.12 +  reader.addNodeMap("cost", cost);
    1.13   
    1.14    SmartGraph::NodeMap<string> color(graph);
    1.15 -  reader.readNodeMap("color", color);
    1.16 +  reader.addNodeMap("color", color);
    1.17  
    1.18    SmartGraph::NodeMap<string> description(graph);
    1.19 -  reader.readNodeMap<QuotedStringReader>("description", description);
    1.20 +  reader.addNodeMap<QuotedStringReader>("description", description);
    1.21  
    1.22    SmartGraph::EdgeMap<char> mmap(graph);
    1.23 -  reader.readEdgeMap("mmap", mmap);
    1.24 +  reader.addEdgeMap("mmap", mmap);
    1.25  
    1.26    reader.skipEdgeMap<QuotedStringReader>("description");
    1.27  
    1.28    SmartGraph::Node source;
    1.29 -  reader.readNode("source", source);
    1.30 +  reader.addNode("source", source);
    1.31    
    1.32    SmartGraph::Edge newedge;
    1.33 -  reader.readEdge("newedge", newedge);
    1.34 +  reader.addEdge("newedge", newedge);
    1.35  
    1.36    try {
    1.37      reader.read();
    1.38 @@ -47,32 +47,37 @@
    1.39    } catch (Exception e) {
    1.40      cerr << e.what() << endl;
    1.41    }
    1.42 +
    1.43    for (SmartGraph::NodeIt it(graph); it != INVALID; ++it) {
    1.44      cout << cost[it] << ' ' << color[it] << ' ' << description[it] << endl;
    1.45    }
    1.46  
    1.47    for (SmartGraph::EdgeIt it(graph); it != INVALID; ++it) {
    1.48 -    cout << mmap[it] << ' ' << id[graph.source(it)] << ' ' << id[graph.target(it)]  << endl;
    1.49 +    cout << mmap[it] << ' ' << id[graph.source(it)] << ' ' << 
    1.50 +      id[graph.target(it)]  << endl;
    1.51    }
    1.52  
    1.53 -  cout << id[source] << ' ' << cost[source] << ' ' << color[source] << ' ' << description[source] << endl;
    1.54 -  cout << mmap[newedge] << ' ' << id[graph.source(newedge)] << ' ' << id[graph.target(newedge)]  << endl;
    1.55 +  cout << id[source] << ' ' << cost[source] << ' ' <<
    1.56 +    color[source] << ' ' << description[source] << endl;
    1.57 +  cout << mmap[newedge] << ' ' << id[graph.source(newedge)] << 
    1.58 +    ' ' << id[graph.target(newedge)]  << endl;
    1.59  
    1.60    ofstream output("copy.lgf");
    1.61    GraphWriter<SmartGraph> writer(output, graph);
    1.62    
    1.63 -  DescriptorMap<SmartGraph, SmartGraph::Node, SmartGraph::NodeIt, SmartGraph::NodeMap<int> > node_ids(graph);
    1.64 +  DescriptorMap<SmartGraph, SmartGraph::Node, SmartGraph::NodeMap<int> > 
    1.65 +    node_ids(graph);
    1.66    
    1.67 -  writer.writeNodeMap("id", node_ids);
    1.68 -  writer.writeNodeMap<QuotedStringWriter>("format", description);
    1.69 +  writer.addNodeMap("id", node_ids);
    1.70 +  writer.addNodeMap<QuotedStringWriter>("format", description);
    1.71  
    1.72 -  DescriptorMap<SmartGraph, SmartGraph::Edge, SmartGraph::EdgeIt, SmartGraph::EdgeMap<int> > edge_ids(graph);
    1.73 +  IdMap<SmartGraph, SmartGraph::Edge > edge_ids(graph);
    1.74  
    1.75 -  writer.writeEdgeMap("id", edge_ids);
    1.76 -  writer.writeEdgeMap("chars", mmap);
    1.77 +  writer.addEdgeMap("id", edge_ids);
    1.78 +  writer.addEdgeMap("chars", mmap);
    1.79    
    1.80 -  writer.writeNode("source", node_ids.inverse()[3]);
    1.81 -  writer.writeEdge("elek", edge_ids.inverse()[6]);
    1.82 +  writer.addNode("source", node_ids.inverse()[3]);
    1.83 +  //  writer.addEdge("elek", edge_ids.inverse()[6]);
    1.84    writer.write();
    1.85    
    1.86    return 0;