src/work/johanna/ma_order_test.cc
changeset 565 18787f6db0db
child 921 818510fa3d99
equal deleted inserted replaced
-1:000000000000 0:14919f3540ff
       
     1 #include <string>
       
     2 #include <iostream>
       
     3 #include <map>
       
     4 #include <vector>
       
     5 
       
     6 #include <ma_order.h>
       
     7 #include <list_graph.h>
       
     8 
       
     9 
       
    10 using namespace std;
       
    11 using namespace hugo;
       
    12 
       
    13 int main() {
       
    14 
       
    15   typedef ListGraph::Node Node;
       
    16   typedef ListGraph::Edge Edge;
       
    17   typedef ListGraph::NodeIt NodeIt;
       
    18   typedef ListGraph::EdgeIt EdgeIt;
       
    19 
       
    20   ListGraph G;
       
    21 
       
    22   Node v3=G.addNode();
       
    23   Node v5=G.addNode();
       
    24   Node v2=G.addNode();
       
    25   Node v0=G.addNode();
       
    26   Node v4=G.addNode();
       
    27   Node v1=G.addNode();
       
    28   
       
    29   G.addEdge(v0, v1);G.addEdge(v0, v1);G.addEdge(v0, v1);
       
    30   G.addEdge(v0, v2);
       
    31   G.addEdge(v0, v3);G.addEdge(v0, v3);
       
    32   G.addEdge(v1, v2);G.addEdge(v1, v2);
       
    33   G.addEdge(v2, v4);
       
    34   G.addEdge(v3, v4);
       
    35   G.addEdge(v4, v5);
       
    36 
       
    37   G.addEdge(v1, v0);G.addEdge(v1, v0);G.addEdge(v1, v0);
       
    38   G.addEdge(v2, v0);
       
    39   G.addEdge(v3, v0);G.addEdge(v3, v0);
       
    40   G.addEdge(v2, v1);G.addEdge(v2, v1);
       
    41   G.addEdge(v4, v2);
       
    42   G.addEdge(v4, v3);
       
    43   G.addEdge(v5, v4);
       
    44 
       
    45 
       
    46   vector<Node> ma_order;
       
    47   MAOrder<ListGraph>  mao(G,ma_order);
       
    48   mao.run(v0);
       
    49   vector<Node>::iterator i;
       
    50   for (i = ma_order.begin(); i!=ma_order.end(); ++i) {
       
    51     cout << *i << " ";
       
    52   }
       
    53   cout << endl;
       
    54   cout << v0 << " " << v1 << " " << v2 << " " << v3 << " " << v4 << " "
       
    55        << v5 << endl;
       
    56 
       
    57 }