edge weight calculation based on pythagorean theorem