Implement the betweennes centrality to obtain percolation centrality?

Dear everyone,

I’m trying to implement the betweennes centrality code in order to calculate percolation centrality as described here:

Can someone help me?
Thank you