-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtopnet.cpp
More file actions
940 lines (715 loc) · 19.4 KB
/
Copy pathtopnet.cpp
File metadata and controls
940 lines (715 loc) · 19.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
/*
* topnetData.cpp
* topicNet
*
* Created by basak alper on 5/21/10.
* Copyright 2010 ucsb. All rights reserved.
*
*/
#include <fstream>
#include <iostream>
#include <sstream>
#include "topnet.h"
#include "xmlparse.h"
using namespace std;
Topicnet :: Topicnet()
{
dummynames = new string[200];
grid = new Grid(10, AREA);
graph = new Graph();
layoutScheme = FR_Layout(550, AREA, 3.0); //numiter, area, temparature
Plane * base = new Plane(0, 0.0); //id of the first plane is 0
planes.push_back(base);
}
Topicnet :: ~Topicnet()
{
//delete dynamic arrays
}
void Topicnet :: loadAuthorData(const char * filePath){
graph->clear();
string path = (string) filePath;
size_t found = path.find_last_of("/");
path = path.substr(0,found);
//printf("path of file : %s \n", path.c_str());
TiXmlDocument doc(filePath);
bool loadOkay = doc.LoadFile();
if (loadOkay)
{
printf("\n%s:\n", filePath);
srand(5);
dump_to_graph2( &doc );
}
else
{
printf("Failed to load file \"%s\"\n", filePath);
}
printf("loaded graph with %d nodes and %d edges \n", graph->getNumNodes(), graph->getNumEdges());
graph -> preprocessauthorgraph();
loadArticlesData(path);
//graph -> connectedcomponent("P335624"); //train data
//graph -> connectedcomponent("P268230");
//graph -> connectedcomponent("P643612");
//graph -> outputGraphXML("/Users/basakalper/luaav4/trunk/modules/topicnet/scripts/data/coauthor_test.xml");
//printf("%s : current working directory \n", getcwd(NULL, 0));
//printf("subgraph %d nodes and %d edges \n", graph->getNumNodes(), graph->getNumEdges());
grid -> addGraph(graph);
}
void Topicnet :: loadGraphMLdata(const char * filePath){
graph->clear();
string path = (string) filePath;
size_t found = path.find_last_of("/");
path = path.substr(0,found);
//printf("path of file : %s \n", path.c_str());
TiXmlDocument doc(filePath);
bool loadOkay = doc.LoadFile();
if (loadOkay)
{
printf("\n%s:\n", filePath);
srand(5);
dump_to_graph3( &doc );
}
else
{
printf("Failed to load file \"%s\"\n", filePath);
}
printf("loaded graph with %d nodes and %d edges \n", graph->getNumNodes(), graph->getNumEdges());
graph -> preprocessgraphml();
}
void Topicnet :: loadFaceData(const char * filePath){
graph->clear();
//load dummy names to replace
/**/
string path = (string) filePath;
size_t found = path.find_last_of("/");
path = path.substr(0,found);
string nmfile = path + "/names.txt";
printf("path of file : %s \n", path.c_str());
ifstream myfile;
myfile.open (nmfile.c_str());
string ad, soyad;
if (!myfile){
printf("Error in openening names file \n");
}
int nm= 0;
while (!myfile.eof( ) && nm<200){
myfile >> ad >> soyad;
dummynames[nm] = ad;
//printf("name: %s at: %d \n", ad.c_str(), nm);
nm++;
}
myfile.close();
/**/
TiXmlDocument doc(filePath);
bool loadOkay = doc.LoadFile();
if (loadOkay)
{
printf("\n%s:\n", filePath);
srand(5);
dump_to_graph( &doc );
}
else
{
printf("Failed to load file \"%s\"\n", filePath);
}
printf("loaded graph with %d nodes and %d edges \n", graph->getNumNodes(), graph->getNumEdges());
graph -> preprocess();
graph -> normalizeinitpos();
}
void Topicnet :: dump_to_graph( TiXmlNode* pParent, unsigned int indent){
if ( !pParent ) return;
TiXmlNode* pChild;
TiXmlText* pText;
int t = pParent->Type();
//printf( "%s", getIndent(indent)); //prints a +
initializeEnums();
initializeAttributeEnums();
//initializeNodeEnums();
//initializeEdgeEnums();
switch ( t )
{
case TiXmlNode::TINYXML_DOCUMENT:
printf( "Document \n" );
break;
case TiXmlNode::TINYXML_ELEMENT:
switch(s_mapElements[pParent->Value()])
{
case DNVGRAPH:
printf("graph \n");
break;
case NODEPROPERTY:
//printf("NODEPROPERTY skipped \n");
break;
case DNVNODE:{
//printf("node \n");
TiXmlElement* pElement = pParent->ToElement();
TiXmlAttribute* pAttrib=pElement->FirstAttribute();
int idd, lev, nmind;
string lab;
string type;
vec3d pos;
space::Vec3f clr;
while (pAttrib)
{
//printf("pAttrib->Name: %s \n", pAttrib->Name());
switch(s_map_attributes[pAttrib->Name()])
{
case Id:
idd = atoi(pAttrib->Value());
//printf("node id %i \n", idd);
break;
case Level:
lev = atoi(pAttrib->Value());
break;
case Color:{
StringVector clrstr = stringsFrom(pAttrib->Value());
clrstr[0].erase (0,1);
clr.set(atof(clrstr[0].c_str()), atof(clrstr[1].c_str()), atof(clrstr[2].c_str()));
//printf("color %f, %f, %f \n", clr[0], clr[1], clr[2]);
break;
}
case Position:{
StringVector posstr = stringsFrom(pAttrib->Value());
posstr[0].erase (0,1);
double xpos = atof(posstr[0].c_str());
double ypos = atof(posstr[1].c_str());
double zpos = 0.0;
pos.set(xpos, ypos, zpos);
//pos.set(xpos, ypos, zpos);
//printf("position %f, %f \n", pos[0], pos[1]);
break;
}
case Label:
lab = pAttrib->Value();
//instead pick something from dummy names
nmind = (int)(rand()%200);
lab = dummynames[nmind];
break;
case Type:
type = pAttrib->Value();
break;
case Size:
case Active:
case Icon:
case Mass:
case Fixed:
case BBid:
case ForceLabel:
case Alpha:
case LabelColor:
case LabelOutlineColor:
case OutlineColor:
case LabelSize:
case Expandable:
case Visible:
case CurvedLabel:
case HideLabelBackground:
//nothing for now
break;
default:
break;
}
//printf( "attributes: %s: value=%s \n", pAttrib->Name(), pAttrib->Value());
pAttrib=pAttrib->Next();
}
GraphNode * nd = new GraphNode(idd, lev, pos, lab, clr);
if (type == "user")
nd->setType(0);
else if(type =="friend")
nd->setType(1);
else if(type =="music")
nd->setType(2);
else //"notset"
nd->setType(3);
graph->addGraphNode(nd);
break;
}
case DNVEDGE:{
//printf("edge \n");
TiXmlElement* pElement = pParent->ToElement();
TiXmlAttribute* pAttrib=pElement->FirstAttribute();
int idd, lev, from, to;
double leng, rig;
while (pAttrib)
{
switch(s_map_attributes[pAttrib->Name()])
{
case Id:
idd = atoi(pAttrib->Value());
break;
case Level:
lev = atoi(pAttrib->Value());
break;
case Length:
leng = atof(pAttrib->Value());
break;
case Rigid:
rig = atof(pAttrib->Value());
break;
case From:
from = atoi(pAttrib->Value());
//printf("from %i \n", from);
break;
case To:
to = atoi(pAttrib->Value());
//printf("to %i \n", to);
break;
case Label:
case Directional:
case BBid:
case Color:
case Type:
case HasSetColor:
case Alpha:
case LabelColor:
case LabelOutlineColor:
case LabelSize:
case Thickness:
case Visible:
//nothing for now
break;
default:
break;
}
pAttrib=pAttrib->Next();
}
GraphEdge * eg = new GraphEdge(idd, leng, from, to);
graph->addGraphEdge(eg);
break;
}
default:
printf("ERROR: unknown type element \n");
break;
}
break;
case TiXmlNode::TINYXML_COMMENT:
printf( "Comment: [%s]", pParent->Value());
break;
case TiXmlNode::TINYXML_UNKNOWN:
printf( "Unknown" );
break;
case TiXmlNode::TINYXML_TEXT:
pText = pParent->ToText();
printf( "Text: [%s]", pText->Value() );
break;
case TiXmlNode::TINYXML_DECLARATION:
printf( "Declaration" );
break;
default:
break;
}
for ( pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling())
{
dump_to_graph( pChild, indent+1 );
}
}
void Topicnet :: dump_to_graph3(TiXmlNode* pParent, unsigned int indent){
if ( !pParent ) return;
TiXmlNode* pChild;
int t = pParent->Type();
std::map<std::string, XMLKEYS> keymap;
keymap["graphmml"] = GRAPHML;
keymap["graph"] = GRAPH;
keymap["node"] = NODE;
keymap["edge"] = EDGE;
keymap["data"] = DATA;
keymap["key"] = KEY;
keymap["id"] = ID;
keymap["source"] = SOURCE;
keymap["target"] = TARGET;
string strid;
TiXmlElement* pElement;
TiXmlAttribute* pAttrib;
switch ( t )
{
case TiXmlNode::TINYXML_DOCUMENT:
printf( "Document \n" );
break;
case TiXmlNode::TINYXML_ELEMENT:
switch(keymap[pParent->Value()])
{
case GRAPHML:
printf("Begin graphml doc \n");
break;
case GRAPH:
printf("graph \n");
break;
case DATA:
//printf("graph \n");
break;
case NODE:{
//printf("node \n");
pElement = pParent->ToElement();
pAttrib=pElement->FirstAttribute();
if (pAttrib && keymap[pAttrib->Name()] == ID) {
strid = strid = pAttrib->Value();
int sz = graph->getSize();
//printf("node %i %s \n", sz, strid.c_str());
GraphNode * nd = new GraphNode(sz, strid, "");
graph->addGraphNode(nd);
}
break;
case EDGE:
pElement = pParent->ToElement();
pAttrib=pElement->FirstAttribute();
string to, from;
while (pAttrib)
{
switch(keymap[pAttrib->Name()])
{
case ID:
strid = pAttrib->Value();
break;
case SOURCE:
from = pAttrib->Value();
break;
case TARGET:
to = pAttrib->Value();
break;
default:
break;
}
pAttrib=pAttrib->Next();
}
int sz = graph->getEdgeSize();
printf("edge %i %s %s \n", sz, from.c_str(), to.c_str());
GraphEdge * eg = new GraphEdge(sz, from, to);
graph->addGraphEdge(eg);
break;
}
break;
}
}
for ( pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling())
{
dump_to_graph3( pChild, indent+1 );
}
}
void Topicnet :: dump_to_graph2( TiXmlNode* pParent, unsigned int indent){
if ( !pParent ) return;
TiXmlNode* pChild;
TiXmlText* pText;
int t = pParent->Type();
initializeEnums();
initializeAttributeEnums();
switch ( t )
{
case TiXmlNode::TINYXML_DOCUMENT:
printf( "Document \n" );
break;
case TiXmlNode::TINYXML_ELEMENT:
switch(s_mapElements[pParent->Value()])
{
case DNVGRAPH:
printf("graph \n");
break;
case NODEPROPERTY:
//printf("NODEPROPERTY skipped \n");
break;
case DNVNODE:{
//printf("node \n");
TiXmlElement* pElement = pParent->ToElement();
TiXmlAttribute* pAttrib=pElement->FirstAttribute();
int intid;
string strid, label;
while (pAttrib)
{
//printf("pAttrib->Name: %s \n", pAttrib->Name());
switch(s_map_attributes[pAttrib->Name()])
{
case IntId:
intid = atoi(pAttrib->Value());
//printf("node id %i \n", idd);
break;
case Id:
strid = pAttrib->Value();
break;
case Label:
label = pAttrib->Value();
break;
default:
break;
}
pAttrib=pAttrib->Next();
}
//printf( "strid: %s, label: %s, id: %d \n", strid.c_str(), label.c_str(), intid);
GraphNode * nd = new GraphNode(intid, strid, label);
graph->addGraphNode(nd);
//store it in a map for easy access
author_by_id[strid] = nd;
//printf("stored author id= %s \n", strid.c_str());
break;
}
case DNVEDGE:{
//printf("edge \n");
TiXmlElement* pElement = pParent->ToElement();
TiXmlAttribute* pAttrib=pElement->FirstAttribute();
int intid;
string to, from;
while (pAttrib)
{
switch(s_map_attributes[pAttrib->Name()])
{
case Id:
intid = atoi(pAttrib->Value());
break;
case To:
to = pAttrib->Value();
break;
case From:
from = pAttrib->Value();
break;
default:
break;
}
pAttrib=pAttrib->Next();
}
GraphEdge * eg = new GraphEdge(intid, from, to);
graph->addGraphEdge(eg);
break;
}
default:
printf("ERROR: unknown type element \n");
break;
}
break;
case TiXmlNode::TINYXML_COMMENT:
printf( "Comment: [%s]", pParent->Value());
break;
case TiXmlNode::TINYXML_UNKNOWN:
printf( "Unknown" );
break;
case TiXmlNode::TINYXML_TEXT:
pText = pParent->ToText();
printf( "Text: [%s]", pText->Value() );
break;
case TiXmlNode::TINYXML_DECLARATION:
printf( "Declaration" );
break;
default:
break;
}
for ( pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling())
{
dump_to_graph2( pChild, indent+1 );
}
}
void Topicnet :: split(const string& s, char c, vector<string>& v) {
string::size_type i = 0;
string::size_type j = s.find(c);
while (j != string::npos) {
v.push_back(s.substr(i, j-i));
i = ++j;
j = s.find(c, j);
if (j == string::npos)
v.push_back(s.substr(i, s.length( )));
}
}
void Topicnet :: loadArticlesData(string filepath){
ifstream myfile;
string filename = filepath + "/articles_of_author.txt";
myfile.open (filename.c_str());
string author_id, pub_id, num_aut;
if (!myfile){
printf("Error in openening articles of authors file \n");
printf("filepath: %s \n", filename.c_str());
}
else {
while (!myfile.eof( )){
myfile >> author_id >> num_aut >> pub_id;
//string corrected = author_id+" "+num_aut+" "+pub_id;
//printf("%s \n", corrected.c_str());
Article * np;
if(article_by_id.count(pub_id) > 0 ){
np = article_by_id[pub_id];
}
else {
np = new Article(pub_id, 0);
article_by_id[pub_id] = np;
}
np -> addAuthor(author_id);
if(author_by_id.count(author_id) > 0 ){
author_by_id[author_id] -> addPub(np);
//printf("loadArticlesData :: author: %s, pub: %s \n", author_id.c_str(), pub_id.c_str());
}
else {
//printf("%s loadArticlesData :: ooops! not existing author encountered! \n", author_id.c_str());
}
}
}
myfile.close();
//after you create article objects with specific id's, now load the articles info file
filename = filepath + "/articles_Info.txt";
myfile.open (filename.c_str());
if (!myfile){
printf("Error in openening articles Info file \n");
printf("filepath: %s \n", filename.c_str());
}
else {
string firstline, line;
getline(myfile, firstline); //discard first line
int pbs = 0;
while (!myfile.eof( )){
pbs++;
getline(myfile, line);
vector<string> sv;
split(line, '\t', sv);
if (sv.size() > 0 ) {
//printf(" %i: %s \n", pbs, sv.at(1).c_str());
string article_id = sv.at(1);
string title = sv.at(2);
string venue = sv.at(4);
if (article_by_id.count(article_id) > 0) {
Article * a = article_by_id[article_id];
a -> setTitle(title);
a -> setVenue(venue);
}
}
}
}
}
vec3d Topicnet :: getgraphnodepos(int ind){
if (ind>-1 && ind < graph->getSize()) {
GraphNode * gn = graph->getGraphNode(ind);
vec3d p = gn->getPos();
return p;
}
else{
return vec3d(0., 0., 0.);
}
}
void Topicnet :: addPlane(double depth){
Plane * newplane = new Plane(planes.size(), depth);
planes.push_back(newplane);
}
void Topicnet :: removePlane(){
//also need to push down all nodes on this plane
if (planes.size() > 1) { //should not remove the first plane
Plane * removeplane = planes.at(planes.size() - 1);
vector<GraphNode *> putback = removeplane->nodesonplane;
for (int p=0; p<putback.size(); p++) {
GraphNode * pbn = putback.at(p);
pbn -> setPosZ(0.0);
pbn -> setPlane(0);
}
planes.pop_back();
}
}
void Topicnet :: setPlaneDepth(int planeid, double depth){
Plane * theplane = planes.at(planeid);
if (theplane) {
theplane -> setdepth(depth);
}
}
double Topicnet::getPlaneDepth (int planeid){
double depth;
Plane * theplane = planes.at(planeid);
if (theplane) {
depth = theplane -> getdepth();
}
return depth;
}
void Topicnet :: addNodeToPlane(int planeid, int nodeid){
if (planeid < 0 || planeid > planes.size()-1) {
printf("Topicnet :: addNodeToPlane planeid out of bounds \n");
}
GraphNode * gn = graph->getGraphNode(nodeid);
int oldplaneid = gn->getPlane();
if (oldplaneid > 0) {
//have to remove from the old plane
//printf("oldplaneid %d \n", oldplaneid);
Plane * oldplane = planes.at(oldplaneid);
oldplane -> removeGraphNode(gn);
}
gn->setPlane(planeid);
Plane * theplane = planes.at(planeid);
theplane->addGraphNode(gn);
gn->setPosZ(theplane->getdepth());
}
void Topicnet :: movePlane(int planeid, double amount){
Plane * theplane = planes.at(planeid);
double depth = theplane -> getdepth();
depth += amount;
theplane -> setdepth(depth);
//move all the nodes on the plane with it
for (int n=0; n<theplane->nodesonplane.size(); n++) {
GraphNode * gn = theplane->nodesonplane.at(n);
gn->setPosZ(depth);
}
}
void Topicnet :: bringN1(int nodeid){
GraphNode * gn = graph->getGraphNode(nodeid);
int nodesplane = gn->getPlane();
Plane * pln = planes.at(nodesplane);
vector<GraphNode * > nghnodes = graph -> firstNghbrs(nodeid);
vector<GraphNode * > interimnodes;
bool interim = false;
double oldplanedepth;
for (int n=0; n<nghnodes.size(); n++) {
vec3d point = nghnodes.at(n)->getPos();
//check if the node is already sitting on a plane
int crrplane = nghnodes.at(n)->getPlane();
if (crrplane > 0) {
//then has to create and intermediary
interim = true;
interimnodes.push_back(nghnodes.at(n));
oldplanedepth = planes.at(crrplane) -> getdepth();
}
point.z = pln->getdepth();
nghnodes.at(n)->setPos(point);
nghnodes.at(n)->setPlane(pln->getplaneid());
pln -> addGraphNode(nghnodes.at(n));
}
if (interim) {
//move interim nodes to a middle plane
//for now I assume the depth of middle plane to be 2.0
double middepth = (oldplanedepth + pln->getdepth()) * 0.5;
//printf("mid depth = %f \n", middepth);
addPlane(middepth);
Plane * interp = planes.back();
for (int it=0; it<interimnodes.size(); it++) {
GraphNode * ign = interimnodes.at(it);
int oldplaneid = ign->getPlane();
if (oldplaneid > 0) {
Plane * oldplane = planes.at(oldplaneid);
oldplane -> removeGraphNode(gn);
}
ign->setPlane(interp->getplaneid());
interp->addGraphNode(ign);
ign->setPosZ(interp->getdepth());
}
}
}
void Topicnet :: setgraphnodepos(int ind, vec3d p){
if (ind>-1 && ind < graph->getSize()) {
GraphNode * gn = graph->getGraphNode(ind);
gn -> setPos(p);
}
}
string Topicnet :: graphnodelabel(int ind){
if (ind>-1 && ind < graph->getSize()) {
GraphNode * gn = graph->getGraphNode(ind);
string lab = gn->getLabel();
return lab;
}
else{
string l = "na";
return l;
}
}
void Topicnet :: initgraphlayout(){
layoutScheme.calculateK(graph);
}
void Topicnet :: steplayout(bool threed, double cool){
layoutScheme.step(threed, cool, graph, grid);
}
void Topicnet :: dolayout(){
layoutScheme.layout(graph, grid);
}
void Topicnet :: getgraphnodegridindex(int gind, int &i, int &j, int &k){
GraphNode * gn = graph->getGraphNode(gind);
grid->getgridindex(gn->getPos(), i, j, k);
}
void Topicnet :: drawgraph(){
//grid->drawGrid();
graph -> draw();
}