Builds a tree out of a set of paths.