Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
HCG_Project1
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
김한준
2020-06-21 15:27:04 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
59eae978a63b1b320265dbe9fe7b4e0abbf633fc
59eae978
1 parent
a35849ec
Delete movie.py
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
66 deletions
소스코드/movie.py
소스코드/movie.py
deleted
100644 → 0
View file @
a35849e
#-*-encoding utf-8 -*-
import
matplotlib.pyplot
as
plt
import
networkx
as
nx
from
openpyxl
import
load_workbook
load_wb
=
load_workbook
(
"movie_top500.xlsx"
,
data_only
=
True
)
load_ws
=
load_wb
[
'Sheet1'
]
def
make_edge
(
movielist
):
edge_list
=
[]
for
i
in
range
(
0
,
len
(
movielist
)):
for
j
in
range
(
0
,
len
(
movielist
)):
if
i
==
j
:
break
else
:
edge_list
.
append
((
movielist
[
i
],
movielist
[
j
]))
return
edge_list
movie_director_list
=
[]
movie_audience_list
=
[]
for
i
in
range
(
7
,
507
,
1
):
distributor_name
=
'L'
+
str
(
i
)
director_name
=
'K'
+
str
(
i
)
name3
=
(
str
(
load_ws
[
distributor_name
]
.
value
)
+
','
+
str
(
load_ws
[
director_name
]
.
value
))
.
split
(
','
)
movie_audience_list
.
append
(
int
(
load_ws
[
'F'
+
str
(
i
)]
.
value
))
movie_director_list
.
append
(
name3
)
movie_edge_list
=
[]
movie_graph_list
=
[]
movie_check_list
=
[]
for
i
in
range
(
0
,
500
):
movie_graph
=
nx
.
Graph
()
movie_edge
=
make_edge
(
movie_director_list
[
i
])
if
movie_director_list
[
i
]
in
movie_check_list
:
movie_audience_list
[
i
]
=
movie_audience_list
[
i
]
+
movie_audience_list
[
movie_check_list
.
index
(
movie_director_list
[
i
])]
movie_audience_list
[
movie_check_list
.
index
(
movie_director_list
[
i
])]
=
movie_audience_list
[
i
]
movie_check_list
.
append
(
movie_director_list
[
i
])
else
:
movie_check_list
.
append
(
movie_director_list
[
i
])
movie_edge_list
.
append
(
movie_edge
)
movie_graph
.
add_nodes_from
(
movie_director_list
[
i
])
movie_graph
.
add_edges_from
(
movie_edge_list
[
i
],
weight
=
round
(
movie_audience_list
[
i
]
/
100000000
,
5
))
movie_graph_list
.
append
(
movie_graph
)
movie_total
=
nx
.
Graph
()
for
i
in
range
(
0
,
500
):
movie_total
=
nx
.
compose
(
movie_total
,
movie_graph_list
[
i
])
degree
=
movie_total
.
degree
()
nx
.
write_gexf
(
movie_total
,
"movie.gexf"
)
plt
.
figure
(
figsize
=
(
20
,
20
))
pos
=
nx
.
spring_layout
(
movie_total
,
iterations
=
10
)
nx
.
draw
(
movie_total
,
pos
,
alpha
=
1
,
line_color
=
'black'
,
linewidths
=
0
,
width
=
0.05
,
node_size
=
100
,
node_color
=
'w'
,
with_labels
=
True
,
font_family
=
'NanumGothic'
,
font_color
=
'black'
,
font_size
=
8
)
plt
.
show
()
Please
register
or
login
to post a comment