NetworkX

https://networkx.org/documentation/stable/ 

https://ericmjl.github.io/Network-Analysis-Made-Simple/ 

wget https://snap.stanford.edu/data/cit-Patents.txt.gz

gunzip cit-Patents.txt.gz

 

import pandas as pd

pandas_edgelist = pd.read_csv(

    "cit-Patents.txt",

    skiprows=4,

    delimiter="\t",

    names=["src", "dst"],

    dtype={"src": "int32", "dst": "int32"},

)


import networkx as nx

G = nx.from_pandas_edgelist(

    pandas_edgelist,

    source="src",

    target="dst",

    create_using=nx.DiGraph,

)

bc_result = nx.betweenness_centrality(G, k=1)

bc_result = nx.betweenness_centrality(G, k=1, backend="cugraph")