protected double getEdgeDistanceFromNode(int i)
	{
		double energy = 0.0;
		// This function is only performed during fine tuning for performance
		if (isOptimizeEdgeDistance && isFineTuning)
		{
			int[] edges = v[i].relevantEdges;
			for (int j = 0; j < edges.length; j++)
			{
				// Note that the distance value is squared
				double distSquare = Line2D.ptSegDistSq(v[e[edges[j]].source].x,
						v[e[edges[j]].source].y, v[e[edges[j]].target].x,
						v[e[edges[j]].target].y, v[i].x, v[i].y);

				distSquare -= v[i].radiusSquared;

				// prevents from dividing with Zero. No Math.abs() call
				// for performance
				if (distSquare < minDistanceLimitSquared)
				{
					distSquare = minDistanceLimitSquared;
				}

				// Only bother with the divide if the node and edge are
				// fairly close together
				if (distSquare < maxDistanceLimitSquared)
				{
					energy += edgeDistanceCostFactor / distSquare;
				}
			}
		}
		return energy;
	}