We were using networkx to calculate centrality measurements of a given graph. However, we decided to move on with a simpler loss function using different ways of measuring centrality. Thanks for the answer !