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.
Metadata
Release files for netsegpol 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| netsegpol-0.1.0.tar.gz | 13.4 kB | Without provenance | Details for netsegpol-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| netsegpol-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for netsegpol-0.1.0-py3-none-any.whl |
Total release size: 26.3 kB
Release files / netsegpol-0.1.0.tar.gz
| Download URL | netsegpol-0.1.0.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
03912580ce86f7177f2105e84b28769771c9e6319b824767d3c5368cf67ecb12
|
|
BLAKE2b-256 checksum How to use checksums |
490cfe026737e2e4de0be7a2559104266ad60ad5fc50d8436286a2f1d9a4aa03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / netsegpol-0.1.0-py3-none-any.whl
| Download URL | netsegpol-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
557b096396a9b733afcc7f42c906c33b70e783f84d4c73ccb479612276d409aa
|
|
BLAKE2b-256 checksum How to use checksums |
d4ba157e6824e62f3f40db81b5ab15d0a108d17497fe310378c4c64b2fbf7bee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Security for netsegpol 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.