COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
02/01/05 16:56:37 (19 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1514
Message:

Some changes in the IO and map utilities.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/deba/graph_io_test.cc

    r1037 r1115  
    1919
    2020  SmartGraph::NodeMap<int> id(graph);
    21   reader.readNodeMap("id", id);
     21  reader.addNodeMap("id", id);
    2222
    2323  SmartGraph::NodeMap<int> cost(graph);
    24   reader.readNodeMap("cost", cost);
     24  reader.addNodeMap("cost", cost);
    2525 
    2626  SmartGraph::NodeMap<string> color(graph);
    27   reader.readNodeMap("color", color);
     27  reader.addNodeMap("color", color);
    2828
    2929  SmartGraph::NodeMap<string> description(graph);
    30   reader.readNodeMap<QuotedStringReader>("description", description);
     30  reader.addNodeMap<QuotedStringReader>("description", description);
    3131
    3232  SmartGraph::EdgeMap<char> mmap(graph);
    33   reader.readEdgeMap("mmap", mmap);
     33  reader.addEdgeMap("mmap", mmap);
    3434
    3535  reader.skipEdgeMap<QuotedStringReader>("description");
    3636
    3737  SmartGraph::Node source;
    38   reader.readNode("source", source);
     38  reader.addNode("source", source);
    3939 
    4040  SmartGraph::Edge newedge;
    41   reader.readEdge("newedge", newedge);
     41  reader.addEdge("newedge", newedge);
    4242
    4343  try {
     
    4848    cerr << e.what() << endl;
    4949  }
     50
    5051  for (SmartGraph::NodeIt it(graph); it != INVALID; ++it) {
    5152    cout << cost[it] << ' ' << color[it] << ' ' << description[it] << endl;
     
    5354
    5455  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;
    5658  }
    5759
    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;
    6064
    6165  ofstream output("copy.lgf");
    6266  GraphWriter<SmartGraph> writer(output, graph);
    6367 
    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);
    6570 
    66   writer.writeNodeMap("id", node_ids);
    67   writer.writeNodeMap<QuotedStringWriter>("format", description);
     71  writer.addNodeMap("id", node_ids);
     72  writer.addNodeMap<QuotedStringWriter>("format", description);
    6873
    69   DescriptorMap<SmartGraph, SmartGraph::Edge, SmartGraph::EdgeIt, SmartGraph::EdgeMap<int> > edge_ids(graph);
     74  IdMap<SmartGraph, SmartGraph::Edge > edge_ids(graph);
    7075
    71   writer.writeEdgeMap("id", edge_ids);
    72   writer.writeEdgeMap("chars", mmap);
     76  writer.addEdgeMap("id", edge_ids);
     77  writer.addEdgeMap("chars", mmap);
    7378 
    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]);
    7681  writer.write();
    7782 
Note: See TracChangeset for help on using the changeset viewer.