Is there a theory of partially-defined metric spaces? Is there a theory of metric spaces in which the distance between a given pair of points need not be defined?
I'm aware that there is a theory of partial metric spaces, but these deal with a different generalization of metric spaces, viz. ones in which $d(x,x)=0$ does not necessarily hold.
What I'm interested in here is the case where the metric axioms hold as far as all distances appearing are defined (I assume that $d(x,x)=0$ is always defined, and $d(y,x)=d(x,y)$ is defined if $d(x,y)$ is defined), but there may be pairs of points for which the distance is not defined. (A trivial example would be a disjoint union of two metric spaces.) Is there a theory of such structures?
In particular I'm interested in conditions under which the partially-defined metric can be consistently extended into a metric.
 A: It seems that one can in many cases construct an extended metric space from what I'll call a merometric space $X$ (i.e. the kind of partially defined metric space considered in the question) by proceeding as follows:

*

*Call a finite sequence $\gamma$ of points $\gamma_i\in X$ a polygonal path if the distances $d(\gamma_i,\gamma_{i+1})$ are all defined.

*Assign to every polygonal path a length $\ell(\gamma)=\sum_i d(\gamma_i,\gamma_{i+1})$.

*Set the distance $D(x,y)=\inf_{\gamma,\gamma_0=x,\gamma_N=y} \ell(\gamma)$.

If there are no polygonal paths from $x$ to $y$, $D(x,y)=\infty$, so this is an extended metric. If $d(x,y)$ is defined, $D(x,y)\le d(x,y)$, so there is a reasonable sense in which $D$ completes $d$. The triangle inequality and symmetry are trivially fulfilled. The only obstruction that can arise is that in the presence of an infinite number of polygonal paths this construction can yield $D(x,y)=0$ for $x\not=y$, in which case $D$ isn't a metric. I haven't been able to figure out a necessary and sufficient condition that prevents this.
