arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2609.16088cs.SIcs.CY

netseg:用于测量社交网络中结构极化和隔离的Python包

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

Onur Tuncay Bal, Michał Bojanowski

首次发表
浏览论文内容

中文总结 AI 辅助

netseg是一个Python包,实现了社交网络结构极化和隔离的多种指标,支持多组和有向图,性能优于现有实现,并允许自定义零模型,应用于历史铁路网络分析。

中文摘要 AI 辅助

结构极化和隔离在社交网络中的研究是一个成熟的研究方向,对这两种现象的量化通过一组被广泛引用的网络指标进行。然而,实现这些指标的代码很少被发布,也几乎从未经过测试。我们提出了netseg,一个文档全面的Python包,实现了这些指标,其中大多数已推广到多于两个群体以及有向和无向输入。它移植了同名的R包,并添加了R版本所缺少的度量,包括随机游走争议、边界连通性、偶极矩和莫兰指数I。该包操作于igraph对象,并通过igraph的Python接口执行底层图操作(例如,邻域查询和随机游走模拟),以便它们在编译代码中而非解释型Python中执行。对于几个指标,这导致运行时间比可用的开源实现低几个数量级,文档在基准测试中报告了这一点。大多数这些指标被定义为与零模型的偏差,已发布的实现将该零模型固定为具有匹配密度的均匀随机图。netseg接受一个图集合作为任意零模型的样本,并区分已经包含基线的指标和未包含基线的指标,相应调整比较以避免双重减去。文档为每个指标提供了实证示例、其在未定义退化情况下的行为、基准测试以及替换自定义零模型的程序。我们报告了每个指标在生成性意见模型参数扫描中的行为,并将它们应用于由19世纪运营商记录与全量人口普查数据连接构建的县级铁路网络。

英文摘要

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.

↑