Attribute-enhanced network-motif framework: reference implementation and synthetic validation
Abstract
Reference implementation accompanying the manuscript "Attribute-enhanced network motifs and contrasting fan-out and fan-in roles in tourism and second-hand luxury communities" (Tengfei Shao). The manuscript was not published; its degree-driven headline has been withdrawn by the author, and a successor cautionary note, "Auditing bipartite motif interpretations: a worked example with conservation checks and open-path decomposition", has been submitted to PeerJ Computer Science. The code is kept available so that every number in the manuscript remains reproducible. v5 correction (2026-09-04). Earlier versions of this deposit (v1 to v4; v1 to v3 have since been withdrawn by the author, v4 remains available) sampled the bipartite degree-preserving null with a swap routine that stopped after a fixed number of accepted swaps. That rule samples the embedded jump chain and oversamples graphs with more available moves. v5 counts proposed swaps (rejections are steps of the chain), which gives the uniform stationary distribution over graphs with the observed degree sequences; the legacy rule is retained only as degree_swap(..., count="successes") for reproducing earlier numbers. On the tourism network the correction moves the reported z-scores by about 0.3 at most (0.27 for the open path against the 500 x |E| record ensemble; up to 0.35 against the corrected deposit script) and leaves all conclusions unchanged. Note also that the size-4 open-path deficit reported in the manuscript admits the exact identity P4 = Σedges (da − 1)(do − 1) − 4·C4; the successor note shows that the split of the deficit between the degree–degree mixing term and the four-cycle term is not identifiable from the marginal decomposition and is not stable under tourist deletion or edge threshold, so no class-level attribution is claimed. Fan-motif counts at sizes 3 and 4 are exact functions of the degree sequences (Σ C(d,2), Σ C(d,3); Wegner 2014, arXiv:1408.6303) and therefore carry no information under a degree-preserving null. Contents. motif_operator.py (Algorithm 1 topology-only count; Algorithm 2 with the attribute re-attachment operator Φ; the bipartite degree-preserving null with the corrected proposal-counted sampler; size-4 overlap and open-path counters); validate_operator.py (synthetic ground-truth validation, Figure 3); crossdomain_analysis.py (cross-domain proportions, entropies, role shares, and both Pearson- and Spearman-statistic permutation correlations, data only); tourism_overlap_null.py (empirical size-4 overlap and open-path nulls on the tourism network); sci_style.py with fig3_luxury.py, fig4_tourism.py and fig6_crossdomain.py (Figures 4–6). The synthetic validation and all cross-domain computations run end to end from synthetic or aggregate, non-proprietary inputs bundled with the code; tourism_overlap_null.py additionally reads an anonymized tourism edge list that is not bundled in this record and is deposited separately with the successor note. MIT License.
Publication details
- Journal / source
- Zenodo (CERN European Organization for Nuclear Research)
- Publication date
- 4 September 2026