calculate edge , another algorithm,work