| Rev | Line |  | 
|---|
| [703] | 1 | // -*- c++ -*- | 
|---|
| [378] | 2 | #include <iostream> | 
|---|
| [595] | 3 | #include <cstdlib> | 
|---|
| [698] | 4 | #include "list_graph.h" | 
|---|
| [378] | 5 |  | 
|---|
|  | 6 | using namespace std; | 
|---|
| [922] | 7 | using namespace lemon; | 
|---|
| [378] | 8 |  | 
|---|
|  | 9 |  | 
|---|
| [703] | 10 |  | 
|---|
| [378] | 11 | int main() { | 
|---|
| [627] | 12 | ListGraph g; | 
|---|
|  | 13 | for (int i = 0; i < 10; ++i) { | 
|---|
|  | 14 | ListGraph::Node node = g.addNode(); | 
|---|
|  | 15 | } | 
|---|
| [701] | 16 | ListGraph::NodeMap<int> map(g, 10); | 
|---|
| [627] | 17 | for (int i = 0; i < 10; ++i) { | 
|---|
|  | 18 | ListGraph::Node node = g.addNode(); | 
|---|
|  | 19 | map[node] = rand()%100; | 
|---|
|  | 20 | } | 
|---|
|  | 21 | for (ListGraph::NodeIt it(g); g.valid(it); g.next(it)) { | 
|---|
|  | 22 | cout << map[it] << endl; | 
|---|
|  | 23 | } | 
|---|
| [701] | 24 | ListGraph::NodeMap<int>::iterator pit; | 
|---|
|  | 25 | for (pit = map.begin(); pit != map.end(); ++pit) { | 
|---|
|  | 26 | cout << g.id(pit->first) << ' ' << pit->second << endl; | 
|---|
| [703] | 27 | (*pit).second = g.id(pit->first); | 
|---|
|  | 28 | cout << g.id((*pit).first) << ' ' << (*pit).second << endl; | 
|---|
|  | 29 | } | 
|---|
|  | 30 | const ListGraph::NodeMap<int> const_map = map; | 
|---|
|  | 31 | ListGraph::NodeMap<int>::const_iterator cit; | 
|---|
|  | 32 | for (cit = const_map.begin(); cit != const_map.end(); ++cit) { | 
|---|
|  | 33 | cerr << g.id(cit->first) << ' ' << cit->second << endl; | 
|---|
|  | 34 | cerr << g.id((*cit).first) << ' ' << (*cit).second << endl; | 
|---|
|  | 35 | } | 
|---|
| [627] | 36 | return 0; | 
|---|
| [378] | 37 | } | 
|---|
|  | 38 |  | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.