Skip to main content

Community Broker Score

The community broker score quantifies brokers reach and control at the meso level in social networks. The measure was developed in: Paquet-Clouston, M., Bouchard, M. (2022) A Robust Measure to Uncover Community Brokerage in Illicit Networks. Journal of Quantitative Criminology https://doi.org/10.1007/s10940-022-09549-6

All information about the measure can be found here: https://link.springer.com/article/10.1007/s10940-022-09549-6. This repository allows one to calculate the community broker score as presented in the study on one's own networks, as explained below.

Local Community Broker Score:

The local community broker score is calculated for each partition (also known as a community structure) found through a community detection algorithm (in the paper, we used the Leiden algorithm). This local score quantifies, for each bridge created between two different communities, the bridge’s size (the number of people connected through the bridge), efficiency (how easily these people can be reached (i.e., cohesion) and exclusivity (whether other brokers connect these two communities).

Global Community Broker Score:

The global community broker score is an average of all local scores, making it robust to the inherent randomness of community partitioning. The averaged global score thus follows the partition distribution found when running the community detection algorithm thousands of times. This implies that a partition that emerges more often has more weight than an outlier partition (although the outlier partitions are still considered).

This package allows one to calculate the local community broker score given a known partition. Info package: https://pypi.org/project/Community-Broker-Score/

Format of edge and node files:

A node dataframe with two mandatory ordered columns:
  - Column 1: id of each unique node
  - Column 2: id of the community in which each unique node belongs

An edge dataframe with the first two columns representing an undirected relationship (a tie or an edge or a pair) between two nodes.

Procedure

Package info: https://pypi.org/project/Community-Broker-Score/

Install Package

pip install Community-Broker-Score

Import package in environment:

from community_broker_score import community_broker_score as cb 

Needed Python libraries (library dependencies):

pandas as pd
numpy as np
networkx as nx

Package Functions:

Calculate the local community broker score

cb.local_community_broker_score(nodes, edges)

Extract the cohesion score (average_shortest_path_length from networkx), number of people and number of brokers for each community

cb.find_community_characteristics(nodes, edges)

Detect each edge that is a bridge between two communities and create a dataframe with only these edges

cb.detect_brokering_edges(nodes, edges)

Detect community brokers and tag them as such in the node dataframe

cb.detect_community_brokers(nodes, edges)

Example

An example is provided in a Jupyter Notebook on this Github repository: https://github.com/Masarah/community_broker_score

Testing

Using pytest

python -m pytest tests/test_broker_score.py

Metadata

Release files for Community-Broker-Score 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Community-Broker-Score 0.1.5
File Size Uploaded
Community_Broker_Score-0.1.5.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Community-Broker-Score 0.1.5
File Interpreter ABI Platform
Community_Broker_Score-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / Community_Broker_Score-0.1.5.tar.gz

Download URL Community_Broker_Score-0.1.5.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
81ecca57f871093b407bc8a90585a38339644db1d510cfe2d9b28a6d5047f762
BLAKE2b-256 checksum
How to use checksums
b01864c4eb781438fc2ede21457c0d949989e18c70bd5287644f79c50216ef1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.1

Release files / Community_Broker_Score-0.1.5-py3-none-any.whl

Download URL Community_Broker_Score-0.1.5-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fce54a1180b4939cfb66e7b5ef254f9adaa9a03f17e76b744a57e0cbce2cd39
BLAKE2b-256 checksum
How to use checksums
2a78a61ad3f8eabd9225ee5e5de530ba758fb3fabc61914eb566f4a59aa86992
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

0.0.9

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page