Minimum path distance from a source

34 Views Asked by At

Suppose I have a path-connected subset $I$ of $\mathbb{R}^n$ (not convex, but can be contained in a product of finite-measure closed intervals), and I define a "source point" $a \in \mathbb{R}^n$. Define $d_I: I \times I \to \mathbb{R}$ such that $d_I(x,y)$ is the length of the shortest path through $I$ connecting $x$ and $y$.

I would like to define a function $f_a: I \to \mathbb{R}$ as follows. If f $a \in I$, then $f_a(x) = d_I(a,x)$; if $a \notin I$, then $f_a(x) = d(I,a) + d_I(a_0,x)$, where $d$ is the Euclidean distance function and $a_0$ satisfies $d(a,a_0) = d(I,a)$. If I relax conditions on $I$ and say it is locally path-connected, but may be separated into a finite number of disjoint open subsets, then I'm pretty sure this function $f_a$ remains well-defined.

Does anybody know of a practical way to compute $f_a$?

The specific motivation for this question is the following: I have a simple binary image, and I would like to grade each nonzero point $x$ in that image by the distance between $x$ and a source point $a$ that I choose. However, I would like that distance computation to be made under the constraint that the path between $a$ and $x$ must be between nonzero points wherever possible; otherwise, the path takes the shortest possible jump between nonzero points that it can.

Any recommendations or algorithms or advice would be appreciated!