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-04-17 19:15:42 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5ccb1e3d7ed964ec369dfbc6dba4cef6f75df8b6
5ccb1e3d
1 parent
24e9dc01
add node type, move const vars to stdafx.h
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
24 deletions
PaperGraph/GraphItem.cpp
PaperGraph/GraphItem.h
PaperGraph/main.cpp
PaperGraph/stdafx.h
PaperGraph/GraphItem.cpp
View file @
5ccb1e3
...
...
@@ -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
()
...
...
PaperGraph/GraphItem.h
View file @
5ccb1e3
...
...
@@ -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
...
...
PaperGraph/main.cpp
View file @
5ccb1e3
...
...
@@ -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
();
...
...
PaperGraph/stdafx.h
View file @
5ccb1e3
...
...
@@ -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
...
...
Please
register
or
login
to post a comment