for path caculate