topic vector calculation for hierarchies