Several new named parameters and documentation added to graphToEps().
5 #include "edgepathgraph.h"
6 #include <lemon/list_graph.h>
7 #include <lemon/smart_graph.h>
10 using namespace lemon;
16 passed = passed && rc;
18 cout << "Test failed!" << endl;
25 EdgePathGraph<DirPath<ListGraph>, SmartGraph, ListGraph> EPGr;
30 printf("%d node is in EPGr, after addition of 4 nodes.\n", EPGr.nodeNum());
32 EdgePathGraph<DirPath<ListGraph>, SmartGraph, ListGraph> EPGr2(EPGr);
33 printf("%d node is in EPGr2 created by copy constructor from EPGr.\n", EPGr2.nodeNum());
37 printf("%d node is in EPGr2 after addition of 2 more nodes.\n", EPGr2.nodeNum());
39 printf("%d nodes are in EPGr, before clear.\n", EPGr.nodeNum());
41 printf("%d nodes are in EPGr, after clear.\n", EPGr.nodeNum());
42 printf("%d nodes are in EPGr2, after clear of EPGr.\n", EPGr2.nodeNum());
46 EdgePathGraph<DirPath<ListGraph>, SmartGraph, ListGraph> EPGr;
47 //EdgePathGraph<DirPath<ListGraph>, SmartGraph, EdgePathGraph<DirPath<SmartGraph>, ListGraph, SmartGraph> > EPGr;
48 EdgePathGraph<DirPath<SmartGraph>, ListGraph, SmartGraph> EPGr2;
50 typedef EdgePathGraph<DirPath<SmartGraph>, SmartGraph, ListGraph>::Node Node;
51 typedef EdgePathGraph<DirPath<SmartGraph>, SmartGraph, ListGraph>::Edge Edge;
52 typedef EdgePathGraph<DirPath<SmartGraph>, SmartGraph, ListGraph>::EdgeIt EdgeIt;
55 Edge e0, e1, e2, e3, e4, e5;
57 ListGraph::Node m0, m1, m2, m3;
58 ListGraph::Edge f0, f1, f2, f3, f4, f5;
65 e0=EPGr.addEdge(n0,n1);
66 e1=EPGr.addEdge(n1,n0);
67 e2=EPGr.addEdge(n0,n2);
68 e3=EPGr.addEdge(n2,n0);
69 e4=EPGr.addEdge(n1,n2);
70 e5=EPGr.addEdge(n2,n1);
78 f0=EPGr2.addEdge(m0,m3);
79 f1=EPGr2.addEdge(m3,m0);
80 f2=EPGr2.addEdge(m2,m3);
81 f3=EPGr2.addEdge(m3,m2);
82 f4=EPGr2.addEdge(m1,m2);
83 f5=EPGr2.addEdge(m2,m1);
85 EPGr.sublayer=&(EPGr2.actuallayer);
86 //EPGr.sublayer=&(EPGr2);
88 EPGr.projection[n0]=&m0;
89 EPGr.projection[n1]=&m1;
90 EPGr.projection[n2]=&m2;
93 typedef DirPath<ListGraph> DPath;
97 DPath P1(EPGr2.actuallayer);//0-2
98 DPath::Builder B1(P1);
102 cout << P1.length() << " hosszu utvonal letrehozva" << endl;
104 DPath P2(EPGr2.actuallayer);//2-0
105 DPath::Builder B2(P2);
109 cout << P2.length() << " hosszu utvonal letrehozva" << endl;
111 DPath P3(EPGr2.actuallayer);//0-1
112 DPath::Builder B3(P3);
117 cout << P3.length() << " hosszu utvonal letrehozva" << endl;
119 DPath P4(EPGr2.actuallayer);//1-0
120 DPath::Builder B4(P4);
125 cout << P4.length() << " hosszu utvonal letrehozva" << endl;
128 EPGr.edgepath[e0]=&P3;
129 EPGr.edgepath[e1]=&P4;
130 EPGr.edgepath[e2]=&P1;
131 EPGr.edgepath[e3]=&P2;
133 for(EdgeIt e(EPGr.actuallayer);EPGr.actuallayer.valid(e);EPGr.actuallayer.next(e))
135 typedef DPath::EdgeIt PEdgeIt;
138 cout << "Edge " << EPGr.id(EPGr.source(e)) << " - " << EPGr.id(EPGr.target(e)) << " in actual layer is";
141 cout << endl << "Path";
142 for(EPGr.edgepath[e]->first(f); EPGr.edgepath[e]->valid(f); EPGr.edgepath[e]->next(f))
144 cout << " " << EPGr2.id(EPGr2.source(f)) << "-" << EPGr2.id(EPGr2.target(f));
146 //cout << EPGr2.id(EPGr2.target(f)) << endl;
151 cout << " itself." <<endl;
156 cout << "================================" << endl;
158 SmartGraph::EdgeMap<int> actlaymap(EPGr.actuallayer);
159 //EdgePathGraph<DirPath<ListGraph>, SmartGraph, EdgePathGraph<DirPath<SmartGraph>, ListGraph, SmartGraph> > EPGr;
160 ListGraph::EdgeMap<double> sublaymap(EPGr2.actuallayer);
167 cout << "EdgeMaps before addMap:" << endl;
169 cout << "actlaymap: ";
170 for(EdgeIt e(EPGr.actuallayer);EPGr.actuallayer.valid(e);EPGr.actuallayer.next(e))
172 cout << EPGr.id(EPGr.source(e)) << "-" << EPGr.id(EPGr.target(e)) << ":" << actlaymap[e] << " ";
175 cout << "sublaymap: ";
176 for(ListGraph::EdgeIt e(EPGr2.actuallayer);EPGr2.actuallayer.valid(e);EPGr2.actuallayer.next(e))
178 cout << EPGr2.id(EPGr2.source(e)) << "-" << EPGr2.id(EPGr2.target(e)) << ":" << sublaymap[e] << " ";
181 //EdgeMap-ok kiirasa#vege
184 EPGr.addMap<int, double>(actlaymap, sublaymap);
188 cout << "EdgeMaps after addMap:" << endl;
190 cout << "actlaymap: ";
191 for(EdgeIt e(EPGr.actuallayer);EPGr.actuallayer.valid(e);EPGr.actuallayer.next(e))
193 cout << EPGr.id(EPGr.source(e)) << "-" << EPGr.id(EPGr.target(e)) << ":" << actlaymap[e] << " ";
196 cout << "sublaymap: ";
197 for(ListGraph::EdgeIt e(EPGr2.actuallayer);EPGr2.actuallayer.valid(e);EPGr2.actuallayer.next(e))
199 cout << EPGr2.id(EPGr2.source(e)) << "-" << EPGr2.id(EPGr2.target(e)) << ":" << sublaymap[e] << " ";
202 //EdgeMap-ok kiirasa#vege