now the size of the node is proportional to the closeness

main
Luca Lombardo 3 years ago
parent 0d72f0c543
commit 6f62bc662c

@ -17,6 +17,8 @@ On this data we define an undirected graph $G=(V,E)$ where
![](visualization/Screenshot.png) ![](visualization/Screenshot.png)
> [Interactive version here](https://lukefleed.xyz/imdb-graph) (it may take a few seconds to load)
The aim of the project was to build a social network over this graph and studying its centralities. The aim of the project was to build a social network over this graph and studying its centralities.
The first challenge was to filter the raw data downloaded from IMDb. One of the first (and funnier) problems was to delete all the actors that works in the Adult industry. They make a lot of movies together and this would have altered the results. The first challenge was to filter the raw data downloaded from IMDb. One of the first (and funnier) problems was to delete all the actors that works in the Adult industry. They make a lot of movies together and this would have altered the results.
@ -446,6 +448,7 @@ for (int bfs_film_id : A[bfs_actor_id].film_indices) {
} }
``` --> ``` -->
> [An interactive graph showing the relation between the actors with highest closeness centrality](https://lukefleed.xyz/closeness-graph.html)
--- ---
@ -469,6 +472,8 @@ Why this? We are at the level $d$ of our exploration, so we already know the par
Then the algorithm works with the same _top-k_ philosophy, just with an upper bound instead of a lower bound Then the algorithm works with the same _top-k_ philosophy, just with an upper bound instead of a lower bound
> [An interactive graph showing the relation between the actors with highest closeness centrality](https://lukefleed.xyz/harmonic-graph.html)
--- ---
## Benchmarks ## Benchmarks

Binary file not shown.

After

Width:  |  Height:  |  Size: 957 KiB

File diff suppressed because one or more lines are too long

@ -8,19 +8,23 @@ from pyvis.network import Network
net = Network(height='100%', width='100%', directed=False, bgcolor='#1e1f29', font_color='white') net = Network(height='100%', width='100%', directed=False, bgcolor='#1e1f29', font_color='white')
actors_to_keep = [] actors_to_keep = []
farness_to_keep= []
with open('data/top_actors_c.txt') as ifs: with open('data/top_actors_c.txt') as ifs:
for line in ifs: for line in ifs:
if line.strip(): if line.strip():
actor_id, farness = line.split(maxsplit=1) actor_id, farness = line.split(maxsplit=1)
actors_to_keep.append(int(actor_id)) actors_to_keep.append(int(actor_id))
farness_to_keep.append(float(farness))
with open('data/Attori.txt') as ifs: with open('data/Attori.txt') as ifs:
for line in ifs: for line in ifs:
if line.strip(): if line.strip():
actor_id, actor_name = line.split(maxsplit=1) actor_id, actor_name = line.split(maxsplit=1)
actor_id = int(actor_id) actor_id = int(actor_id)
farness = float(farness)
if actor_id in actors_to_keep: if actor_id in actors_to_keep:
net.add_node(actor_id, label=actor_name) if farness in farness_to_keep:
net.add_node(actor_id, label=actor_name, size =farness*50)
movies = {} # {movie_id: [actor_id, ...]} movies = {} # {movie_id: [actor_id, ...]}
with open('data/Relazioni.txt') as ifs: with open('data/Relazioni.txt') as ifs:

Loading…
Cancel
Save