Given an undirected connected graph with N nodes and N-1 edges.Out of N  nodes, 1...k nodes are selected, out of which 2 nodes are selected randomly (uniformly).How do I calculate the expected distance between those 2 points?By the way, I tried using sum of distance between all pairs of k nodes and divided it by k to get the distance. Denominator is correct. But this gives wrong answer. How do I correct the approach?
Expected distance between two random nodes in weighted tree
algorithms;graphs;trees;probability theory