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-02 09:44:06 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
471257dda0e32e8e8e3935d9a94404abf583bad6
471257dd
1 parent
1b38b45e
change graph constructing
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
29 deletions
PaperGraph/GraphItem.cpp
PaperGraph/GraphItem.h
PaperGraph/stdafx.h
PaperGraph/GraphItem.cpp
View file @
471257d
...
...
@@ -27,9 +27,9 @@ void GraphItem::read_more()
std
::
string
line
;
vector
<
std
::
string
>
tokens
;
vector
<
std
::
string
>
authors
;
/*vector<pair<string, string>> edges;*/
//vector<simple_edge> edges_indexes;
vector
<
pair
<
string
,
string
>>
edges
;
vector
<
pair
<
int
,
int
>>
edges_indexes
;
int
line_cnt
=
0
;
qDebug
()
<<
"* graph reading start"
;
...
...
@@ -67,12 +67,9 @@ void GraphItem::read_more()
qDebug
()
<<
"* # of nodes: "
<<
node_cnt
;
//qDebug() << "* # of edges: " << edges.size();
//edge conversion
//<string, string> to <int, int>
//using boost::bimap (bidirectional map)
edges_indexes
.
clear
();
for
(
auto
edge
:
edges
)
{
edges_indexes
.
push_back
({
node_ids
.
left
.
find
(
edge
.
first
)
->
get_right
(),
...
...
@@ -80,18 +77,16 @@ void GraphItem::read_more()
});
}
//Graph graph(edges_indexes.begin(), edges_indexes.end(), node_ids.size());
//graph = new Graph(edges_indexes.begin(), edges_indexes.end(), node_ids.size());
//for (auto& e: edges_indexes) {
// boost::add_edge(e.first, e.second, graph);
//}
if
(
graph
)
{
delete
graph
;
graph
=
nullptr
;
// add new vertices
for
(
int
i
=
0
;
i
<
node_cnt
;
++
i
)
{
vdes
.
push_back
(
add_vertex
(
static_cast
<
Graph
&>
(
*
graph
)))
;
}
graph
=
new
Graph
(
edges_indexes
.
begin
(),
edges_indexes
.
end
(),
node_ids
.
size
());
// add new edges
for
(
auto
e_i
:
edges_indexes
)
{
add_edge
(
vdes
[
e_i
.
first
],
vdes
[
e_i
.
second
],
*
graph
);
}
//set index property
...
...
@@ -124,15 +119,15 @@ void GraphItem::read_more()
qDebug
()
<<
"* set vertex property end"
;
whole_node_cnt
+=
node_cnt
;
//
qDebug("* set edges weight start");
//
//
모든 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);
//
}
//
qDebug("* set edges weight end");
//
//
qDebug
(
"* set edges weight start"
);
//모든 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
);
}
qDebug
(
"* set edges weight end"
);
//qDebug("* path highlighting start");
////find start, end node's id
//int start_idx, end_idx;
...
...
@@ -204,7 +199,7 @@ void GraphItem::read_more()
auto
label
=
boost
::
get
(
vertex_name
,
*
graph
);
auto
nodeType
=
boost
::
get
(
vertex_type
,
*
graph
);
edge_iterator
ei
,
ei_end
;
//
edge_iterator ei, ei_end;
vertex_descriptor
u
,
v
;
for
(
boost
::
tie
(
ei
,
ei_end
)
=
boost
::
edges
(
*
graph
);
ei
!=
ei_end
;
++
ei
)
{
u
=
source
(
*
ei
,
*
graph
);
...
...
PaperGraph/GraphItem.h
View file @
471257d
...
...
@@ -38,8 +38,9 @@ protected:
private
:
ifstream
fin
;
bm_type
node_ids
;
vector
<
pair
<
string
,
string
>>
edges
;
vector
<
simple_edge
>
edges_indexes
;
//vector<pair<string, string>> edges;
//vector<pair<int, int>> edges_indexes;
vector
<
vertex_descriptor
>
vdes
;
int
whole_node_cnt
=
0
;
Graph
*
graph
=
nullptr
;
...
...
PaperGraph/stdafx.h
View file @
471257d
...
...
@@ -93,9 +93,12 @@ typedef square_topology<> Topology;
typedef
typename
Topology
::
point_type
Point
;
/* structs */
struct
simple_edge
{
int
first
,
second
;
};
//struct simple_edge {
// int first, second;
//};
//struct simple_edge {
// int a, b;
//};
/* constants */
namespace
{
...
...
Please
register
or
login
to post a comment