Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design2
/
2014104137
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
ghdms
2020-05-16 13:49:58 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
cbdb66e6f58aa96618daf333291c3c861bddaeef
cbdb66e6
1 parent
0258bc1c
영화별 출연진의 betweenness 평균 산출
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletions
소스코드/centrality.py
소스코드/movie.py
소스코드/centrality.py
View file @
cbdb66e
...
...
@@ -216,6 +216,7 @@ data = {
# "몽타주": "",
# "명당": "",
}
#500만 이상 + 스크린 수당 매출액 50위 이상 => 79개 영화, 730개 노드, 9348개 엣지
def
named_union
(
graph1
,
graph2
):
#두 그래프 합성
A
=
graph1
.
copy
()
...
...
@@ -274,6 +275,7 @@ frequency[top[len(top) - 1]] = 1
G
=
Graph
.
Full
(
len
(
top
))
G
.
vs
[
"name"
]
=
top
[:]
G
.
vs
[
"label"
]
=
G
.
vs
[
"name"
][:]
topTmp
=
data
[
"명량"
]
del
data
[
"명량"
]
for
movie
in
data
:
...
...
@@ -302,6 +304,9 @@ for movie in data:
weight
[
join
][
"audiences"
]
+=
audiences
[
movie
]
weight
[
join
][
"count"
]
+=
1
for
f
in
sorted
(
list
(
frequency
.
keys
()),
key
=
lambda
x
:
frequency
[
x
],
reverse
=
True
)[:
10
]:
print
(
f
,
frequency
[
f
])
print
(
"
\n
<같은 영화에 같이 출연한 빈도수>"
)
topten
=
sorted
(
keys
,
key
=
lambda
n
:
weight
[
n
][
"count"
],
reverse
=
True
)[:
10
]
for
t
in
topten
:
...
...
@@ -343,6 +348,27 @@ egSorted = sorted(eg, reverse=True)[:10]
topEg
=
sorted
(
names1
,
key
=
lambda
n
:
eg
[
names2
.
index
(
n
)],
reverse
=
True
)[:
10
]
printResult
(
topEg
,
egSorted
,
5
,
8
,
10
)
avgOfBn
=
[]
totalBn
=
0
topActors
=
topTmp
.
split
(
","
)
for
actor
in
topActors
:
i
=
names
.
index
(
actor
)
totalBn
+=
bn
[
i
]
avgOfBn
.
append
({
"movie"
:
"명량"
,
"avgOfBn"
:
totalBn
/
len
(
topActors
)})
for
movie
in
data
:
totalBn
=
0
actors
=
data
[
movie
]
.
split
(
","
)
for
actor
in
actors
:
i
=
names
.
index
(
actor
)
totalBn
+=
bn
[
i
]
avgOfBn
.
append
({
"movie"
:
movie
,
"avgOfBn"
:
totalBn
/
len
(
actors
)})
print
(
"
\n
<average of betweenness>"
)
avgOfBnSorted
=
sorted
(
avgOfBn
,
key
=
lambda
n
:
n
[
"avgOfBn"
],
reverse
=
True
)[:
10
]
for
a
in
avgOfBnSorted
:
print
(
a
[
"movie"
],
a
[
"avgOfBn"
])
print
(
"
\n
<total nodes>"
)
print
(
len
(
G
.
vs
))
...
...
@@ -362,4 +388,4 @@ out = plot(G,
)
out
.
save
(
"test.png"
)
#C:\Users\ghdms\2014104137\소스코드\movie.py
\ No newline at end of file
#C:\Users\ghdms\2014104137\소스코드\centrality.py
\ No newline at end of file
...
...
소스코드/movie.py
deleted
100644 → 0
View file @
0258bc1
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment