Enabled user to provide custom function for determining node neighbors.