COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/work/deba/main.cpp @ 701:c03e073b8394

Last change on this file since 701:c03e073b8394 was 701:c03e073b8394, checked in by Balazs Dezso, 16 years ago
File size: 917 bytes
Line 
1#include <iostream>
2#include <cstdlib>
3#include "list_graph.h"
4
5using namespace std;
6using namespace hugo;
7
8
9int main() {
10  ListGraph g;
11  for (int i = 0; i < 10; ++i) {
12    ListGraph::Node node = g.addNode();
13  }
14  ListGraph::NodeMap<int> map(g, 10);
15  for (int i = 0; i < 10; ++i) {
16    ListGraph::Node node = g.addNode();
17    map[node] = rand()%100;
18  }
19  for (ListGraph::NodeIt it(g); g.valid(it); g.next(it)) {
20    cout << map[it] << endl;
21  }
22  ListGraph::NodeMap<int>::iterator pit;
23  for (pit = map.begin(); pit != map.end(); ++pit) {
24    cout << g.id(pit->first) << ' ' << pit->second << endl;
25  }
26  ListGraph::NodeMap<double> ot_map = map;
27  for (ListGraph::NodeIt it(g); g.valid(it); g.next(it)) {
28    ot_map[it] *= 2.1;
29    cout << ot_map[it] << endl;
30  }
31  ot_map = map;
32  for (ListGraph::NodeIt it(g); g.valid(it); g.next(it)) {
33    ot_map[it] *= 3.1;
34    cout << ot_map[it] << endl;
35  }
36  return 0;
37}
38
Note: See TracBrowser for help on using the repository browser.