Modified a bit.
5 #include "hierarchygraph.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;
24 HierarchyGraph<SmartGraph, ListGraph> HGr;
25 ListGraph subnetwork, othernetwork;
26 typedef HierarchyGraph<SmartGraph, ListGraph>::Node Node;
27 typedef HierarchyGraph<SmartGraph, ListGraph>::Edge Edge;
28 typedef HierarchyGraph<SmartGraph, ListGraph>::SubNetwork Sntype;
31 Edge e0, e1, e2, e3, e4, e5;
33 ListGraph::Node sn0, sn1, on0;
38 cout << "Az n0 id-je: " << HGr.actuallayer.id(n0) << endl;
43 e0=HGr.addEdge(n0,n1);
44 e1=HGr.addEdge(n1,n0);
45 e2=HGr.addEdge(n0,n2);
46 e3=HGr.addEdge(n2,n0);
47 e4=HGr.addEdge(n1,n2);
48 e5=HGr.addEdge(n2,n1);
50 sn0=subnetwork.addNode();
51 sn1=subnetwork.addNode();
52 se0=subnetwork.addEdge(sn0,sn1);
55 sn.setActualLayer(&(HGr.actuallayer));
56 sn.setActualLayerNode(&(n0));
57 sn.addAssignment(e0, sn0);
58 sn.addAssignment(e1, sn1);
59 sn.addAssignment(e2, sn1);
60 sn.addAssignment(e3, sn0);
61 sn.addAssignment(e1, sn0);
62 sn.addAssignment(e5, sn0);
66 on0=othernetwork.addNode();
68 cout << "ID of a node from a different graph: " << subnetwork.id(on0) << endl;
69 cout << "ID of a node in its graph: " << othernetwork.id(on0) << endl;
70 cout << "ID of a node from a graph: " << subnetwork.id(sn0) << endl;
72 ListGraph::NodeIt snni;
73 //ListGraph::Node snn;
75 for(subnetwork.first(snni);subnetwork.valid(snni);subnetwork.next(snni))
79 cout << "Nem jo, megtalalta az idegen node-ot sajat haloban, pedig azt nem szabad!!!"
80 << subnetwork.id(snni) << subnetwork.id(on0) << othernetwork.id(snni) << othernetwork.id(on0) << endl;
82 else cout << "ID:" << subnetwork.id(snni) << endl;
87 HGr.subnetworks[n0]=sn;