Closed almaan closed 1 year ago
thanks @eroell that's indeed the explanation. @almaan for the arguments you selected coord_type='generic', radius = None
it's indeed just a call to NNeighbors from sklearn and then resetting the diagonal as explained by @eroell .
Hej @giovp ,
I'm a bit late catching up with this, but @eroell 's explanation made tons of sense - it was just me being confused with the names.
Thanks!
Hej @giovp ,
I'm a bit late catching up with this, but @eroell 's explanation made tons of sense - it was just me being confused with the names.
Thanks!
hi @almaan ,
there was indeed a bug in the construction of the spatial graph in knn mode, I've just made a new release with #792 included, that should solve the error you found, which was indeed not related to https://github.com/scverse/scanpy/issues/2587
Description
Hej!
When using the function
sq.gr.spatial_neighbors
and specifyingn_neighs=k
withradius=None
, my expectation is that the resulting connectivity matrix would give me the connectivities s.t. each cell is connected to itsn_neighs
nearest neighbors. That is, if I were to sum the connectivity matrix along the second dimension (a.k.a. along the cell axis), it should returnk
for every cell. However, this is not the case - upon inspection, the function returns a varying number of neighbors for the different cells.I'm not sure if this is an intended feature or a bug, but from reading the documentation I wouldn't consider this as the expected outcome.
...
Minimal reproducible example
Version
1.3.0
...
Cheers, Alma