Topological matching using contour trees