I.e., if A has sent to B, distance = 1. If A has sent to B and B has sent to C, distance between A and C is 2.
You would have to parse the entire blockchain and construct a graph where nodes are addresses and edges are direct transactions between two accounts. Then you would perform Dijkstra's algorithm: https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
As per Sasa's answer, you'd need to generate a dataset that could then be interpreted in the appropriate way.
Instead of generating your own from the raw chain data, you could use something like Google's BigQuery public Ethereum dataset and run the appropriate query. (You'll need to enable the Cloud Platform API before you can browse the public datasets.)
It looks like the dataset was last updated on 4 Mar 2019, but there are instructions on how it was generated, here, so it may be possible to copy the public data and update it.
For existing examples of what can be done with the BigQuery data, see this clustering study: Clustering Ethereum Addresses. This used different measures of distance between addresses (e.g. Euclidean and cosine distances1) to categorise addresses into connected clusters.
There are probably better existing tools out there, such as the ones used by chain analysis/forensics groups.
1 More on distances in data science, here.
the true measurement between two addresses would be a subtraction of one from another, like this:
address1 := common.HexToAddress("0x.......") address2 := common.HexToAddress("0x.......") big_a1 := new(big.Int) big_a2 := new(big.Int) big_a1.SetBytes(address1.Bytes()) big_a2.SetBytes(address2.Bytes()) big_diff := new(big.Int) big_diff.Sub(big_a2,big_a1) fmt.Printf("difference = %v\n",big_diff.String())