조성현

add node type, move const vars to stdafx.h

......@@ -78,10 +78,19 @@ GraphItem::GraphItem(ifstream& fin)
//index: 0 ~ ...
//name : map의 value(i) 기준으로 찾은 Key
// map --> map<string, int> (boost bidirectional map)
std::string node_label = node_ids.right.find(i)->get_left();
boost::put(vertex_index, *graph, *vi, i);
boost::put(vertex_name, *graph, *vi,
node_ids.right.find(i)->get_left());
boost::put(vertex_name, *graph, *vi, node_label);
//node type 설정
if (boost::regex_match(node_label, paper_reg)) {
//Paper
boost::put(vertex_type, *graph, *vi, NODE_PAPER);
} else {
//Author
boost::put(vertex_type, *graph, *vi, NODE_AUTHOR);
}
++i;
}
qDebug() << "* set vertex property end";
......@@ -249,8 +258,6 @@ void GraphItem::path_highlighting(std::string start, std::string end)
n->setColor(QColor(255, 0, 0));
}
}
}
void GraphItem::reset_color()
......
......@@ -9,31 +9,36 @@ using namespace std;
using namespace boost;
enum GRAPH_LAYOUT {
RANDOM_LAYOUT,
CIRCLE_LAYOUT,
//KAMADA_KAWAI_LAYOUT,
FRUCHTERMAN_REINGOLD_LAYOUT //slow
};
//enum GRAPH_LAYOUT {
// RANDOM_LAYOUT,
// CIRCLE_LAYOUT,
// //KAMADA_KAWAI_LAYOUT,
// FRUCHTERMAN_REINGOLD_LAYOUT //slow
//};
/**
* Constants
*/
const int LAYOUT_MODE = GRAPH_LAYOUT::RANDOM_LAYOUT;
const int SCREEN_SIZE = 300;
const int NODE_LIMIT = 100;
//const int LAYOUT_MODE = GRAPH_LAYOUT::RANDOM_LAYOUT;
//const int SCREEN_SIZE = 300;
//const int NODE_LIMIT = 100;
//const boost::regex paper_reg("(conf|journals).*");
enum vertex_position_t { vertex_position };
enum vertex_type_t { vertex_type };
namespace boost {
BOOST_INSTALL_PROPERTY(vertex, position);
BOOST_INSTALL_PROPERTY(vertex, type);
}
typedef square_topology<>::point_type point;
struct simple_edge {
int first, second;
};
typedef boost::property<vertex_index_t, int,
boost::property<vertex_name_t, std::string,
boost::property<vertex_position_t, point>>
boost::property<vertex_position_t, point,
boost::property<vertex_type_t, int>>>
> VertexProperties;
typedef adjacency_list<
listS, //outEdgeList
......
......@@ -2,21 +2,16 @@
#include "PaperGraphWidget.h"
#include "MainWindow.h"
/**
* Constants
*/
const char* PAPER_FILENAME = "dblp-paper.txt";
//const char* PAPER_FILENAME = "dblp-paper.txt";
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
//PaperGraphWidget w;
MainWindow m;
try {
ifstream fin(PAPER_FILENAME);
//w.print_graph(fin);
m.print_graph(fin);
fin.close();
} catch (const std::exception& e) {
......@@ -24,7 +19,6 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
//w.show();
m.show();
return app.exec();
......
......@@ -38,4 +38,26 @@
#include <vector>
using namespace boost;
using namespace std;
\ No newline at end of file
using namespace std;
#define NODE_PAPER 1
#define NODE_AUTHOR 2
namespace {
enum GRAPH_LAYOUT {
RANDOM_LAYOUT,
CIRCLE_LAYOUT,
//KAMADA_KAWAI_LAYOUT,
FRUCHTERMAN_REINGOLD_LAYOUT //slow
};
const int LAYOUT_MODE = GRAPH_LAYOUT::RANDOM_LAYOUT;
const int SCREEN_SIZE = 300;
const int NODE_LIMIT = 100;
const char* PAPER_FILENAME = "dblp-paper.txt";
}
namespace boost {
const regex paper_reg("(conf|journals).*");
}
\ No newline at end of file
......