1.1 --- a/src/work/peter/hierarchygraph_test.cc Sun Apr 17 18:57:22 2005 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,89 +0,0 @@
1.4 -#include <string>
1.5 -#include <iostream>
1.6 -#include <stdio.h>
1.7 -
1.8 -#include "hierarchygraph.h"
1.9 -#include <lemon/list_graph.h>
1.10 -#include <lemon/smart_graph.h>
1.11 -#include <path.h>
1.12 -
1.13 -using namespace lemon;
1.14 -using namespace std;
1.15 -
1.16 -bool passed = true;
1.17 -
1.18 -void check(bool rc) {
1.19 - passed = passed && rc;
1.20 - if(!rc) {
1.21 - cout << "Test failed!" << endl;
1.22 - }
1.23 -}
1.24 -
1.25 -int main()
1.26 -{
1.27 - HierarchyGraph<SmartGraph, ListGraph> HGr;
1.28 - ListGraph subnetwork, othernetwork;
1.29 - typedef HierarchyGraph<SmartGraph, ListGraph>::Node Node;
1.30 - typedef HierarchyGraph<SmartGraph, ListGraph>::Edge Edge;
1.31 - typedef HierarchyGraph<SmartGraph, ListGraph>::SubNetwork Sntype;
1.32 -
1.33 - Node n0, n1, n2;
1.34 - Edge e0, e1, e2, e3, e4, e5;
1.35 -
1.36 - ListGraph::Node sn0, sn1, on0;
1.37 - ListGraph::Edge se0;
1.38 -
1.39 - n0=HGr.addNode();
1.40 -
1.41 - cout << "Az n0 id-je: " << HGr.actuallayer.id(n0) << endl;
1.42 -
1.43 - n1=HGr.addNode();
1.44 - n2=HGr.addNode();
1.45 -
1.46 - e0=HGr.addEdge(n0,n1);
1.47 - e1=HGr.addEdge(n1,n0);
1.48 - e2=HGr.addEdge(n0,n2);
1.49 - e3=HGr.addEdge(n2,n0);
1.50 - e4=HGr.addEdge(n1,n2);
1.51 - e5=HGr.addEdge(n2,n1);
1.52 -
1.53 - sn0=subnetwork.addNode();
1.54 - sn1=subnetwork.addNode();
1.55 - se0=subnetwork.addEdge(sn0,sn1);
1.56 -
1.57 - Sntype sn;
1.58 - sn.setActualLayer(&(HGr.actuallayer));
1.59 - sn.setActualLayerNode(&(n0));
1.60 - sn.addAssignment(e0, sn0);
1.61 - sn.addAssignment(e1, sn1);
1.62 - sn.addAssignment(e2, sn1);
1.63 - sn.addAssignment(e3, sn0);
1.64 - sn.addAssignment(e1, sn0);
1.65 - sn.addAssignment(e5, sn0);
1.66 -
1.67 -
1.68 -
1.69 - on0=othernetwork.addNode();
1.70 -
1.71 - cout << "ID of a node from a different graph: " << subnetwork.id(on0) << endl;
1.72 - cout << "ID of a node in its graph: " << othernetwork.id(on0) << endl;
1.73 - cout << "ID of a node from a graph: " << subnetwork.id(sn0) << endl;
1.74 -
1.75 - ListGraph::NodeIt snni;
1.76 - //ListGraph::Node snn;
1.77 -
1.78 - for(subnetwork.first(snni);subnetwork.valid(snni);subnetwork.next(snni))
1.79 - {
1.80 - if(snni==on0)
1.81 - {
1.82 - cout << "Nem jo, megtalalta az idegen node-ot sajat haloban, pedig azt nem szabad!!!"
1.83 - << subnetwork.id(snni) << subnetwork.id(on0) << othernetwork.id(snni) << othernetwork.id(on0) << endl;
1.84 - }
1.85 - else cout << "ID:" << subnetwork.id(snni) << endl;
1.86 -
1.87 - }
1.88 -
1.89 -
1.90 - HGr.subnetworks[n0]=sn;
1.91 -
1.92 -}