Computes the clustering coefficient of nodes as defined by Watts & Strogatz (in their 1998 paper).
Project description
Clustering Coefficient
This script allows to compute Watts & Strogatz's clustering coefficient of nodes in a graph $G = (V, E)$. It is defined as the edge density of the graph induced from neighbors of a node, relatively to a clique of comparable size. More precisely, given a node $u \in V$, denoting its set of neighbors as $N_G(u)$, the clustering coefficient of $u$ is equal to:
$C_G(u) = \frac{|E(N_G(u))|}{d(d-1)/2}$
where $d = |N_G(u)|$ is the degree of node $u$ (its number $|N_G(u)|$ of neighbors).
Installing and using the plugin
The library relies on tulip-python
, a python binding of the C++ Graph Visualization framework Tulip. Tulip also comes as a GUI.
Several libraries need to be installed prior to using the plugin, that can for instance be installed running poetry install --no-root
. The specific dependencies are listed as part of the pyproject.toml
file. A simple test script can optionally be run.
The plugin itself is typically used as:
# assuming a graph as already been defined
params = tlp.getDefaultPluginParameters('Clustering Coefficient', graph)
clustering = graph.getDoubleProperty('clustering coeff')
params['result'] = clustering
graph.applyDoubleAlgorithm('Broker score', clustering, params)
Alternatively, the plugin may be used within the Tulip GUI after the script has been loaded and ran.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for clustering_coefficient-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c30c67a7a3208bdf12be21c31b90619b433dee9b19f7f277bf8b1f81acb3df8 |
|
MD5 | f876e7e1fad028564158162846668bea |
|
BLAKE2b-256 | 416afba0e9eaa10950eadb4e04d2cc97e3bfa7dcea6916db82f2708395fc8f09 |
Hashes for clustering_coefficient-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 144546a55ad5399d3778ea2e9c29c9ce2746d584bb1ff7154343957155f84ca3 |
|
MD5 | a58ba0220e9066a2ccf970ef87af1307 |
|
BLAKE2b-256 | 1a760f47c547dad469c048219d79eb332cc80e5f31b2fc4cb64e83c4a161b96c |