now the size of the node is proportional to the relative centrality

main
Luca Lombardo 3 years ago
parent 6f62bc662c
commit c559747039

File diff suppressed because one or more lines are too long

@ -24,7 +24,7 @@ with open('data/Attori.txt') as ifs:
farness = float(farness)
if actor_id in actors_to_keep:
if farness in farness_to_keep:
net.add_node(actor_id, label=actor_name, size =farness*50)
net.add_node(actor_id, label=actor_name, size =pow(5,1.0/(farness*2)))
movies = {} # {movie_id: [actor_id, ...]}
with open('data/Relazioni.txt') as ifs:
@ -77,4 +77,4 @@ var options = {
}
""")
net.show('closeness-graph.html')
net.show('html-files/closeness-graph.html')

@ -8,19 +8,23 @@ from pyvis.network import Network
net = Network(height='100%', width='100%', directed=False, bgcolor='#1e1f29', font_color='white')
actors_to_keep = []
harmonic_to_keep =[]
with open('data/top_actors_h.txt') as ifs:
for line in ifs:
if line.strip():
actor_id, _ = line.split(maxsplit=1)
actor_id, harmonic = line.split(maxsplit=1)
actors_to_keep.append(int(actor_id))
harmonic_to_keep.append(float(harmonic))
with open('data/Attori.txt') as ifs:
for line in ifs:
if line.strip():
actor_id, actor_name = line.split(maxsplit=1)
actor_id = int(actor_id)
harmonic = float(harmonic)
if actor_id in actors_to_keep:
net.add_node(actor_id, label=actor_name)
if harmonic in harmonic_to_keep:
net.add_node(actor_id, label=actor_name, size = harmonic/350)
movies = {} # {movie_id: [actor_id, ...]}
with open('data/Relazioni.txt') as ifs:
@ -68,4 +72,4 @@ var options = {
}
""")
net.show('harmonic-graph.html')
net.show('html-files/harmonic-graph.html')

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save