A distance metric based on tree paths The type of space you're looking at is a real tree: https://en.wikipedia.org/wiki/Real_tree