Hello I'm trying to figure out how to calculate the average distance between two nodes in a weighted undirected graph. Furthermore, this graph is a tree so it has V - 1 edges.
I thought about using Floyd Warshall to compute all-shortest paths and then calculate the average. But that would turn out to be in O(E^3) time complexity. And it really isn't enough.
I've also been thinking of using Dynamic Programming to solve it but I can't really see how... Can anyone give me a few pointers please? I don't want a direct answer, just a few tips so that I can keep thinking about it :)