Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
A small update: My answer mainly addresses how to transform a general dissimilarity function into a metric. The original question was more related to an even more basic step: Turning a similarity function into a dissimilarity function. One way, as used in the thesis above, is $d(u,v) = s(u,u) + s(v,v) - 2s(u,v)$, for example. Or, assuming that similarity decays exponentially with distance (common assumption in psychology), you'd have the relationship $s(u,v) = e^{-c\cdot d(u,v)}$, for some constant $c$. This can, of course, be combined with the symmetry fixing mentioned earlier.