MAINT: use the cythonized node-to-distn function for more speedup