Find the edge which is not a part of any possible diameter of a tree
问题 I'm curious if there is a quick way to find if an edge exists which is not a part of any possible diameter of a n-ary tree. For example in the following tree, A-B edge will not be a part of any diameter. I tried by listing down all the possible diameters, but that takes a lot of time and I'm certain that there is a faster way. 回答1: Let's begin with a simpler question: how would we find any diameter of the tree? One way to do this would be to pick some node and to root the tree at that node. A