Showing
11 changed files
with
260 additions
and
120 deletions
PaperGraph/ChartDialog.cpp
0 → 100644
PaperGraph/ChartDialog.h
0 → 100644
... | @@ -36,6 +36,11 @@ void GraphItem::read_more() | ... | @@ -36,6 +36,11 @@ void GraphItem::read_more() |
36 | auto node_label_map = boost::get(vertex_name, *graph); | 36 | auto node_label_map = boost::get(vertex_name, *graph); |
37 | auto node_type_map = boost::get(vertex_type, *graph); | 37 | auto node_type_map = boost::get(vertex_type, *graph); |
38 | auto node_citation_map = boost::get(vertex_citation, *graph); | 38 | auto node_citation_map = boost::get(vertex_citation, *graph); |
39 | + auto node_pagerank_map = boost::get(vertex_pagerank, *graph); | ||
40 | + auto node_category_map = boost::get(vertex_category, *graph); | ||
41 | + auto node_title_map = boost::get(vertex_title, *graph); | ||
42 | + auto node_year_map = boost::get(vertex_year, *graph); | ||
43 | + auto node_category_accuracy_map = boost::get(vertex_category_accuracy, *graph); | ||
39 | 44 | ||
40 | int line_cnt = 0; | 45 | int line_cnt = 0; |
41 | qDebug() << "* graph reading start"; | 46 | qDebug() << "* graph reading start"; |
... | @@ -116,8 +121,7 @@ void GraphItem::read_more() | ... | @@ -116,8 +121,7 @@ void GraphItem::read_more() |
116 | //Paper일 경우 | 121 | //Paper일 경우 |
117 | //vertex type 설정 | 122 | //vertex type 설정 |
118 | boost::put(vertex_type, *graph, *vi, NODE_TYPE::NODE_PAPER); | 123 | boost::put(vertex_type, *graph, *vi, NODE_TYPE::NODE_PAPER); |
119 | - | 124 | +#ifdef CITATION_COUNT |
120 | - //citation counting | ||
121 | //bibtex 다운로드 | 125 | //bibtex 다운로드 |
122 | std::string dblp_url = std::string("http://dblp.uni-trier.de/rec/bib1/") + node_label; | 126 | std::string dblp_url = std::string("http://dblp.uni-trier.de/rec/bib1/") + node_label; |
123 | _curl_processor.set_url(dblp_url.c_str()); | 127 | _curl_processor.set_url(dblp_url.c_str()); |
... | @@ -137,6 +141,7 @@ void GraphItem::read_more() | ... | @@ -137,6 +141,7 @@ void GraphItem::read_more() |
137 | _curl_processor.set_url(json_address.c_str()); | 141 | _curl_processor.set_url(json_address.c_str()); |
138 | _curl_processor.perform(); | 142 | _curl_processor.perform(); |
139 | 143 | ||
144 | + //citation 카운트 | ||
140 | _json_processor.read_json(_curl_processor.get_buffer()); | 145 | _json_processor.read_json(_curl_processor.get_buffer()); |
141 | if (!_json_processor.is_ok()) { | 146 | if (!_json_processor.is_ok()) { |
142 | node_citation_map[*vi] = 0; | 147 | node_citation_map[*vi] = 0; |
... | @@ -145,6 +150,20 @@ void GraphItem::read_more() | ... | @@ -145,6 +150,20 @@ void GraphItem::read_more() |
145 | node_citation_map[*vi] = _json_processor.get_citation_count(); | 150 | node_citation_map[*vi] = _json_processor.get_citation_count(); |
146 | } | 151 | } |
147 | } | 152 | } |
153 | + | ||
154 | + //논문제목(title), year 등 기타정보 받아오기 | ||
155 | + std::string title, year_str; | ||
156 | + int year; | ||
157 | + _bibtex_processor.get_value("title", title); | ||
158 | + _bibtex_processor.get_value("year", year_str); | ||
159 | + year = stoi(year_str); | ||
160 | + node_title_map[*vi] = title; | ||
161 | + node_year_map[*vi] = year; | ||
162 | +#endif // CITATION_COUNT | ||
163 | + | ||
164 | + //카테고리 계산 및 accuracy 계산 | ||
165 | + //--> case insensitive | ||
166 | + | ||
148 | } else { | 167 | } else { |
149 | //Author | 168 | //Author |
150 | boost::put(vertex_type, *graph, *vi, NODE_TYPE::NODE_AUTHOR); | 169 | boost::put(vertex_type, *graph, *vi, NODE_TYPE::NODE_AUTHOR); |
... | @@ -699,75 +718,75 @@ void GraphItem::topK_highlight_with_target() | ... | @@ -699,75 +718,75 @@ void GraphItem::topK_highlight_with_target() |
699 | delete[] topk_arr; | 718 | delete[] topk_arr; |
700 | } | 719 | } |
701 | 720 | ||
702 | -void GraphItem::topK_using_custom_score() | 721 | +//void GraphItem::topK_using_custom_score() |
703 | -{ | 722 | +//{ |
704 | - // 전체 그래프 기준 topK highlight | 723 | +// // 전체 그래프 기준 topK highlight |
705 | - | 724 | +// |
706 | - // 저자 노드별 실적 계산 | 725 | +// // 저자 노드별 실적 계산 |
707 | - vertex_iterator vi, vi_end; | 726 | +// vertex_iterator vi, vi_end; |
708 | - Graph::adjacency_iterator ai, ai_end; | 727 | +// Graph::adjacency_iterator ai, ai_end; |
709 | - | 728 | +// |
710 | - auto node_label_map = boost::get(vertex_name, *graph); | 729 | +// auto node_label_map = boost::get(vertex_name, *graph); |
711 | - auto node_type_map = boost::get(vertex_type, *graph); | 730 | +// auto node_type_map = boost::get(vertex_type, *graph); |
712 | - auto node_records_map = boost::get(vertex_record, *graph); | 731 | +// auto node_records_map = boost::get(vertex_record, *graph); |
713 | - | 732 | +// |
714 | - //k 입력 | 733 | +// //k 입력 |
715 | - bool isok = false; | 734 | +// bool isok = false; |
716 | - | 735 | +// |
717 | - QInputDialog *inputDialog = new QInputDialog(); | 736 | +// QInputDialog *inputDialog = new QInputDialog(); |
718 | - //int inputK = inputDialog->getText(nullptr, "Enter target's name", "Start node's name:", | 737 | +// //int inputK = inputDialog->getText(nullptr, "Enter target's name", "Start node's name:", |
719 | - // QLineEdit::Normal, "Akira Idoue", &isok).toStdString(); | 738 | +// // QLineEdit::Normal, "Akira Idoue", &isok).toStdString(); |
720 | - int inputK = inputDialog->getInt(nullptr, "Enter K", "K:", 3, | 739 | +// int inputK = inputDialog->getInt(nullptr, "Enter K", "K:", 3, |
721 | - 1, whole_node_cnt, 1, &isok); | 740 | +// 1, whole_node_cnt, 1, &isok); |
722 | - if (!isok) { | 741 | +// if (!isok) { |
723 | - qDebug("input cancelled"); | 742 | +// qDebug("input cancelled"); |
724 | - return; | 743 | +// return; |
725 | - } | 744 | +// } |
726 | - | 745 | +// |
727 | - //저자별 논문 수 계산 + TopK Heap 사용 | 746 | +// //저자별 논문 수 계산 + TopK Heap 사용 |
728 | - //pair -> <num_of_record, label> | 747 | +// //pair -> <num_of_record, label> |
729 | - TopKHeap<pair<int, string>> heap(inputK); | 748 | +// TopKHeap<pair<int, string>> heap(inputK); |
730 | - for (boost::tie(vi, vi_end) = boost::vertices(*graph); vi != vi_end; ++vi) { | 749 | +// for (boost::tie(vi, vi_end) = boost::vertices(*graph); vi != vi_end; ++vi) { |
731 | - if (node_type_map[*vi] != NODE_TYPE::NODE_AUTHOR) { | 750 | +// if (node_type_map[*vi] != NODE_TYPE::NODE_AUTHOR) { |
732 | - continue; | 751 | +// continue; |
733 | - } | 752 | +// } |
734 | - | 753 | +// |
735 | - int record_cnt = 0; | 754 | +// int record_cnt = 0; |
736 | - for (boost::tie(ai, ai_end) = boost::adjacent_vertices(*vi, *graph); | 755 | +// for (boost::tie(ai, ai_end) = boost::adjacent_vertices(*vi, *graph); |
737 | - ai != ai_end; ++ai) { | 756 | +// ai != ai_end; ++ai) { |
738 | - if (node_type_map[*ai] == NODE_TYPE::NODE_PAPER) { | 757 | +// if (node_type_map[*ai] == NODE_TYPE::NODE_PAPER) { |
739 | - ++record_cnt; | 758 | +// ++record_cnt; |
740 | - } | 759 | +// } |
741 | - } | 760 | +// } |
742 | - | 761 | +// |
743 | - boost::put(vertex_record, *graph, *vi, record_cnt); | 762 | +// boost::put(vertex_record, *graph, *vi, record_cnt); |
744 | - heap.push(make_pair(record_cnt, node_label_map[*vi])); | 763 | +// heap.push(make_pair(record_cnt, node_label_map[*vi])); |
745 | - | 764 | +// |
746 | - //qDebug() << record_cnt; | 765 | +// //qDebug() << record_cnt; |
747 | - } | 766 | +// } |
748 | - | 767 | +// |
749 | - //get top K records | 768 | +// //get top K records |
750 | - //pair<int, string> topk_arr[inputK]; | 769 | +// //pair<int, string> topk_arr[inputK]; |
751 | - pair<int, string> *topk_arr = new pair<int, string>[inputK]; | 770 | +// pair<int, string> *topk_arr = new pair<int, string>[inputK]; |
752 | - for (int i = 0; i < inputK; ++i) { | 771 | +// for (int i = 0; i < inputK; ++i) { |
753 | - topk_arr[i] = heap.pop(); | 772 | +// topk_arr[i] = heap.pop(); |
754 | - qDebug() << "topk[" << i << "] = " << topk_arr[i].first << ", " << QString::fromStdString(topk_arr[i].second); | 773 | +// qDebug() << "topk[" << i << "] = " << topk_arr[i].first << ", " << QString::fromStdString(topk_arr[i].second); |
755 | - } | 774 | +// } |
756 | - | 775 | +// |
757 | - | 776 | +// |
758 | - for (auto& n : nodeList) { | 777 | +// for (auto& n : nodeList) { |
759 | - auto label = n->getLabel(); | 778 | +// auto label = n->getLabel(); |
760 | - n->setColor(QColor(Qt::lightGray)); | 779 | +// n->setColor(QColor(Qt::lightGray)); |
761 | - for (int i = 0; i < inputK; ++i) { | 780 | +// for (int i = 0; i < inputK; ++i) { |
762 | - auto& p = topk_arr[i]; | 781 | +// auto& p = topk_arr[i]; |
763 | - if (label.toStdString() == p.second) { | 782 | +// if (label.toStdString() == p.second) { |
764 | - n->setColor(QColor(Qt::red)); | 783 | +// n->setColor(QColor(Qt::red)); |
765 | - break; | 784 | +// break; |
766 | - } | 785 | +// } |
767 | - } | 786 | +// } |
768 | - } | 787 | +// } |
769 | - delete[] topk_arr; | 788 | +// delete[] topk_arr; |
770 | -} | 789 | +//} |
771 | 790 | ||
772 | void GraphItem::find_shortest_path() | 791 | void GraphItem::find_shortest_path() |
773 | { | 792 | { |
... | @@ -892,6 +911,60 @@ void GraphItem::find_shortest_path() | ... | @@ -892,6 +911,60 @@ void GraphItem::find_shortest_path() |
892 | qDebug("* path highlighting end"); | 911 | qDebug("* path highlighting end"); |
893 | } | 912 | } |
894 | 913 | ||
914 | +void GraphItem::topk_with_pagerank() { | ||
915 | + //k 입력 | ||
916 | + bool isok = false; | ||
917 | + QInputDialog *inputDialog = new QInputDialog(); | ||
918 | + int inputK = inputDialog->getInt(nullptr, "Enter K", "K:", 3, | ||
919 | + 1, whole_node_cnt, 1, &isok); | ||
920 | + if (!isok) { | ||
921 | + qDebug("input cancelled"); | ||
922 | + return; | ||
923 | + } | ||
924 | + | ||
925 | + //전체노드 색 변경 | ||
926 | + for (auto& n : nodeList) { | ||
927 | + n->setColor(Qt::lightGray); | ||
928 | + } | ||
929 | + | ||
930 | + auto node_label_map = boost::get(vertex_name, *graph); | ||
931 | + auto node_pagerank_map = boost::get(vertex_pagerank, *graph); | ||
932 | + vertex_iterator vi, vi_end; | ||
933 | + | ||
934 | + //페이지랭크 계산 | ||
935 | + qDebug("* pagerank start"); | ||
936 | + boost::graph::page_rank(*graph, node_pagerank_map); | ||
937 | + for (boost::tie(vi, vi_end) = vertices(*graph); vi != vi_end; ++vi) { | ||
938 | + printf("%s\t\t%f\n", node_label_map[*vi].c_str(), | ||
939 | + node_pagerank_map[*vi]); | ||
940 | + } | ||
941 | + qDebug("* pagerank end"); | ||
942 | + | ||
943 | + //페이지랭크 topK 계산 | ||
944 | + TopKHeap<pair<double, string>> heap(inputK); | ||
945 | + for (boost::tie(vi, vi_end) = vertices(*graph); vi != vi_end; ++vi) { | ||
946 | + heap.push(make_pair(node_pagerank_map[*vi], node_label_map[*vi])); | ||
947 | + } | ||
948 | + pair<double, string> *topk_arr = new pair<double, string>[inputK]; | ||
949 | + for (int i = 0; i < inputK; ++i) { | ||
950 | + topk_arr[i] = heap.pop(); | ||
951 | + qDebug() << "topk[" << i << "] = " << topk_arr[i].first << ", " << QString::fromStdString(topk_arr[i].second); | ||
952 | + } | ||
953 | + | ||
954 | + for (auto& n : nodeList) { | ||
955 | + auto label = n->getLabel(); | ||
956 | + n->setColor(QColor(Qt::lightGray)); | ||
957 | + for (int i = 0; i < inputK; ++i) { | ||
958 | + auto& p = topk_arr[i]; | ||
959 | + if (label.toStdString() == p.second) { | ||
960 | + n->setColor(QColor(Qt::red)); | ||
961 | + break; | ||
962 | + } | ||
963 | + } | ||
964 | + } | ||
965 | + delete[] topk_arr; | ||
966 | +} | ||
967 | + | ||
895 | void GraphItem::reset_color() | 968 | void GraphItem::reset_color() |
896 | { | 969 | { |
897 | for (auto& n: nodeList) { | 970 | for (auto& n: nodeList) { | ... | ... |
... | @@ -8,6 +8,7 @@ | ... | @@ -8,6 +8,7 @@ |
8 | using namespace std; | 8 | using namespace std; |
9 | using namespace boost; | 9 | using namespace boost; |
10 | 10 | ||
11 | +//#define CITATION_COUNT | ||
11 | 12 | ||
12 | class GraphItem | 13 | class GraphItem |
13 | : public QGraphicsItem | 14 | : public QGraphicsItem |
... | @@ -29,8 +30,9 @@ public: | ... | @@ -29,8 +30,9 @@ public: |
29 | void might_know(); | 30 | void might_know(); |
30 | void topK_highlight_with_total(); | 31 | void topK_highlight_with_total(); |
31 | void topK_highlight_with_target(); | 32 | void topK_highlight_with_target(); |
32 | - void topK_using_custom_score(); | 33 | + //void topK_using_custom_score(); |
33 | void find_shortest_path(); | 34 | void find_shortest_path(); |
35 | + void topk_with_pagerank(); | ||
34 | void reset_color(); | 36 | void reset_color(); |
35 | 37 | ||
36 | //test | 38 | //test | ... | ... |
... | @@ -52,6 +52,9 @@ void MainWindow::createActions() | ... | @@ -52,6 +52,9 @@ void MainWindow::createActions() |
52 | findShortestPathAct = new QAction(tr("Find Shortest Path"), this); | 52 | findShortestPathAct = new QAction(tr("Find Shortest Path"), this); |
53 | findShortestPathAct->setStatusTip("Find shortest path between two node"); | 53 | findShortestPathAct->setStatusTip("Find shortest path between two node"); |
54 | connect(findShortestPathAct, &QAction::triggered, this, &MainWindow::find_shortest_path); | 54 | connect(findShortestPathAct, &QAction::triggered, this, &MainWindow::find_shortest_path); |
55 | + topkWithPagerankAct = new QAction(tr("topK with pagerank"), this); | ||
56 | + topkWithPagerankAct->setStatusTip(tr("highlight which is in top k pagerank in whole graph")); | ||
57 | + connect(topkWithPagerankAct, &QAction::triggered, this, &MainWindow::topk_with_pagerank); | ||
55 | 58 | ||
56 | resetColorAct = new QAction(tr("Reset colors"), this); | 59 | resetColorAct = new QAction(tr("Reset colors"), this); |
57 | resetColorAct->setStatusTip(tr("Reset all node's color")); | 60 | resetColorAct->setStatusTip(tr("Reset all node's color")); |
... | @@ -73,6 +76,7 @@ void MainWindow::createMenus() | ... | @@ -73,6 +76,7 @@ void MainWindow::createMenus() |
73 | actionMenu->addAction(topkWithTotalAct); | 76 | actionMenu->addAction(topkWithTotalAct); |
74 | actionMenu->addAction(topKWithTargetAct); | 77 | actionMenu->addAction(topKWithTargetAct); |
75 | actionMenu->addAction(findShortestPathAct); | 78 | actionMenu->addAction(findShortestPathAct); |
79 | + actionMenu->addAction(topkWithPagerankAct); | ||
76 | 80 | ||
77 | actionMenu->addAction(resetColorAct); | 81 | actionMenu->addAction(resetColorAct); |
78 | 82 | ||
... | @@ -109,6 +113,10 @@ void MainWindow::find_shortest_path() | ... | @@ -109,6 +113,10 @@ void MainWindow::find_shortest_path() |
109 | graphWidget->find_shortest_path(); | 113 | graphWidget->find_shortest_path(); |
110 | } | 114 | } |
111 | 115 | ||
116 | +void MainWindow::topk_with_pagerank() { | ||
117 | + graphWidget->topk_with_pagerank(); | ||
118 | +} | ||
119 | + | ||
112 | void MainWindow::reset_color() | 120 | void MainWindow::reset_color() |
113 | { | 121 | { |
114 | graphWidget->reset_color(); | 122 | graphWidget->reset_color(); | ... | ... |
... | @@ -25,6 +25,7 @@ private: | ... | @@ -25,6 +25,7 @@ private: |
25 | QAction *topkWithTotalAct; | 25 | QAction *topkWithTotalAct; |
26 | QAction *topKWithTargetAct; | 26 | QAction *topKWithTargetAct; |
27 | QAction *resetColorAct; | 27 | QAction *resetColorAct; |
28 | + QAction *topkWithPagerankAct; | ||
28 | QAction *findShortestPathAct; | 29 | QAction *findShortestPathAct; |
29 | 30 | ||
30 | //test | 31 | //test |
... | @@ -41,6 +42,7 @@ private slots: | ... | @@ -41,6 +42,7 @@ private slots: |
41 | void topK_with_total(); | 42 | void topK_with_total(); |
42 | void topK_with_target(); | 43 | void topK_with_target(); |
43 | void find_shortest_path(); | 44 | void find_shortest_path(); |
45 | + void topk_with_pagerank(); | ||
44 | void reset_color(); | 46 | void reset_color(); |
45 | //test | 47 | //test |
46 | void test(); | 48 | void test(); | ... | ... |
... | @@ -92,6 +92,9 @@ | ... | @@ -92,6 +92,9 @@ |
92 | <ClCompile Include="json_processor.cpp"> | 92 | <ClCompile Include="json_processor.cpp"> |
93 | <Filter>Source Files</Filter> | 93 | <Filter>Source Files</Filter> |
94 | </ClCompile> | 94 | </ClCompile> |
95 | + <ClCompile Include="ChartDialog.cpp"> | ||
96 | + <Filter>Source Files</Filter> | ||
97 | + </ClCompile> | ||
95 | </ItemGroup> | 98 | </ItemGroup> |
96 | <ItemGroup> | 99 | <ItemGroup> |
97 | <CustomBuild Include="PaperGraphWidget.h"> | 100 | <CustomBuild Include="PaperGraphWidget.h"> |
... | @@ -129,5 +132,8 @@ | ... | @@ -129,5 +132,8 @@ |
129 | <ClInclude Include="json_processor.h"> | 132 | <ClInclude Include="json_processor.h"> |
130 | <Filter>Header Files</Filter> | 133 | <Filter>Header Files</Filter> |
131 | </ClInclude> | 134 | </ClInclude> |
135 | + <ClInclude Include="ChartDialog.h"> | ||
136 | + <Filter>Header Files</Filter> | ||
137 | + </ClInclude> | ||
132 | </ItemGroup> | 138 | </ItemGroup> |
133 | </Project> | 139 | </Project> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -75,6 +75,11 @@ void PaperGraphWidget::find_shortest_path() | ... | @@ -75,6 +75,11 @@ void PaperGraphWidget::find_shortest_path() |
75 | scene->update(); | 75 | scene->update(); |
76 | } | 76 | } |
77 | 77 | ||
78 | +void PaperGraphWidget::topk_with_pagerank() { | ||
79 | + graphItem->topk_with_pagerank(); | ||
80 | + scene->update(); | ||
81 | +} | ||
82 | + | ||
78 | void PaperGraphWidget::reset_color() | 83 | void PaperGraphWidget::reset_color() |
79 | { | 84 | { |
80 | graphItem->reset_color(); | 85 | graphItem->reset_color(); | ... | ... |
... | @@ -19,6 +19,7 @@ public: | ... | @@ -19,6 +19,7 @@ public: |
19 | void topk_with_total(); | 19 | void topk_with_total(); |
20 | void topk_with_target(); | 20 | void topk_with_target(); |
21 | void find_shortest_path(); | 21 | void find_shortest_path(); |
22 | + void topk_with_pagerank(); | ||
22 | void reset_color(); | 23 | void reset_color(); |
23 | 24 | ||
24 | //test | 25 | //test | ... | ... |
... | @@ -3,47 +3,6 @@ | ... | @@ -3,47 +3,6 @@ |
3 | #include "MainWindow.h" | 3 | #include "MainWindow.h" |
4 | 4 | ||
5 | int main(int argc, char *argv[]) { | 5 | int main(int argc, char *argv[]) { |
6 | - //if (1) { | ||
7 | - // _curl_processor.set_url("http://dblp.uni-trier.de/rec/bib1/conf/sbrn/WedemannCD06"); | ||
8 | - // _curl_processor.perform(); | ||
9 | - // printf("%s", _curl_processor.get_buffer().c_str()); | ||
10 | - // | ||
11 | - // _bibtex_processor.read(_curl_processor.get_buffer()); | ||
12 | - // std::string doi; | ||
13 | - // _bibtex_processor.get_value("doi", doi); | ||
14 | - | ||
15 | - // std::string address = std::string("http://api.crossref.org/works/")+doi; | ||
16 | - // _curl_processor.set_url(address.c_str()); | ||
17 | - // _curl_processor.perform(); | ||
18 | - | ||
19 | - // printf("json: %s\n", _curl_processor.get_buffer().c_str()); | ||
20 | - | ||
21 | - // //rapidjson test | ||
22 | - // rapidjson::Document d; | ||
23 | - // d.Parse(_curl_processor.get_buffer().c_str()); | ||
24 | - | ||
25 | - // rapidjson::Value& value_status = d["status"]; | ||
26 | - // std::string status_str = value_status.GetString(); | ||
27 | - // printf("status: %s\n", status_str.c_str()); | ||
28 | - | ||
29 | - // if (status_str != "ok") { | ||
30 | - // printf("status: %s\n", status_str.c_str()); | ||
31 | - // printf("not ok\n"); | ||
32 | - // return 1; | ||
33 | - // } | ||
34 | - | ||
35 | - // rapidjson::Value& value_message = d["message"]; | ||
36 | - // rapidjson::Value& citation_count = value_message["is-referenced-by-count"]; | ||
37 | - // int cit_cnt = citation_count.GetInt(); | ||
38 | - // printf("citation: %d\n", cit_cnt); | ||
39 | - | ||
40 | - // // | ||
41 | - // rapidjson::Value& citation_count2 = d["message"]["is-referenced-by-count"]; | ||
42 | - // printf("%d\n", citation_count2.GetInt()); | ||
43 | - | ||
44 | - // return 0; | ||
45 | - //} | ||
46 | - | ||
47 | QApplication app(argc, argv); | 6 | QApplication app(argc, argv); |
48 | 7 | ||
49 | MainWindow m; | 8 | MainWindow m; | ... | ... |
... | @@ -16,9 +16,12 @@ | ... | @@ -16,9 +16,12 @@ |
16 | #include <qmath.h> | 16 | #include <qmath.h> |
17 | #include <QMessageBox> | 17 | #include <QMessageBox> |
18 | #include <QtGui> | 18 | #include <QtGui> |
19 | -#include <QtWidgets/QApplication> | ||
20 | -#include <QtWidgets/QWidget> | ||
21 | #include <QtWidgets> | 19 | #include <QtWidgets> |
20 | +#include <QtCharts/QChartView> | ||
21 | +#include <QtCharts/QBarSeries> | ||
22 | +#include <QtCharts/QBarSet> | ||
23 | +#include <QtCharts/QLegend> | ||
24 | +#include <QtCharts/QBarCategoryAxis> | ||
22 | 25 | ||
23 | #include <boost/algorithm/string.hpp> //boost::split | 26 | #include <boost/algorithm/string.hpp> //boost::split |
24 | #include <boost/bimap.hpp> | 27 | #include <boost/bimap.hpp> |
... | @@ -62,6 +65,8 @@ using bibtex::BibTeXEntry; | ... | @@ -62,6 +65,8 @@ using bibtex::BibTeXEntry; |
62 | using namespace boost; | 65 | using namespace boost; |
63 | using namespace std; | 66 | using namespace std; |
64 | 67 | ||
68 | +/* Qt namespaces */ | ||
69 | + | ||
65 | /* function declaration */ | 70 | /* function declaration */ |
66 | size_t write_callback(void *contents, size_t size, size_t nmemb, void *userp); | 71 | size_t write_callback(void *contents, size_t size, size_t nmemb, void *userp); |
67 | 72 | ||
... | @@ -69,15 +74,65 @@ size_t write_callback(void *contents, size_t size, size_t nmemb, void *userp); | ... | @@ -69,15 +74,65 @@ size_t write_callback(void *contents, size_t size, size_t nmemb, void *userp); |
69 | enum vertex_position_t { vertex_position }; | 74 | enum vertex_position_t { vertex_position }; |
70 | enum vertex_type_t { vertex_type }; | 75 | enum vertex_type_t { vertex_type }; |
71 | enum vertex_record_t { vertex_record }; | 76 | enum vertex_record_t { vertex_record }; |
72 | -enum vertex_citation_t { vertex_citation }; | 77 | +enum vertex_citation_t { vertex_citation }; //for paper |
73 | enum vertex_pagerank_t { vertex_pagerank }; | 78 | enum vertex_pagerank_t { vertex_pagerank }; |
79 | +enum vertex_category_t { vertex_category }; //for paper | ||
80 | +enum vertex_title_t { vertex_title }; //for paper | ||
81 | +enum vertex_year_t { vertex_year }; //for paper | ||
82 | +enum vertex_category_accuracy_t { vertex_category_accuracy }; //for paper | ||
74 | namespace boost { | 83 | namespace boost { |
75 | BOOST_INSTALL_PROPERTY(vertex, position); | 84 | BOOST_INSTALL_PROPERTY(vertex, position); |
76 | BOOST_INSTALL_PROPERTY(vertex, type); | 85 | BOOST_INSTALL_PROPERTY(vertex, type); |
77 | BOOST_INSTALL_PROPERTY(vertex, record); | 86 | BOOST_INSTALL_PROPERTY(vertex, record); |
78 | BOOST_INSTALL_PROPERTY(vertex, citation); | 87 | BOOST_INSTALL_PROPERTY(vertex, citation); |
79 | BOOST_INSTALL_PROPERTY(vertex, pagerank); | 88 | BOOST_INSTALL_PROPERTY(vertex, pagerank); |
89 | + BOOST_INSTALL_PROPERTY(vertex, category); | ||
90 | + BOOST_INSTALL_PROPERTY(vertex, title); | ||
91 | + BOOST_INSTALL_PROPERTY(vertex, year); | ||
92 | + BOOST_INSTALL_PROPERTY(vertex, category_accuracy); | ||
80 | } | 93 | } |
94 | +enum PAPER_CATEGORY { | ||
95 | + CS_AI, | ||
96 | + CS_CL, | ||
97 | + CS_CC, | ||
98 | + CS_CE, | ||
99 | + CS_CG, | ||
100 | + CS_GT, | ||
101 | + CS_CV, | ||
102 | + CS_CY, | ||
103 | + CS_CR, | ||
104 | + CS_DS, | ||
105 | + CS_DB, | ||
106 | + CS_DL, | ||
107 | + CS_DM, | ||
108 | + CS_DC, | ||
109 | + CS_ET, | ||
110 | + CS_FL, | ||
111 | + CS_GL, | ||
112 | + CS_GR, | ||
113 | + CS_AR, | ||
114 | + CS_HC, | ||
115 | + CS_IR, | ||
116 | + CS_IT, | ||
117 | + CS_LG, | ||
118 | + CS_LO, | ||
119 | + CS_MS, | ||
120 | + CS_MA, | ||
121 | + CS_MM, | ||
122 | + CS_NI, | ||
123 | + CS_NE, | ||
124 | + CS_NA, | ||
125 | + CS_OS, | ||
126 | + CS_OH, | ||
127 | + CS_PF, | ||
128 | + CS_PL, | ||
129 | + CS_RO, | ||
130 | + CS_SI, | ||
131 | + CS_SE, | ||
132 | + CS_SD, | ||
133 | + CS_SC, | ||
134 | + CS_SY | ||
135 | +}; | ||
81 | enum NODE_TYPE { | 136 | enum NODE_TYPE { |
82 | NODE_PAPER, | 137 | NODE_PAPER, |
83 | NODE_AUTHOR | 138 | NODE_AUTHOR |
... | @@ -98,8 +153,12 @@ typedef boost::property<vertex_index_t, int, | ... | @@ -98,8 +153,12 @@ typedef boost::property<vertex_index_t, int, |
98 | boost::property<vertex_type_t, int, //타입. enum NODE_TYPE에 정의됨 | 153 | boost::property<vertex_type_t, int, //타입. enum NODE_TYPE에 정의됨 |
99 | boost::property<vertex_record_t, int, //이웃 노드 개수 | 154 | boost::property<vertex_record_t, int, //이웃 노드 개수 |
100 | boost::property<vertex_citation_t, int, //피인용수 | 155 | boost::property<vertex_citation_t, int, //피인용수 |
101 | - boost::property<vertex_pagerank_t, double> //페이지랭크 값 | 156 | + boost::property<vertex_pagerank_t, double, //페이지랭크값 계산해서 저장할 property |
102 | - >>>>> | 157 | + boost::property<vertex_category_t, int, //논문 주제 |
158 | + boost::property<vertex_title_t, std::string, //논문 제목 | ||
159 | + boost::property<vertex_year_t, int, | ||
160 | + boost::property<vertex_category_accuracy_t, double> | ||
161 | + >>>>>>>>> | ||
103 | > VertexProperties; | 162 | > VertexProperties; |
104 | typedef boost::adjacency_list< | 163 | typedef boost::adjacency_list< |
105 | listS, //outEdgeList | 164 | listS, //outEdgeList |
... | @@ -126,8 +185,8 @@ namespace { | ... | @@ -126,8 +185,8 @@ namespace { |
126 | const int NODE_SIZE = 4; | 185 | const int NODE_SIZE = 4; |
127 | const int LAYOUT_MODE = GRAPH_LAYOUT::RANDOM_LAYOUT; | 186 | const int LAYOUT_MODE = GRAPH_LAYOUT::RANDOM_LAYOUT; |
128 | //const int SCREEN_SIZE = 3000; | 187 | //const int SCREEN_SIZE = 3000; |
129 | - const int SCREEN_SIZE = 3000; | 188 | + const int SCREEN_SIZE = 500; |
130 | - const int READ_LINE_UNIT = 10; //한 번에 몇 라인을 읽을지 | 189 | + const int READ_LINE_UNIT = 100; //한 번에 몇 라인을 읽을지 |
131 | 190 | ||
132 | /* curl processor */ | 191 | /* curl processor */ |
133 | curl_processor _curl_processor; | 192 | curl_processor _curl_processor; | ... | ... |
-
Please register or login to post a comment