I have an undirected weighted graph: I manually calculated the centrality for each node. 1 - 0 2 - 1.5 3 - 0 4 - 3 5 - 2 Then I calculated the centrality using this algorithm import networkx as nx G = nx.Graph() adj_matrix = [ [0, 4, 0, 0, 1], [4, 0, 3, 1, 0], [0, 3, 0, 4, 0], [0, 1, 4, 0, 2], [1, 0, 0, 2, 0], ] for i in range(len(adj_matrix)): for j in range(len(adj_matrix)): if adj_matrix[j] != 0: G.add_edge(i, j, weight=adj_matrix[j]) betweenness = nx.centrality.betweenness_centrality(G, k=None, normalized=False, weight="weight", endpoints=False, seed=None) print(betweenness) And got slightly different values. 1 - 0 2 - 1.667 3 - 0 4 - 3.167 5 - 2.167 Why are they different? I tried to use direct calculation of deltas instead of a recursive formula in the program. Continue reading...