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
File details
Details for the file clustering_coefficient-0.1.1.tar.gz
.
File metadata
- Download URL: clustering_coefficient-0.1.1.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.5 Darwin/23.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dc816b407e43f2bd66a1ce5b205b6e856cfe3be866f5aaa9db255dcaf9858ac |
|
MD5 | f3587576dce0e69aaa568fab36517e9e |
|
BLAKE2b-256 | b3c076a34a5dcb5833f57bbed0f4cda43757f0b7a9ba4b42e9b818ee42343f75 |
File details
Details for the file clustering_coefficient-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: clustering_coefficient-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.5 Darwin/23.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf5c6aedcf48144732871adcc87cb2528ce8b0aa7746e6716cb0515d1a183ac6 |
|
MD5 | d4f6f3e321b595e5f25d9ed42ed94b26 |
|
BLAKE2b-256 | 7e96d45579bf342abe6d0eef1cd42131584eb7a36dc7891f8be9f6d06af46f93 |