Efficient and Optimal Algorithms for Tree Summarization With Weighted Terminologies