--finished implementation of the Multi-node test, including distance
function used for significance test