There are n circles with radius r, the origin of the i-th circle is located at (x[i], y[i]). I would like to find the distance of the shortest path from the origin of the first circle to the origin of the last circle, and any point on the path is located inside one or more circle.
Below is a demonstration for three circles located at (3, 3), (3, 7) and (6, 7), the blue line is the shortest path.

I have tried to find the intersections of each pair of circles and run a shortest path algorithm, however that result in a time complexity of O(n^5). I would like to know if there exists a better algorithm that runs faster. Thanks.