src/work/johanna/ma_order_test.cc
author alpar
Tue, 04 Jan 2005 22:16:46 +0000
changeset 1050 bcc0766a7b86
parent 350 3a9a767b841e
permissions -rw-r--r--
Several new named parameters and documentation added to graphToEps().
beckerjc@350
     1
#include <string>
beckerjc@350
     2
#include <iostream>
beckerjc@350
     3
#include <map>
beckerjc@350
     4
#include <vector>
beckerjc@350
     5
beckerjc@350
     6
#include <ma_order.h>
beckerjc@350
     7
#include <list_graph.h>
beckerjc@350
     8
beckerjc@350
     9
beckerjc@350
    10
using namespace std;
alpar@921
    11
using namespace lemon;
beckerjc@350
    12
beckerjc@350
    13
int main() {
beckerjc@350
    14
beckerjc@350
    15
  typedef ListGraph::Node Node;
beckerjc@350
    16
  typedef ListGraph::Edge Edge;
beckerjc@350
    17
  typedef ListGraph::NodeIt NodeIt;
beckerjc@350
    18
  typedef ListGraph::EdgeIt EdgeIt;
beckerjc@350
    19
beckerjc@350
    20
  ListGraph G;
beckerjc@350
    21
beckerjc@350
    22
  Node v3=G.addNode();
beckerjc@350
    23
  Node v5=G.addNode();
beckerjc@350
    24
  Node v2=G.addNode();
beckerjc@350
    25
  Node v0=G.addNode();
beckerjc@350
    26
  Node v4=G.addNode();
beckerjc@350
    27
  Node v1=G.addNode();
beckerjc@350
    28
  
beckerjc@350
    29
  G.addEdge(v0, v1);G.addEdge(v0, v1);G.addEdge(v0, v1);
beckerjc@350
    30
  G.addEdge(v0, v2);
beckerjc@350
    31
  G.addEdge(v0, v3);G.addEdge(v0, v3);
beckerjc@350
    32
  G.addEdge(v1, v2);G.addEdge(v1, v2);
beckerjc@350
    33
  G.addEdge(v2, v4);
beckerjc@350
    34
  G.addEdge(v3, v4);
beckerjc@350
    35
  G.addEdge(v4, v5);
beckerjc@350
    36
beckerjc@350
    37
  G.addEdge(v1, v0);G.addEdge(v1, v0);G.addEdge(v1, v0);
beckerjc@350
    38
  G.addEdge(v2, v0);
beckerjc@350
    39
  G.addEdge(v3, v0);G.addEdge(v3, v0);
beckerjc@350
    40
  G.addEdge(v2, v1);G.addEdge(v2, v1);
beckerjc@350
    41
  G.addEdge(v4, v2);
beckerjc@350
    42
  G.addEdge(v4, v3);
beckerjc@350
    43
  G.addEdge(v5, v4);
beckerjc@350
    44
beckerjc@350
    45
beckerjc@350
    46
  vector<Node> ma_order;
beckerjc@350
    47
  MAOrder<ListGraph>  mao(G,ma_order);
beckerjc@350
    48
  mao.run(v0);
beckerjc@350
    49
  vector<Node>::iterator i;
beckerjc@350
    50
  for (i = ma_order.begin(); i!=ma_order.end(); ++i) {
beckerjc@350
    51
    cout << *i << " ";
beckerjc@350
    52
  }
beckerjc@350
    53
  cout << endl;
beckerjc@350
    54
  cout << v0 << " " << v1 << " " << v2 << " " << v3 << " " << v4 << " "
beckerjc@350
    55
       << v5 << endl;
beckerjc@350
    56
beckerjc@350
    57
}