Toggle navigation
Toggle navigation
This project
Loading...
Sign in
조성현
/
graph-visualization
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
조성현
2017-06-22 14:45:13 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d9921d0e9dd88bd632bd83a96b364380b5a5f0b0
d9921d0e
1 parent
952c2321
완
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
138 additions
and
14 deletions
PaperGraph/GraphItem.cpp
PaperGraph/GraphItem.h
PaperGraph/MainWindow.cpp
PaperGraph/MainWindow.h
PaperGraph/NodeItem.cpp
PaperGraph/NodeItem.h
PaperGraph/PaperGraph.vcxproj.filters
PaperGraph/PaperGraphWidget.cpp
PaperGraph/PaperGraphWidget.h
PaperGraph/stdafx.h
PaperGraph/GraphItem.cpp
View file @
d9921d0
...
...
@@ -159,18 +159,53 @@ void GraphItem::read_more()
year
=
stoi
(
year_str
);
node_title_map
[
*
vi
]
=
title
;
node_year_map
[
*
vi
]
=
year
;
#endif // CITATION_COUNT
//카테고리 계산 및 accuracy 계산
//--> case insensitive
double
max_acc
=
-
1
;
int
max_acc_idx
;
vector
<
string
>
title_words
;
for
(
int
j
=
0
;
j
<
keywords
.
size
();
++
j
)
{
auto
&
paper_category
=
keywords
[
j
];
const
int
&
category_sz
=
paper_category
.
size
();
int
match_cnt
=
0
;
//논문제목을 word들로 분할
boost
::
split
(
title_words
,
title
,
boost
::
is_any_of
(
" "
),
boost
::
token_compress_on
);
for
(
auto
&
keyword
:
paper_category
)
{
//각 word마다 수행
for
(
auto
&
word
:
title_words
)
{
if
(
boost
::
iequals
(
word
,
keyword
))
{
++
match_cnt
;
break
;
}
}
}
double
acc
=
(
double
)
match_cnt
/
category_sz
;
if
(
max_acc
<
acc
&&
match_cnt
!=
0
)
{
max_acc
=
acc
;
max_acc_idx
=
j
;
}
}
if
(
max_acc_idx
==
keywords
.
size
()
-
1
&&
max_acc
!=
-
1
)
{
//no category detected
node_category_map
[
*
vi
]
=
CS_OH
;
node_category_accuracy_map
[
*
vi
]
=
0.0
;
}
else
{
node_category_map
[
*
vi
]
=
max_acc_idx
;
node_category_accuracy_map
[
*
vi
]
=
max_acc
;
}
#endif // CITATION_COUNT
}
else
{
//Author
boost
::
put
(
vertex_type
,
*
graph
,
*
vi
,
NODE_TYPE
::
NODE_AUTHOR
);
}
//counter
//printf("%d end: %s\n", i, node_label.c_str());
++
i
;
...
...
@@ -255,10 +290,12 @@ void GraphItem::read_more()
//make node item and push it to list
NodeItem
*
node
;
if
(
nt
==
NODE_TYPE
::
NODE_PAPER
)
{
node
=
new
NodeItem
(
p
[
0
],
p
[
1
],
QColor
(
Qt
::
darkGreen
),
QString
(
name
.
c_str
()),
nt
);
node
=
new
NodeItem
(
p
[
0
],
p
[
1
],
QColor
(
Qt
::
darkGreen
),
QString
(
name
.
c_str
()),
nt
,
node_category_map
[
*
vi
],
node_category_accuracy_map
[
*
vi
],
node_year_map
[
*
vi
]);
}
else
{
node
=
new
NodeItem
(
p
[
0
],
p
[
1
],
QColor
(
Qt
::
green
),
QString
(
name
.
c_str
()),
nt
);
node
=
new
NodeItem
(
p
[
0
],
p
[
1
],
QColor
(
Qt
::
green
),
QString
(
name
.
c_str
()),
nt
,
-
1
,
-
1
,
-
1
);
}
node
->
setPos
(
QPointF
(
p
[
0
],
p
[
1
]));
nodeList
<<
node
;
...
...
@@ -965,6 +1002,17 @@ void GraphItem::topk_with_pagerank() {
delete
[]
topk_arr
;
}
void
GraphItem
::
category_visualize
()
{
//전체노드 색 변경
for
(
auto
&
n
:
nodeList
)
{
n
->
setColor
(
Qt
::
lightGray
);
if
(
n
->
getType
()
==
NODE_TYPE
::
NODE_AUTHOR
)
continue
;
n
->
setColor
(
QColor
(
category_colors
[
n
->
getCategory
()].
c_str
()));
}
}
void
GraphItem
::
reset_color
()
{
for
(
auto
&
n
:
nodeList
)
{
...
...
PaperGraph/GraphItem.h
View file @
d9921d0
...
...
@@ -8,7 +8,7 @@
using
namespace
std
;
using
namespace
boost
;
//
#define CITATION_COUNT
#define CITATION_COUNT
class
GraphItem
:
public
QGraphicsItem
...
...
@@ -33,6 +33,7 @@ public:
//void topK_using_custom_score();
void
find_shortest_path
();
void
topk_with_pagerank
();
void
category_visualize
();
void
reset_color
();
//test
...
...
PaperGraph/MainWindow.cpp
View file @
d9921d0
...
...
@@ -55,6 +55,9 @@ void MainWindow::createActions()
topkWithPagerankAct
=
new
QAction
(
tr
(
"topK with pagerank"
),
this
);
topkWithPagerankAct
->
setStatusTip
(
tr
(
"highlight which is in top k pagerank in whole graph"
));
connect
(
topkWithPagerankAct
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
topk_with_pagerank
);
categoryVisualizeAct
=
new
QAction
(
tr
(
"category visualize"
),
this
);
categoryVisualizeAct
->
setStatusTip
(
tr
(
"category visualization"
));
connect
(
categoryVisualizeAct
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
category_visualize
);
resetColorAct
=
new
QAction
(
tr
(
"Reset colors"
),
this
);
resetColorAct
->
setStatusTip
(
tr
(
"Reset all node's color"
));
...
...
@@ -77,6 +80,7 @@ void MainWindow::createMenus()
actionMenu
->
addAction
(
topKWithTargetAct
);
actionMenu
->
addAction
(
findShortestPathAct
);
actionMenu
->
addAction
(
topkWithPagerankAct
);
actionMenu
->
addAction
(
categoryVisualizeAct
);
actionMenu
->
addAction
(
resetColorAct
);
...
...
@@ -117,6 +121,10 @@ void MainWindow::topk_with_pagerank() {
graphWidget
->
topk_with_pagerank
();
}
void
MainWindow
::
category_visualize
()
{
graphWidget
->
category_visualize
();
}
void
MainWindow
::
reset_color
()
{
graphWidget
->
reset_color
();
...
...
PaperGraph/MainWindow.h
View file @
d9921d0
...
...
@@ -27,6 +27,7 @@ private:
QAction
*
resetColorAct
;
QAction
*
topkWithPagerankAct
;
QAction
*
findShortestPathAct
;
QAction
*
categoryVisualizeAct
;
//test
QMenu
*
testMenu
;
...
...
@@ -43,6 +44,7 @@ private slots:
void
topK_with_target
();
void
find_shortest_path
();
void
topk_with_pagerank
();
void
category_visualize
();
void
reset_color
();
//test
void
test
();
...
...
PaperGraph/NodeItem.cpp
View file @
d9921d0
...
...
@@ -22,7 +22,8 @@ void NodeItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
{
}
NodeItem
::
NodeItem
(
double
x
,
double
y
,
QColor
color
,
QString
label
,
int
type
)
NodeItem
::
NodeItem
(
double
x
,
double
y
,
QColor
color
,
QString
label
,
int
type
,
int
category
,
double
_accuracy
,
int
year
)
{
//node constructor
this
->
x
=
x
;
...
...
@@ -30,6 +31,9 @@ NodeItem::NodeItem(double x, double y, QColor color, QString label, int type)
this
->
color
=
color
;
this
->
label
=
label
;
this
->
type
=
type
;
this
->
category
=
category
;
this
->
category_accuracy
=
_accuracy
;
this
->
year
=
year
;
setZValue
(
1
);
//setFlags(ItemIsSelectable | ItemIsMovable);
...
...
PaperGraph/NodeItem.h
View file @
d9921d0
...
...
@@ -12,6 +12,9 @@ private:
QColor
color
;
QString
label
;
int
type
;
int
category
;
double
category_accuracy
;
int
year
;
protected
:
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
override
;
...
...
@@ -19,11 +22,15 @@ protected:
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
)
override
;
public
:
NodeItem
(
double
x
,
double
y
,
QColor
color
,
QString
label
,
int
type
);
NodeItem
(
double
x
,
double
y
,
QColor
color
,
QString
label
,
int
type
,
int
category
,
double
_accuracy
,
int
year
);
//getter setter
QString
getLabel
()
{
return
label
;}
int
getType
()
{
return
type
;
}
int
getCategory
()
{
return
category
;
}
double
getAccuracy
()
{
return
category_accuracy
;
}
int
getYear
()
{
return
year
;
}
void
setColor
(
QColor
color
)
{
this
->
color
=
color
;}
QRectF
boundingRect
()
const
override
;
...
...
PaperGraph/PaperGraph.vcxproj.filters
View file @
d9921d0
...
...
@@ -92,9 +92,6 @@
<ClCompile Include="json_processor.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ChartDialog.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="PaperGraphWidget.h">
...
...
@@ -132,8 +129,5 @@
<ClInclude Include="json_processor.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ChartDialog.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
...
...
PaperGraph/PaperGraphWidget.cpp
View file @
d9921d0
...
...
@@ -80,6 +80,11 @@ void PaperGraphWidget::topk_with_pagerank() {
scene
->
update
();
}
void
PaperGraphWidget
::
category_visualize
()
{
graphItem
->
category_visualize
();
scene
->
update
();
}
void
PaperGraphWidget
::
reset_color
()
{
graphItem
->
reset_color
();
...
...
PaperGraph/PaperGraphWidget.h
View file @
d9921d0
...
...
@@ -20,6 +20,7 @@ public:
void
topk_with_target
();
void
find_shortest_path
();
void
topk_with_pagerank
();
void
category_visualize
();
void
reset_color
();
//test
...
...
PaperGraph/stdafx.h
View file @
d9921d0
...
...
@@ -196,6 +196,60 @@ namespace {
/* json processor */
json_processor
_json_processor
;
/* category keywords */
vector
<
vector
<
string
>>
keywords
{
{
"LANGUAGE"
,
"TRANSLATION"
,
"TEXT"
,
"PHRASE"
,
"PARAGRAPH"
},
{
"COMPLEXITY"
,
"EXPONENTIALLY"
,
"FOURIER"
,
"CASCADE"
,
"NP-COMPLETE"
},
{
"ENGINEERING"
,
"FINANCE"
,
"STOCHASTIC"
,
"BUSINESS"
,
"DAMAGE"
},
{
"GEOMETRY"
,
"COLLINEAR"
,
"DISTANCE"
,
"DIMENSION"
,
"GEOMETRIC"
},
{
"GAME"
,
"GAMES"
,
"INTERFERENCE"
,
"REVENUE"
,
"AGGREGATIVE"
},
{
"VISION"
,
"PATTERN"
,
"RECOGNITION"
,
"FEATURE"
,
"FIXATION"
},
{
"SOCIETY"
,
"MEDIA"
,
"SOCIAL"
,
"MOBILE"
,
"EVENT"
},
{
"CRYPTOGRAPHY"
,
"SECURITY"
,
"CODE"
,
"CRYPTOSYSTEM"
},
{
"GRAPH"
,
"POLYNOMIAL"
},
{
"DATABASE"
,
"DATA"
,
"JOIN"
,
"TRANSACTION"
},
{
"LIBRARY"
,
"PREPRINT"
,
"RESEARCH"
},
{
"DISCRETE"
,
"COMBINATORIC"
},
{
"DISTRIBUTED"
,
"PARALLEL"
,
"CLUSTER"
,
"CLOUD"
},
{
"NEUTRON"
,
"QUANTUM"
},
{
"LANGUAGE"
,
"AUTOMATA"
},
{
"LITERATURE"
},
{
"GAUSSIAN"
,
"3D"
,
"SHAPE"
,
"GRAPHIC"
},
{
"HARDWARE"
,
"CAMERA"
,
"CACHE"
,
"ENERGY"
,
"HYBRID"
},
{
"PERSON"
,
"INDOOR"
,
"HUMAN"
},
{
"MINING"
,
"MICROBLOG"
,
"METADATA"
},
{
"UPLINK"
,
"INFORMATION"
},
{
"LEARNING"
,
"DEEP"
,
"NEURAL"
,
"GAN"
,
"CNN"
,
"RNN"
},
{
"LOGIC"
,
"HEURISTIC"
},
{
"MATHE"
,
"MATRIX"
,
"LINEAR"
,
"ALGEBRA"
},
{
"MULTI-AGENT"
,
"AGENT"
,
"COLLABORATIVE"
,
"CONVERGENCE"
},
{
"CODEC"
,
"MEDIA"
,
"AUDIO"
,
"IMAGE"
},
{
"NETWORK"
,
"INTERNET"
,
"CLOUD"
,
"SDN"
},
{
"NEURAL"
,
"EVOLUTION"
,
"LEARNING"
},
{
"NUMERICALLY"
,
"NUMERICAL"
},
{
"SCHEDULING"
,
"PREFETCHING"
,
"VM"
,
"SYSTEM"
,
"LINUX"
},
{},
{
"PERFORMANCE"
,
"HIGH"
,
"ADAPTIVE"
},
{
"GRAMMAR"
,
"PROGRAM"
},
{
"ROBOT"
,
"ROBOTIC"
,
"HARVESTER"
,
"CRAWLER"
},
{
"SOCIAL"
,
"INFORMATION"
,
"LOCATION"
,
"EVENT"
,
"MICROBLOG"
},
{
"SOFTWARE"
,
"ENGINEERING"
,
"PROTOTYPE"
,
"DEVELOPMENT"
},
{
"MULTI-CHANNEL"
,
"ACOUSTIC"
,
"AUDIO"
,
"AUTOENCODER"
},
{
"SYMBOLIC"
,
"FUNCTION"
,
"COEFFICIENT"
},
{
"SYSTEM"
,
"SENSORY"
,
"TRANSFORMER"
,
"CONTROL"
}
};
vector
<
string
>
category_colors
{
"#694842"
,
"#325eee"
,
"#38cff1"
,
"#0b7d18"
,
"#20a920"
,
"#ce112f"
,
"#479c12"
,
"#7cb382"
,
"#c4d5cb"
,
"#d52840"
,
"#b6070e"
,
"#f1c50b"
,
"#181ce4"
,
"#6ed976"
,
"#abecdc"
,
"#ddb390"
,
"#298d3e"
,
"#e48b31"
,
"#183083"
,
"#a03350"
,
"#309c0c"
,
"#75fa48"
,
"#6ce15c"
,
"#82dee1"
,
"#845576"
,
"#b9c3fb"
,
"#e59908"
,
"#30827a"
,
"#0658d1"
,
"#8b921c"
,
"#fa7529"
,
"#b91ad2"
,
"#545e87"
,
"#cb6eae"
,
"#c2d4ba"
,
"#dffa88"
,
"#5942d5"
,
"#32add6"
,
"#99443f"
,
"#c85b70"
};
}
/* boost */
...
...
Please
register
or
login
to post a comment