Making a direct path when both the start and end point is not on a graph?

Hello,
I noticed that when the seeker and the target points are both off any graph, it will create a path that goes from the seeker, to the nearest node on the nearest graph and THEN to the target point (almost creating a triangle). Is there a way to make it so the seeker goes directly to the target point and not on any graphs?

I believe path[1] and path[2] (the middle elements of the path array) are what get calculated differently from the starting and ending elements (path[0] and path[3]), and that’s probably why this happens.

That’s why I need a GetNearest() function that will return null if the point is not on a graph.