Given a Undirected Weighted Planar Graph with $N$ nodes and $N-1$ edges each having different weight $w$. Between two nodes there is exactly one path that goes through the edges and nodes such that no node appears in the path more than once.
Given some nodes $A$1, $A$2$, ...,A$ K. $2$ nodes are taken at random from these nodes.
How to calculate the distance between those two randomly chosen nodes ?( The answer will be in a form of rational numbers)
By the way, I tried taking all pairs of points in the list $A$1, $A$2$, ...,A$ K and added sum of the distances between them i.e $(k*(k-1))/2$ pairs and divided it by K i.e. total number of points in the list. But this gives wrong answer. It is giving more in numerator.
Without specific conditions imposed on the shape of the graph $G$, weights $w_e$ of its edges $e$, the given set $\{A_1,\dots, A_k\}$ of nodes and on the probability $p_{ij}$ (for $i<j$) of the random choice of each pair $\{A_i, A_j\}$ of the given nodes I can propose a straightforward algorithm, which has a complexity polynomial with the respect to the number of nodes of the graph $G$.
First of all we do a preprocessing which calculates the weighted distance $d_w(v,u)$ between each pair $v$ and $u$ of nodes of the graph $G$. This can be done recursively as follows. Let $v$ be a leaf of the graph $G$. Calculate the weighted distances between each pair of nodes of the induced graph $G - v$. Let $u$ be a unique neighbor of the node $v$. For each node $u’$ of the graph $G- v$ put $$d_w(u’,v)= d_w(u’,u)+w(u,v).$$
Now the expectation which you are asking for is
$$\sum_{1\le i<j\le K} p_{ij}d_w(A_i,A_j).$$
Update. In particular, if “2 nodes are taken at random from these nodes” means that the pair $\{A, B\}$ of the given (not necessarily distinct) nodes is constructed by independently picking nodes $A$ and $Bj$ such that each of them has a probability $r_i=P\{A=A_i\}= P\{B=B_i\}$ (in particular, for the uniform distribution $r_i=1/K$) then $p_{ii}=r_i^2$ (anyway, we don’t sum weighted distances $d_w(A_i,A_j)$ because they are zero) and $p_{ij}=2r_ir_j$ if $i<j$.