As far as I understand, there are three possibilities to calculate a graph in scanpy.

We can go with the UMAP method along with knn=True and with the Gauss method with knn=True and knn=False.

I’m getting a bit lost in terms of how distances are transformed into connectivities. If we are starting with knn graph, we already get rid of some edges in the graph, and the directed graph is created (the relation does not have to be symmetric). After that, the weights are calculated on the output and we end up with a non-directed graph with weights. The structure is the same, there are just edges that create a non-directed graph. And that’s where I have doubts.

Here is an example :

Simple graph with 10 points, UMAP method of calculating connectivities and n=3.

Node 6 has node 7 and node 8 as its nearest neighbors in the knn (distance graph). In the connectivity graph, node 6 is connected with node 7,8 and node 0. Looking at the distance matrix, the third nearest node to node 6 is node 3. However, there is no connection from node 6 to node 3, instead there is a connection 6->0, whereas 0 is the sixth nearest in the original distance matrix.

I just don’t understand why there are not more connections created when transforming from distance-> connectivity.