COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
12/14/04 20:26:50 (19 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1426
Message:

reader under construction

File:
1 edited

Legend:

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

    r1032 r1036  
    11#include <lemon/smart_graph.h>
    2 #include <lemon/graph_reader.h>
     2#include "graph_reader.h"
    33
    44#include <iostream>
     
    1212  SmartGraph graph;
    1313  GraphReader<SmartGraph> reader(input, graph);
     14  SmartGraph::NodeMap<int> id(graph);
     15  reader.readNodeMap("id", id);
    1416  SmartGraph::NodeMap<int> cost(graph);
    1517  reader.readNodeMap("cost", cost);
    1618  SmartGraph::NodeMap<string> color(graph);
    1719  reader.readNodeMap("color", color);
    18   reader.read();
     20  SmartGraph::NodeMap<string> description(graph);
     21  reader.readNodeMap<QuotedStringReader>("description", description);
     22  SmartGraph::EdgeMap<char> mmap(graph);
     23  reader.readEdgeMap("mmap", mmap);
     24  reader.skipEdgeMap<QuotedStringReader>("description");
     25  try {
     26    reader.read();
     27  } catch (IOException& e) {
     28    cerr << e.what() << endl;
     29  } catch (Exception e) {
     30    cerr << e.what() << endl;
     31  }
    1932  for (SmartGraph::NodeIt it(graph); it != INVALID; ++it) {
    20     cout << cost[it] << color[it] << endl;
     33    cout << cost[it] << ' ' << color[it] << ' ' << description[it] << endl;
     34  }
     35
     36  for (SmartGraph::EdgeIt it(graph); it != INVALID; ++it) {
     37    cout << mmap[it] << ' ' << id[graph.source(it)] << ' ' << id[graph.target(it)]  << endl;
    2138  }
    2239  return 0;
Note: See TracChangeset for help on using the changeset viewer.