author | klao |
Wed, 21 Apr 2004 19:10:59 +0000 | |
changeset 366 | be6fe0ea99b5 |
child 921 | 818510fa3d99 |
permissions | -rw-r--r-- |
1 #include <string>
2 #include <iostream>
3 #include <map>
4 #include <vector>
6 #include <ma_order.h>
7 #include <list_graph.h>
10 using namespace std;
11 using namespace hugo;
13 int main() {
15 typedef ListGraph::Node Node;
16 typedef ListGraph::Edge Edge;
17 typedef ListGraph::NodeIt NodeIt;
18 typedef ListGraph::EdgeIt EdgeIt;
20 ListGraph G;
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();
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);
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);
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;
57 }