Код: Выделить всё
import pandas as pd
import networkx as nx
df = pd.read_csv('edges1.csv')
Graphtype = nx.Graph()
G = nx.from_pandas_edgelist(df, edge_attr='genre_ids', create_using=Graphtype)
centrality = nx.betweenness_centrality(G, normalize=False)
print(centrality)
Код: Выделить всё
Surce,Target,genre_ids
Avatar,Violent Night,18
Harry Potter,The Woman King,20
Happy Feet, Froze,23
so on....
Подробнее здесь: https://stackoverflow.com/questions/751 ... h-networkx