1.1 --- a/src/work/peter/hierarchygraph_test.cc Wed Jun 30 14:59:46 2004 +0000
1.2 +++ b/src/work/peter/hierarchygraph_test.cc Mon Jul 05 15:52:35 2004 +0000
1.3 @@ -22,4 +22,68 @@
1.4 int main()
1.5 {
1.6 HierarchyGraph<SmartGraph, ListGraph> HGr;
1.7 + ListGraph subnetwork, othernetwork;
1.8 + typedef HierarchyGraph<SmartGraph, ListGraph>::Node Node;
1.9 + typedef HierarchyGraph<SmartGraph, ListGraph>::Edge Edge;
1.10 + typedef HierarchyGraph<SmartGraph, ListGraph>::SubNetwork Sntype;
1.11 +
1.12 + Node n0, n1, n2;
1.13 + Edge e0, e1, e2, e3, e4, e5;
1.14 +
1.15 + ListGraph::Node sn0, sn1, on0;
1.16 + ListGraph::Edge se0;
1.17 +
1.18 + n0=HGr.addNode();
1.19 +
1.20 + cout << "Az n0 id-je: " << HGr.actuallayer.id(n0) << endl;
1.21 +
1.22 + n1=HGr.addNode();
1.23 + n2=HGr.addNode();
1.24 +
1.25 + e0=HGr.addEdge(n0,n1);
1.26 + e1=HGr.addEdge(n1,n0);
1.27 + e2=HGr.addEdge(n0,n2);
1.28 + e3=HGr.addEdge(n2,n0);
1.29 + e4=HGr.addEdge(n1,n2);
1.30 + e5=HGr.addEdge(n2,n1);
1.31 +
1.32 + sn0=subnetwork.addNode();
1.33 + sn1=subnetwork.addNode();
1.34 + se0=subnetwork.addEdge(sn0,sn1);
1.35 +
1.36 + Sntype sn;
1.37 + sn.setActualLayer(&(HGr.actuallayer));
1.38 + sn.setActualLayerNode(&(n0));
1.39 + sn.addAssignment(e0, sn0);
1.40 + sn.addAssignment(e1, sn1);
1.41 + sn.addAssignment(e2, sn1);
1.42 + sn.addAssignment(e3, sn0);
1.43 + sn.addAssignment(e1, sn0);
1.44 + sn.addAssignment(e5, sn0);
1.45 +
1.46 +
1.47 +
1.48 + on0=othernetwork.addNode();
1.49 +
1.50 + cout << "ID of a node from a different graph: " << subnetwork.id(on0) << endl;
1.51 + cout << "ID of a node in its graph: " << othernetwork.id(on0) << endl;
1.52 + cout << "ID of a node from a graph: " << subnetwork.id(sn0) << endl;
1.53 +
1.54 + ListGraph::NodeIt snni;
1.55 + //ListGraph::Node snn;
1.56 +
1.57 + for(subnetwork.first(snni);subnetwork.valid(snni);subnetwork.next(snni))
1.58 + {
1.59 + if(snni==on0)
1.60 + {
1.61 + cout << "Nem jo, megtalalta az idegen node-ot sajat haloban, pedig azt nem szabad!!!"
1.62 + << subnetwork.id(snni) << subnetwork.id(on0) << othernetwork.id(snni) << othernetwork.id(on0) << endl;
1.63 + }
1.64 + else cout << "ID:" << subnetwork.id(snni) << endl;
1.65 +
1.66 + }
1.67 +
1.68 +
1.69 + HGr.subnetworks[n0]=sn;
1.70 +
1.71 }