netseg: a Python Package for Measuring Structural Polarization and Segregation in Social Networks

📅 2026-09-14
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
netseg是一个Python包,用于量化社交网络中的结构极化和隔离现象,通过实现并优化多种网络指数来解决现有代码不公开、未经测试的问题。
📝 Abstract
The study of structural polarization and segregation in social networks is an established line of research, and the quantification of both phenomena proceeds through a set of widely cited network indices. The code implementing those indices, however, is seldom released and almost never tested. We present netseg, a comprehensively documented Python package implementing these indices, most of them generalized to more than two groups and to directed as well as undirected input. It ports the R package of the same name and adds measures the R version lacks, among them Random Walk Controversy, Boundary Connectivity, Dipole Moment, and Moran's I. The package operates on igraph objects and performs the underlying graph operations (e.g., neighborhood queries and random-walk simulation) through igraph's Python interface, so that they execute in compiled code rather than in interpreted Python. For several of the indices this yields runtimes orders of magnitude below those of the available open-source implementations, which the documentation reports in benchmarks. Most of these indices are defined as a divergence from a null model, and published implementations fix that null model to a uniform random graph of matching density. netseg accepts an ensemble of graphs as a sample from an arbitrary null model, and distinguishes indices that already incorporate a baseline from those that do not, adjusting the comparison accordingly to avoid double subtraction. The documentation provides, for each index, a worked empirical example, its behaviour at the degenerate cases where it is undefined, a benchmark, and the procedure for substituting a custom null model. We report the behaviour of every index over a parameter sweep of a generative opinion model, and apply them to a county-level railroad network built from nineteenth-century operator records joined to full-count census data.
Problem

Research questions and friction points this paper is trying to address.

structural polarization
segregation
social networks
network indices
Innovation

Methods, ideas, or system contributions that make the work stand out.

structural polarization
network indices
igraph
random walk controversy
null model
💼 Related Jobs
No related jobs found.
O
Onur Tuncay Bal
Department of Network and Data Science, Central European University, Vienna, Austria
M
Michał Bojanowski
Department of Quantitative Methods and Information Technology, Kozminski University, Warsaw, Poland and Department of Social and Cultural Anthropology, Autonomous University of Barcelona, Spain