deba@703: // -*- c++ -*- deba@378: #include deba@595: #include deba@698: #include "list_graph.h" deba@378: deba@378: using namespace std; deba@378: using namespace hugo; deba@378: deba@378: deba@703: deba@378: int main() { deba@627: ListGraph g; deba@627: for (int i = 0; i < 10; ++i) { deba@627: ListGraph::Node node = g.addNode(); deba@627: } deba@701: ListGraph::NodeMap map(g, 10); deba@627: for (int i = 0; i < 10; ++i) { deba@627: ListGraph::Node node = g.addNode(); deba@627: map[node] = rand()%100; deba@627: } deba@627: for (ListGraph::NodeIt it(g); g.valid(it); g.next(it)) { deba@627: cout << map[it] << endl; deba@627: } deba@701: ListGraph::NodeMap::iterator pit; deba@701: for (pit = map.begin(); pit != map.end(); ++pit) { deba@701: cout << g.id(pit->first) << ' ' << pit->second << endl; deba@703: (*pit).second = g.id(pit->first); deba@703: cout << g.id((*pit).first) << ' ' << (*pit).second << endl; deba@703: } deba@703: const ListGraph::NodeMap const_map = map; deba@703: ListGraph::NodeMap::const_iterator cit; deba@703: for (cit = const_map.begin(); cit != const_map.end(); ++cit) { deba@703: cerr << g.id(cit->first) << ' ' << cit->second << endl; deba@703: cerr << g.id((*cit).first) << ' ' << (*cit).second << endl; deba@703: } deba@627: return 0; deba@378: } deba@378: