graphology icon indicating copy to clipboard operation
graphology copied to clipboard

feature request: clustering coefficient

Open kennylbj opened this issue 2 years ago • 7 comments

Is there a way to calculate the clustering coefficient for the graph and the node? Or any plan to support this? thanks.

kennylbj avatar Jul 05 '22 06:07 kennylbj

Hello @kennylbj, I will need more details/context for your request. What do you call clustering coefficient here? Are we speaking about this definition (which is not the only one): https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.cluster.clustering.html#networkx.algorithms.cluster.clustering ?

Yomguithereal avatar Jul 05 '22 08:07 Yomguithereal

@Yomguithereal Yes, that's exactly what I requested, Same definition can be found in wikipeida.

kennylbj avatar Jul 05 '22 08:07 kennylbj

Ok. Let me figure out if I need to enumerate actual triangles to compute the metric (in which case I must refactor my triangle enumerating routine using the Chiba-Nishizeki algorithm beforehand) or not. If I don't need that, it should be straightforward to implement (for unweighted graphs, at least).

Yomguithereal avatar Jul 05 '22 08:07 Yomguithereal

Hello, Do we have any news on this issue? Or there is a way to calculate the clustering coefficient of a graph? Thanks!

javieralaminos avatar Jan 15 '24 12:01 javieralaminos

No news sorry. Did not have time nor incentive to work on this lately.

Yomguithereal avatar Jan 15 '24 12:01 Yomguithereal

Well, thats bad news :( Could you point me in a direction in how to calculate this? We need to include this calculation in our graph.

javieralaminos avatar Jan 29 '24 12:01 javieralaminos

networkx has some code to do this here: https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.cluster.clustering.html#networkx.algorithms.cluster.clustering if you want the metric for nodes. You could replicate it using graphology but this is not a simple thing to do.

Then if you "just" need some metric related to the importance of a node, maybe another of the centrality metrics already implemented could also fit the bill? The clustering coefficient is quite niche and I have never seen it used in the wild, but again I am coming from visual network analysis and I don't know all scientific disciplines that might absolutely need the clustering coefficient for very good reasons beyond my knowledge.

Yomguithereal avatar Feb 02 '24 09:02 Yomguithereal