squidpy icon indicating copy to clipboard operation
squidpy copied to clipboard

understand centrality scores

Open z-spider opened this issue 11 months ago • 0 comments

Hi,

Thank you for this great package. The average clustering in a package is calculated with the following code

clusters = adata.obs[cluster_key].values
nx.algorithms.cluster.average_clustering(graph, clusters)

or in file: https://github.com/scverse/squidpy/blob/e77237c62dcad0efb4b8840f281466cc2a578f33/src/squidpy/gr/_nhood.py#L281

But if I use subgraph, like nx.algorithms.cluster.average_clustering(graph.subgraph(clusters)) to calculate, the result will be different, and I find the second result easier to interpret. I'm not an expert on this, should it be modified here? Or maybe I misunderstood something?

Any explanationwould be greatly appreciated!

z-spider avatar Feb 06 '25 01:02 z-spider