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-05-20 19:21:48 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b156f5ce13188dff8630df90473e0f1a3b809ecb
b156f5ce
1 parent
8fea7b4b
temp
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
35 deletions
PaperGraph/GraphItem.cpp
PaperGraph/GraphItem.h
PaperGraph/PaperGraphWidget.cpp
PaperGraph/stdafx.h
PaperGraph/GraphItem.cpp
View file @
b156f5c
...
...
@@ -123,36 +123,10 @@ void GraphItem::read_more()
//모든 edge의 weight를 1로 설정
typename
graph_traits
<
Graph
>::
edge_iterator
ei
,
ei_end
;
for
(
boost
::
tie
(
ei
,
ei_end
)
=
boost
::
edges
(
*
graph
);
ei
!=
ei_end
;
++
ei
)
{
boost
::
put
(
edge_weight
,
*
graph
,
*
ei
,
1
);
boost
::
put
(
edge_weight
,
*
graph
,
*
ei
,
1
.0
);
}
qDebug
(
"* set edges weight end"
);
//qDebug("* path highlighting start");
////find start, end node's id
//int start_idx, end_idx;
//for (boost::tie(vi, vi_end)=vertices(*graph); vi!=vi_end; ++vi) {
// string node_name = boost::get(vertex_name, *graph, *vi);
// if (node_name == "Seong Chul Cho") {
// start_idx = boost::get(vertex_index, *graph, *vi);
// } else if (node_name == "Hyung Jin Kim") {
// end_idx = boost::get(vertex_index, *graph, *vi);
// }
//}
//typedef boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
//vector<vertex_descriptor> parents(num_vertices(*graph));
//vector<int> distances(num_vertices(*graph));
//vertex_descriptor start_vertex = vertex(start_idx, *graph);
//dijkstra_shortest_paths(*graph, start_vertex,
// predecessor_map(&parents[0]).distance_map(&distances[0]));
////path finding
//vertex_descriptor current = boost::vertex(end_idx, *graph);
//while (current != boost::vertex(start_idx, *graph)) {
//}
//qDebug("* path highlighting end");
//graph layout calculation
//using boost::random_graph_layout and boost::kamada_kawai_spring_layout
//vertex마다 계산된 좌표를 property에 적용
...
...
@@ -395,6 +369,37 @@ void GraphItem::topK_highlight()
}
}
void
GraphItem
::
test
()
{
qDebug
(
"* path highlighting start"
);
vertex_iterator
vi
,
vi_end
;
//find start, end node's id
int
start_idx
,
end_idx
;
for
(
boost
::
tie
(
vi
,
vi_end
)
=
vertices
(
*
graph
);
vi
!=
vi_end
;
++
vi
)
{
string
node_name
=
boost
::
get
(
vertex_name
,
*
graph
,
*
vi
);
if
(
node_name
==
"Seong Chul Cho"
)
{
start_idx
=
boost
::
get
(
vertex_index
,
*
graph
,
*
vi
);
}
else
if
(
node_name
==
"Hyung Jin Kim"
)
{
end_idx
=
boost
::
get
(
vertex_index
,
*
graph
,
*
vi
);
}
}
vector
<
vertex_descriptor
>
parents
(
num_vertices
(
*
graph
));
vector
<
double
>
distances
(
num_vertices
(
*
graph
));
vertex_descriptor
start_vertex
=
boost
::
vertex
(
start_idx
,
*
graph
);
boost
::
dijkstra_shortest_paths
(
*
graph
,
start_vertex
,
predecessor_map
(
boost
::
make_iterator_property_map
(
parents
.
begin
(),
boost
::
get
(
boost
::
vertex_index
,
*
graph
))).
distance_map
(
boost
::
make_iterator_property_map
(
distances
.
begin
(),
get
(
boost
::
vertex_index
,
*
graph
))));
//path finding
qDebug
(
"* path finding start"
);
vertex_descriptor
current
=
boost
::
vertex
(
end_idx
,
*
graph
);
while
(
current
!=
boost
::
vertex
(
start_idx
,
*
graph
))
{
}
qDebug
(
"* path finding end"
);
qDebug
(
"* path highlighting end"
);
}
//event handler
void
GraphItem
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
...
...
PaperGraph/GraphItem.h
View file @
b156f5c
...
...
@@ -30,6 +30,9 @@ public:
void
reset_color
();
void
topK_highlight
();
//test
void
test
();
protected
:
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
override
;
void
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
override
;
...
...
PaperGraph/PaperGraphWidget.cpp
View file @
b156f5c
...
...
@@ -74,6 +74,8 @@ void PaperGraphWidget::test()
testCombo
->
addItem
(
to_string
(
rand
()
%
300
).
c_str
());
testCombo
->
addItem
(
to_string
(
rand
()
%
300
).
c_str
());
testCombo
->
addItem
(
to_string
(
rand
()
%
300
).
c_str
());
graphItem
->
test
();
}
void
PaperGraphWidget
::
handleSelectionChanged
(
int
idx
)
...
...
PaperGraph/stdafx.h
View file @
b156f5c
...
...
@@ -92,14 +92,6 @@ typedef boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
typedef
square_topology
<>
Topology
;
typedef
typename
Topology
::
point_type
Point
;
/* structs */
//struct simple_edge {
// int first, second;
//};
//struct simple_edge {
// int a, b;
//};
/* constants */
namespace
{
/* file io */
...
...
Please
register
or
login
to post a comment