scverse / scverse/scanpy

Diagonal of connectivities for diffusion maps is zero - is this intended?

Open
#2,451 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.6k
Forks
779
Avg merge
1d 4h
Merged PRs (30d)
27

Description

My question is about the connectivities used within this function: https://github.com/scverse/scanpy/blob/0692ef9ea30335b95f7e7f9aab7be856469d9f35/scanpy/tools/_dpt.py#L16
the computation that uses connectivities is as follows:
https://github.com/scverse/scanpy/blob/0692ef9ea30335b95f7e7f9aab7be856469d9f35/scanpy/neighbors/__init__.py#L914-L925

I can follow most of this computation and link it back to the main reference, except for the fact that the connectivities (i.e. adata.obsp['connectivities']), when calculated using scanpy.pp.neighbors as suggested in the diffmap docstring, have a zero diagonal.

Could someone confirm whether this is the intended calculation? And if so, provide a reference that confirms this? I've not read the reference in detail, but I would've thought (following section 3.1 and 5) that, as all the computations revolve around the usage of a kernel, the connectivities should be positive definite before normalization, which wouldn't be the case if the diagonal was zeroed out. At a glance, I also cannot find anywhere in that reference that talks about P(xi, xi).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the linked sections of scanpy/tools/_dpt.py and scanpy/neighbors/init.py, then compare the connectivities construction with sections 3.1 and 5 of the cited diffusion maps reference. The issue is complete when the intended diagonal behavior is confirmed and the repository has a clear code or documentation follow-up if needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.