Skip to content

Commit 25e853c

Browse files
author
MatteolusBucket
committed
add element to node and maps
1 parent 255cf25 commit 25e853c

21 files changed

+585
-208
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
leveldb/
13
*.cbp
24
Parser
35
SVG_plotter

CMakeLists.txt

+6-4
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ set(PROJECT_DESCRIPTION "VisualSuffixTree: Visual tool for Suffix Tree visualiza
1313

1414
set(CMAKE_CXX_STANDARD 11)
1515

16+
add_subdirectory(leveldb)
17+
1618
#Used for the sdsl library
1719
include_directories($ENV{HOME}/include)
1820
link_directories($ENV{HOME}/lib)
1921

2022

2123
#add_executable(VisualSuffixTree src/main.cpp src/SvgCreator.cpp src/SvgCreator.h src/TreeParser.cpp src/TreeParser.h src/ConfigParser.cpp src/ConfigParser.h src/NodeInfoStructure.cpp src/NodeInfoStructure.h src/NodeInfo.cpp src/NodeInfo.h src/Header.cpp src/Header.h src/Header.h src/TreeParser.h src/SvgCreator.h src/NodeInfo.h src/NodeInfoStructure.h src/ConfigParser.h src/BitIo.h src/ObjNode.h src/ObjNode.cpp src/Utils.h src/SvgUtils.h src/SvgObject/StatusBar.cpp src/SvgObject/StatusBar.h)
22-
add_executable(Parser src/tree_parser.cpp src/SvgCreator.cpp src/SvgCreator.h src/TreeParser.cpp src/TreeParser.h src/ConfigParser.cpp src/ConfigParser.h src/NodeInfoStructure.cpp src/NodeInfoStructure.h src/NodeInfo.cpp src/NodeInfo.h src/Header.cpp src/Header.h src/Header.h src/TreeParser.h src/SvgCreator.h src/NodeInfo.h src/NodeInfoStructure.h src/ConfigParser.h src/BitIo.h src/ObjNode.h src/ObjNode.cpp src/utils/Utils.hpp src/SvgUtils.h src/SvgObject/StatusBar.cpp src/SvgObject/StatusBar.h src/utils/Utils.cpp src/logger/Logger.cpp src/logger/Logger.h src/nodeMap/NodesMap.cpp src/nodeMap/NodesMap.h src/node/Node.cpp src/node/Node.h)
23-
add_executable(SVG_plotter src/svg_plotter src/SvgCreator.cpp src/SvgCreator.h src/TreeParser.cpp src/TreeParser.h src/ConfigParser.cpp src/ConfigParser.h src/NodeInfoStructure.cpp src/NodeInfoStructure.h src/NodeInfo.cpp src/NodeInfo.h src/Header.cpp src/Header.h src/Header.h src/TreeParser.h src/SvgCreator.h src/NodeInfo.h src/NodeInfoStructure.h src/ConfigParser.h src/BitIo.h src/ObjNode.h src/ObjNode.cpp src/utils/Utils.hpp src/SvgUtils.h src/SvgObject/StatusBar.cpp src/SvgObject/StatusBar.h src/utils/Utils.cpp src/logger/Logger.cpp src/logger/Logger.h src/node/Node.cpp src/node/Node.h)
24+
add_executable(Parser src/tree_parser.cpp src/SvgCreator.cpp src/SvgCreator.h src/TreeParser.cpp src/TreeParser.h src/ConfigParser.cpp src/ConfigParser.h src/NodeInfoStructure.cpp src/NodeInfoStructure.h src/NodeInfo.cpp src/NodeInfo.h src/Header.cpp src/Header.h src/Header.h src/TreeParser.h src/SvgCreator.h src/NodeInfo.h src/NodeInfoStructure.h src/ConfigParser.h src/BitIo.h src/ObjNode.h src/ObjNode.cpp src/utils/Utils.hpp src/SvgUtils.h src/SvgObject/StatusBar.cpp src/SvgObject/StatusBar.h src/utils/Utils.cpp src/logger/Logger.cpp src/logger/Logger.h src/nodeMap/NodesMap.cpp src/nodeMap/NodesMap.h src/node/Node_2.cpp src/node/Node_2.h)
25+
add_executable(SVG_plotter src/svg_plotter src/SvgCreator.cpp src/SvgCreator.h src/TreeParser.cpp src/TreeParser.h src/ConfigParser.cpp src/ConfigParser.h src/NodeInfoStructure.cpp src/NodeInfoStructure.h src/NodeInfo.cpp src/NodeInfo.h src/Header.cpp src/Header.h src/Header.h src/TreeParser.h src/SvgCreator.h src/NodeInfo.h src/NodeInfoStructure.h src/ConfigParser.h src/BitIo.h src/ObjNode.h src/ObjNode.cpp src/utils/Utils.hpp src/SvgUtils.h src/SvgObject/StatusBar.cpp src/SvgObject/StatusBar.h src/utils/Utils.cpp src/logger/Logger.cpp src/logger/Logger.h src/node/Node_2.cpp src/node/Node_2.h)
2426

2527
#target_link_libraries(VisualSuffixTree sdsl divsufsort divsufsort64)
26-
target_link_libraries(Parser sdsl divsufsort divsufsort64)
27-
target_link_libraries(SVG_plotter sdsl divsufsort divsufsort64)
28+
target_link_libraries(Parser sdsl divsufsort divsufsort64 leveldb)
29+
target_link_libraries(SVG_plotter sdsl divsufsort divsufsort64 leveldb)

README.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,16 @@ cd VisualSuffixTree
3636
```
3737

3838
Now we shoud be in the project's top folder.
39-
Build the project:
39+
40+
Download inside the project folder the levelDB library
41+
```
42+
git clone https://github.com/google/leveldb.git
43+
cd leveldb
44+
mkdir -p build && cd build
45+
cmake -DCMAKE_BUILD_TYPE=Release .. && cmake --build .
46+
```
47+
48+
Now build the project:
4049
```
4150
cmake CMakeLists.txt
4251
make
@@ -63,6 +72,10 @@ example: ./SVG_plotter -in input_fileName
6372

6473
The Succinct Data Structure Library (SDSL) is a powerful and flexible C++11 library implementing succinct data structures. In total, the library contains the highlights of 40 research publications. Succinct data structures can represent an object (such as a bitvector or a tree) in space close to the information-theoretic lower bound of the object while supporting operations of the original object efficiently. The theoretical time complexity of an operation performed on the classical data structure and the equivalent succinct data structure are (most of the time) identical.
6574

75+
[LevelDB library](https://github.com/google/leveldb.git)
76+
77+
LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.
78+
6679
### License
6780

6881
Open sourced under MIT license, the terms of which can be read here — [MIT License](http://opensource.org/licenses/MIT).

Settings/config.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
TYPE_NODE_DIMENSION=2
140140

141141
#--------------------------------------------------------------------------------------------------------
142-
# add info of the edge, this option is very busy
142+
# add info of the edgeIdx, this option is very busy
143143
#-------------------------------------------------------------------------------------------------------
144144
SHOW_EDGE_INFO=1
145145

src/NodeInfo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class NodeInfo {
3333

3434
void setEdgeLength(unsigned long n);
3535

36-
//codifica l'edge da stringa a binario
36+
//codifica l'edgeIdx da stringa a binario
3737
void setEdge(string *s);
3838

3939
void setEdgeCharacterEncoding(unsigned long n);

src/NodeInfoStructure.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class NodeInfoStructure {
5555
bool OPT_RB;
5656
bool OPT_LABEL;
5757
bool OPT_FATHERLABLE;
58-
bool OPT_EDGEINFO; //comprende la edge length e la edge characterEncoding
58+
bool OPT_EDGEINFO; //comprende la edgeIdx length e la edgeIdx characterEncoding
5959
bool OPT_CHILDREN_INFO;
6060

6161
int getBitDepth() {

src/SvgCreator.cpp

+19-19
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ SvgCreator::SvgCreator(char *inputFileName, char *outputFile, map<string, string
431431
//
432432
// //SETTINGS EDGE INFO
433433
// if (stoi(configParameter->at("SHOW_EDGE_INFO")) == 1) {
434-
// edge = nodeInfoObj.getEdge(nodeInfoObj.getEdgeIndex(), nodeInfoObj.getEdgeLength());
434+
// edgeIdx = nodeInfoObj.getEdge(nodeInfoObj.getEdgeIndex(), nodeInfoObj.getEdgeLength());
435435
// }
436436
//
437437
// //SETTING COLOR ACCORDING WITH WHAT I WANT TO SHOW
@@ -440,9 +440,9 @@ SvgCreator::SvgCreator(char *inputFileName, char *outputFile, map<string, string
440440
// long depthThreshold = stoi(configParameter->at("BASIC_DEPTH_THRESHOLD"));
441441
// if (stoi(configParameter->at("BASIC_DEPTH_WITH_THRESHOLD")) == 1) {
442442
// if (nodeInfoObj.getDepth() > depthThreshold) {
443-
// SvgUtils::printSvgNodeBlock(&svg_out, edge, w, x, y, H, blenchedRgbColor);
443+
// SvgUtils::printSvgNodeBlock(&svg_out, edgeIdx, w, x, y, H, blenchedRgbColor);
444444
// } else {
445-
// SvgUtils::printSvgNodeBlock(&svg_out, edge, w, x, y, H, rgbColor);
445+
// SvgUtils::printSvgNodeBlock(&svg_out, edgeIdx, w, x, y, H, rgbColor);
446446
// }
447447
// } else {
448448
// //COLOR WITH A DEPTH GRADIENT
@@ -455,9 +455,9 @@ SvgCreator::SvgCreator(char *inputFileName, char *outputFile, map<string, string
455455
//
456456
// if (nodeInfoObj.getDepth() >= BASIC_KVALUE_KMER &&
457457
// hashmap[nodeInfoObj.getFatherLabel()].getObjNodeDepth() < BASIC_KVALUE_KMER) { //Full color
458-
// SvgUtils::printSvgNodeBlock(&svg_out, edge, w, x, y, H, rgbColor);
458+
// SvgUtils::printSvgNodeBlock(&svg_out, edgeIdx, w, x, y, H, rgbColor);
459459
// } else { //Blenched
460-
// SvgUtils::printSvgNodeBlock(&svg_out, edge, w, x, y, H, blenchedRgbColor);
460+
// SvgUtils::printSvgNodeBlock(&svg_out, edgeIdx, w, x, y, H, blenchedRgbColor);
461461
// }
462462
//
463463
//
@@ -467,15 +467,15 @@ SvgCreator::SvgCreator(char *inputFileName, char *outputFile, map<string, string
467467
// blenchedHsvColor.v = 100;
468468
// blenchedHsvColor.s = (100 * frequency) / maxSuffixArrayLength + 40;
469469
//
470-
// SvgUtils::printSvgNodeBlock(&svg_out, edge, w, x, y, H, SvgUtils::HsvToRgb(blenchedHsvColor));
470+
// SvgUtils::printSvgNodeBlock(&svg_out, edgeIdx, w, x, y, H, SvgUtils::HsvToRgb(blenchedHsvColor));
471471
//
472472
// } else if (stoi(configParameter->at("BASIC_FREQUENCY_COLOR_TYPE")) == 2) {
473473
// //the node with a frequency lower than a setted thresold are bleached.
474474
// if ((frequency >= stoi(configParameter->at("BASIC_FREQUENCY_THRESHOLD"))) &&
475475
// (depth >= stoi(configParameter->at("BASIC_DEPTH_THRESHOLD")))) { //Full color
476-
// SvgUtils::printSvgNodeBlock(&svg_out, edge, w, x, y, H, rgbColor);
476+
// SvgUtils::printSvgNodeBlock(&svg_out, edgeIdx, w, x, y, H, rgbColor);
477477
// } else { //Blenched
478-
// SvgUtils::printSvgNodeBlock(&svg_out, edge, w, x, y, H, blenchedRgbColor);
478+
// SvgUtils::printSvgNodeBlock(&svg_out, edgeIdx, w, x, y, H, blenchedRgbColor);
479479
// }
480480
// } else {
481481
// //deault
@@ -484,7 +484,7 @@ SvgCreator::SvgCreator(char *inputFileName, char *outputFile, map<string, string
484484
//
485485
// } else {
486486
// //default
487-
// SvgUtils::printSvgNodeBlock(&svg_out, edge, w, x, y, H, rgbColor);
487+
// SvgUtils::printSvgNodeBlock(&svg_out, edgeIdx, w, x, y, H, rgbColor);
488488
// }
489489
//
490490
//
@@ -603,13 +603,13 @@ SvgCreator::SvgCreator(char *inputFileName, char *outputFile, map<string, string
603603
// if (stoi(configParameter->at("SHOW_EDGE_INFO")) == 1) {
604604
// if (V.is_leaf) {
605605
// if (V.edge_length > stoi(configParameter->at("MAX_LEAF_CHAR"))) {
606-
// edge = nodeInfoObj.getEdge(V.edge_index, stoul(configParameter->at("MAX_LEAF_CHAR")));
607-
// edge += "...";
606+
// edgeIdx = nodeInfoObj.getEdge(V.edge_index, stoul(configParameter->at("MAX_LEAF_CHAR")));
607+
// edgeIdx += "...";
608608
// } else {
609-
// edge = nodeInfoObj.getEdge(V.edge_index, V.edge_length);
609+
// edgeIdx = nodeInfoObj.getEdge(V.edge_index, V.edge_length);
610610
// }
611611
// } else {
612-
// edge = nodeInfoObj.getEdge(V.edge_index, V.edge_length);
612+
// edgeIdx = nodeInfoObj.getEdge(V.edge_index, V.edge_length);
613613
// }
614614
// }
615615
//
@@ -618,29 +618,29 @@ SvgCreator::SvgCreator(char *inputFileName, char *outputFile, map<string, string
618618
// //SETTING COLOR ACCORDING WITH WHAT I WANT TO SHOW
619619
// if (configParameter->at("MAXREP_MODALITY") == "frequency") {
620620
// if (V.maxrep_type == MAXREP_TYPE::non_supermaximal) {
621-
// SvgUtils::printSvgNodeBlock2(&svg_out, edge, V.w, V.posX, V.posY, H,
621+
// SvgUtils::printSvgNodeBlock2(&svg_out, edgeIdx, V.w, V.posX, V.posY, H,
622622
// configParameter->at("MAXREP_NONMAXREP_COLOR"), 1);
623623
// } else {
624-
// SvgUtils::printSvgNodeBlock2(&svg_out, edge, V.w, V.posX, V.posY, H,
624+
// SvgUtils::printSvgNodeBlock2(&svg_out, edgeIdx, V.w, V.posX, V.posY, H,
625625
// configParameter->at("MAXREP_MAXREP_COLOR"), V.opacity);
626626
// }
627627
// } else if (configParameter->at("MAXREP_MODALITY") == "type") {
628628
//
629629
// switch (V.maxrep_type) {
630630
// case MAXREP_TYPE::non_supermaximal :
631-
// SvgUtils::printSvgNodeBlock2(&svg_out, edge, V.w, V.posX, V.posY, H,
631+
// SvgUtils::printSvgNodeBlock2(&svg_out, edgeIdx, V.w, V.posX, V.posY, H,
632632
// configParameter->at("MAXREP_NONMAXREP_COLOR"), V.opacity);
633633
// break;
634634
// case MAXREP_TYPE::maxrep :
635-
// SvgUtils::printSvgNodeBlock2(&svg_out, edge, V.w, V.posX, V.posY, H,
635+
// SvgUtils::printSvgNodeBlock2(&svg_out, edgeIdx, V.w, V.posX, V.posY, H,
636636
// configParameter->at("MAXREP_MAXREP_COLOR"), V.opacity);
637637
// break;
638638
// case MAXREP_TYPE::nearsupermaximal :
639-
// SvgUtils::printSvgNodeBlock2(&svg_out, edge, V.w, V.posX, V.posY, H,
639+
// SvgUtils::printSvgNodeBlock2(&svg_out, edgeIdx, V.w, V.posX, V.posY, H,
640640
// configParameter->at("MAXREP_NEARSUPERMAXIMAL_COLOR"), V.opacity);
641641
// break;
642642
// case MAXREP_TYPE::supermaximalrep :
643-
// SvgUtils::printSvgNodeBlock2(&svg_out, edge, V.w, V.posX, V.posY, H,
643+
// SvgUtils::printSvgNodeBlock2(&svg_out, edgeIdx, V.w, V.posX, V.posY, H,
644644
// configParameter->at("MAXREP_SUPERMAXIMAL_COLOR"), V.opacity);
645645
// break;
646646
// default :

src/SvgCreator.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -604,12 +604,12 @@ class SvgCreator {
604604

605605
//CHECK EDGE AVAILABILITY
606606
if (stoi(configParameter->at("SHOW_EDGE_INFO")) == 1) {
607-
//show edge info if available
607+
//show edgeIdx info if available
608608
if (nodeInfoStructure->OPT_EDGEINFO) {
609609
//ok
610610
} else {
611-
//the edge info is not available
612-
printf("The edge info isn't available");
611+
//the edgeIdx info is not available
612+
printf("The edgeIdx info isn't available");
613613
configParameter->at("SHOW_EDGE_INFO") = "0";
614614
}
615615
} else {

0 commit comments

Comments
 (0)