Topology-dependent permutation tail probability test