cython centrality code