# r - dimensional mesh inquiry

I am attempting to compute the ordinary range in between any kind of 2 nodes in an $r$ - dimensional mesh.

This is a $3$ - dimensional mesh with $n=3$

To pick any kind of 2 factors in the mesh there are $\left(n^r \left(n^r - 1\right)\right)/2$ means of doing this.

So if we pick 2 factors in the mesh $p\lbrace 1, 2, ..., r \rbrace$ and also $q\lbrace 1, 2, ..., r \rbrace$ The range is computed as the Manhattan Distance

$\sum_{i=1}^{r} \left| {q_i - p_i} \right|$

Now i need to locate the complete range in between all nodes and also separate that by the the variety of means of picking 2 nodes (offered over).

I recognize just how to do this by considering this 3 - dimensional instance which needs to work with the r - dimensional instance additionally yet i am having problem sharing it in some type of amount notation.

Below is just how i assume i can get the complete range in between all nodes, i wish this is clear.

In this 3 - d mesh allow is think the nodes are classified $\left( 1, 1, 1 \right)$ to $\left( 3, 3, 3\right)$. Allows start at $\left( 1, 1, 1 \right)$ and also summarize the range in between this node and also all various other nodes. After that we relocate to $\left( 1, 1, 2 \right)$ and also summarize the ranges in between this node and also all various other nodes with the exception of $\left( 1, 1, 1 \right)$ due to the fact that we have actually currently counted the range in between $\left( 1, 1, 1 \right)$ and also $\left( 1, 1, 2 \right)$. After that we relocate onto $\left( 1, 1, 3 \right)$ and also summarize all with the exception of $\left( 1, 1, 1 \right)$ and also $\left( 1, 1, 2 \right)$. We proceed this till we permute via in order $\left( 1, 1, 1 \right)$, $\left( 1, 1, 2 \right)$, $\left( 1, 1, 3 \right)$, $\left( 1, 2, 1 \right)$, $\left( 1, 2, 2 \right)$, ect ... Does that make good sense?

That need to offer me the complete range without counting anything two times. After that i separate that by the variety of means of picking 2 nodes and also i will certainly have the ordinary range. Does this audio proper to you? Any kind of aid would certainly be valued.

0
2019-05-18 22:11:50
Source Share
This strategy is proper, yet extra job than called for. Making use of the taxicab statistics each measurement is independent. Taking a dice of side n you can count the upright sectors made use of as adheres to: from the lower layer to the next layer up, we count $n^2$ (factors under layer) times $n^2*(n-1)$ (factors over the lower layer) = $n^4*(n-1)$. For the next layer you have $2*n^2*n^2*(n-2)$ and more. The $n^4$s disperse out and also you can simply think of the complete range along a line of size n. This is $\sum_{i=1}^{i=n}i*(n-i)$. After that increase by $n^4$ and also you have the complete use in the upright instructions. After that increase by 3 for the complete use in each instructions. And also divide by the variety of sets of factors, which you have actually computed currently. The expansion to various variety of measurements or non - cubical meshes need to be clear.