Structural polarization and segregation measures for networks.
Project description
NetSegPol
This repository provides a lightweight, object-oriented Python toolkit for computing structural polarization and segregation measures in networks. It implements a wide range of classical and modern network mixing, segregation, and polarization indices used in sociology, computational social science, and network science.
How to use?
You should not use descriptive measures without a null-model.
from netsegpol import Measurer
edges = [
# Group 0
(0, 1), (0, 2), (1, 2), (1, 3),
(2, 3), (2, 4), (3, 4), (0, 4),
# Group 1
(5, 6), (5, 7), (6, 7), (6, 8),
(7, 8), (7, 9), (8, 9), (5, 9),
# Sparse inter-group edges
(2, 6), (3, 7), (1, 8), (4, 9)
]
membership = {
0: 0, 1: 0, 2: 0, 3: 0, 4: 0,
5: 1, 6: 1, 7: 1, 8: 1, 9: 1
}
measurer = Measurer(edges,
membership,
directed = False,
safe_create = True)
print(measurer.segregation_matrix_index()) # or the function that you want to use
What should I be careful of?
You should be careful if you are using an external package like igraph and getting the edge list directly since indexing methods might differ and your edgelist and membership dictionary might not match.
Will there be new measures?
This is still a project in its infancy, hence a few of the measures will be developed later on, such as Ergodic Markov Chain mixing time or Spectral Segregation etc.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file netsegpol-0.1.0.tar.gz.
File metadata
- Download URL: netsegpol-0.1.0.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03912580ce86f7177f2105e84b28769771c9e6319b824767d3c5368cf67ecb12
|
|
| MD5 |
5784d25ce194876d92eb2f10b7ba64e3
|
|
| BLAKE2b-256 |
490cfe026737e2e4de0be7a2559104266ad60ad5fc50d8436286a2f1d9a4aa03
|
File details
Details for the file netsegpol-0.1.0-py3-none-any.whl.
File metadata
- Download URL: netsegpol-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
557b096396a9b733afcc7f42c906c33b70e783f84d4c73ccb479612276d409aa
|
|
| MD5 |
f69a6efa9352c5649b4d8aead41a625f
|
|
| BLAKE2b-256 |
d4ba157e6824e62f3f40db81b5ab15d0a108d17497fe310378c4c64b2fbf7bee
|