Maximal Tree Diameter

Sort by

recency

|

7 Discussions

|

  • + 0 comments

    same to what?

  • + 0 comments

    Can someone explain how is best_up calculated in tester sol?

  • + 0 comments

    What is wrong with this approach. First I applied dfs two times to get the maximum diameter and the path of the maximum diameter. Coloring all these node occuring in maximum diameter path with black color, I applied dfs for these nodes getting the maximum length starting from this node not including the black nodes. then adding the maximum distance obtained by applying dfs two time and the maximum distance obtained from these black nodes.

  • + 0 comments

    I'm getting off by one for half the test cases and cant seem to see why. Can anyone help? I performed BFS from a node u, returning node v, where node v is at maximal distance from u. Then i marked all nodes in the predecessor path from v back to u as black. Then I ran a DFS on all remaining nodes to find the diameter of all trees in the forest created by not considering black nodes, taking the maximal of all these diameters and adding it to the diameter of the original graph (the length of the predecessor path from v back to u). This should work!

  • + 1 comment

    Can this be done by adding one to the maximum path length?