tadc-sbm 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tadc_sbm-0.1.5/LICENSE.md +201 -0
- tadc_sbm-0.1.5/PKG-INFO +183 -0
- tadc_sbm-0.1.5/README.md +157 -0
- tadc_sbm-0.1.5/pyproject.toml +46 -0
- tadc_sbm-0.1.5/setup.cfg +4 -0
- tadc_sbm-0.1.5/setup.py +3 -0
- tadc_sbm-0.1.5/tadc_sbm.egg-info/PKG-INFO +183 -0
- tadc_sbm-0.1.5/tadc_sbm.egg-info/SOURCES.txt +21 -0
- tadc_sbm-0.1.5/tadc_sbm.egg-info/dependency_links.txt +1 -0
- tadc_sbm-0.1.5/tadc_sbm.egg-info/entry_points.txt +2 -0
- tadc_sbm-0.1.5/tadc_sbm.egg-info/requires.txt +5 -0
- tadc_sbm-0.1.5/tadc_sbm.egg-info/top_level.txt +1 -0
- tadc_sbm-0.1.5/tadcsbm/__init__.py +8 -0
- tadc_sbm-0.1.5/tadcsbm/main.py +207 -0
- tadc_sbm-0.1.5/tadcsbm/simulations/__init__.py +9 -0
- tadc_sbm-0.1.5/tadcsbm/simulations/heterogeneous_sbm_utils.py +144 -0
- tadc_sbm-0.1.5/tadcsbm/simulations/heterogeneous_sbm_utils_test.py +93 -0
- tadc_sbm-0.1.5/tadcsbm/simulations/sbm_simulator.py +568 -0
- tadc_sbm-0.1.5/tadcsbm/simulations/sbm_simulator_test.py +207 -0
- tadc_sbm-0.1.5/tadcsbm/simulations/simulations.py +159 -0
- tadc_sbm-0.1.5/tadcsbm/simulations/simulations_test.py +84 -0
- tadc_sbm-0.1.5/tadcsbm/tadcsbm_simulator.py +206 -0
- tadc_sbm-0.1.5/tadcsbm/utils.py +261 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
tadc_sbm-0.1.5/PKG-INFO
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tadc-sbm
|
|
3
|
+
Version: 0.1.5
|
|
4
|
+
Summary: A Time-varying, Attributed, Degree-Corrected Stochastic Block Model
|
|
5
|
+
Author-email: Nelson Aloysio Reis de Almeida Passos <nelson.reis@phd.unipi.it>
|
|
6
|
+
Project-URL: Homepage, https://pypi.org/p/tadc-sbm/
|
|
7
|
+
Project-URL: Repository, https://github.com/nelsonaloysio/tadc-sbm
|
|
8
|
+
Project-URL: Issues, https://github.com/nelsonaloysio/tadc-sbm/issues
|
|
9
|
+
Keywords: Temporal Network,Attributed Graph,Graph Generative Model,Graph Sampling
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Information Technology
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Requires-Python: >=3.7
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE.md
|
|
20
|
+
Requires-Dist: matplotlib>=3.10.1
|
|
21
|
+
Requires-Dist: networkx>=3.4.2
|
|
22
|
+
Requires-Dist: networkx-temporal>=1.2.1
|
|
23
|
+
Requires-Dist: numpy==1.26.4
|
|
24
|
+
Requires-Dist: pandas==2.2.3
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# TADC-SBM: a Time-varying, Attributed, Degree-Corrected Stochastic Block Model
|
|
28
|
+
|
|
29
|
+
[](https://colab.research.google.com/github/nelsonaloysio/tadcsbm/blob/main/notebook.ipynb)
|
|
30
|
+
[](https://github.com/nelsonaloysio/tadcsbm/blob/main/LICENSE)
|
|
31
|
+
[](https://nelsonaloysio.github.io/files/tadcsbm2025.pdf)
|
|
32
|
+
[](https://doi.org/10.1109/ISCC65549.2025.11326334)
|
|
33
|
+
|
|
34
|
+
This is the code repository for the accompanying paper:
|
|
35
|
+
|
|
36
|
+
> Passos, N.A.R.A., Carlini, E., Trani, S. (2025). [TADC-SBM: a Time-varying, Attributed, Degree-Corrected Stochastic Block Model](https://ieeexplore.ieee.org/document/11326334). 2025 IEEE Symposium on Computers and Communications (ISCC), Bologna, Italy, 2025, pp. 1-6.
|
|
37
|
+
|
|
38
|
+
___
|
|
39
|
+
|
|
40
|
+
## About
|
|
41
|
+
|
|
42
|
+
TADC-SBM is a synthetic dataset generator based on [Ghasemian et al. (2016)](http://dx.doi.org/10.1103/PhysRevX.6.031005) and [Tsitsulin et al. (2021)](https://doi.org/10.48550/arXiv.2204.01376) that produces temporal graphs with varying community structures, attribute features, and mesoscale dynamics, suited for community detection and graph representation learning benchmarks under controlled experimental settings:
|
|
43
|
+
|
|
44
|
+
[]()
|
|
45
|
+
|
|
46
|
+
where $\mathbf{B}$ is the block matrix describing the probability of an edge being created among nodes in each community and $\boldsymbol{\tau}$ is the transition matrix with the probabilities of nodes switching communities over time.
|
|
47
|
+
Node- and edge-level attribute features are drawn from a multivariate distribution considering the node communities in either the first or the last graph snapshot, optionally representing hierarchical (nested) structures in the feature space.
|
|
48
|
+
|
|
49
|
+
## Requirements
|
|
50
|
+
|
|
51
|
+
Requirements can be installed from [PyPI (requirements.txt)](requirements.txt) or using [conda (environment.yml)](environment.yml).
|
|
52
|
+
|
|
53
|
+
> The [graph-tool](https://graph-tool.skewed.de/) library must be available in the user space: `conda install -c conda-forge graph-tool`.
|
|
54
|
+
|
|
55
|
+
It is **not** advised to install the environment from conda as-is (but you certainly may!). Instead, try the following, more flexible environment to solve. Last tested with **Python 3.11** (but should work recent versions as well):
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
conda create -n tadcsbm -c conda-forge python=3.11 graph-tool # tested with 2.96
|
|
59
|
+
conda activate tadcsbm
|
|
60
|
+
pip install -r requirements.txt
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Alternatively, see the [graph-tool documentation](https://graph-tool.skewed.de) for other platforms and package managers, including Docker and Homebrew.
|
|
64
|
+
|
|
65
|
+
### Installation
|
|
66
|
+
|
|
67
|
+
The package is available on test PyPI as `tadcsbm` and can be installed with:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install --index-url https://test.pypi.org/simple/ tadcsbm
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
A binary script `tadc-sbm` is included for command line usage, which can be run with `python -m tadc-sbm` or simply `tadc-sbm` if the package is installed. Note that it is not necessary to install the package to run the script.
|
|
74
|
+
|
|
75
|
+
## Usage
|
|
76
|
+
|
|
77
|
+
To import the generator function in your code:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from tadcsbm import tadcsbm_simulator
|
|
81
|
+
sbm = tadcsbm_simulator(...)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
An interactive example may be found in the included [notebook](notebook.ipynb) file.
|
|
85
|
+
|
|
86
|
+
### Command line
|
|
87
|
+
|
|
88
|
+
A command line interface is included to stremaline graph generation:
|
|
89
|
+
|
|
90
|
+
```none
|
|
91
|
+
usage: tadc-sbm.py [-h] -n NUM_VERTICES -e NUM_EDGES -k COMMUNITIES
|
|
92
|
+
[-t SNAPSHOTS] [--eta ETA] [--gamma {0,1}]
|
|
93
|
+
[--beta EDGE_SAMPLING_RATE] [--feature-dim FEATURE_DIM]
|
|
94
|
+
[--feature-center-distance FEATURE_CENTER_DISTANCE]
|
|
95
|
+
[--feature-cluster-variance FEATURE_CLUSTER_VARIANCE]
|
|
96
|
+
[--feature-groups FEATURE_GROUPS]
|
|
97
|
+
[--edge-feature-dim EDGE_FEATURE_DIM]
|
|
98
|
+
[--edge-center-distance EDGE_CENTER_DISTANCE]
|
|
99
|
+
[--edge-cluster-variance EDGE_CLUSTER_VARIANCE]
|
|
100
|
+
[--no-reverse] [--uniform-all] [--dir OUTPUT_DIR]
|
|
101
|
+
[--ext OUTPUT_EXT]
|
|
102
|
+
|
|
103
|
+
options:
|
|
104
|
+
-h, --help show this help message and exit
|
|
105
|
+
-n NUM_VERTICES, --num-vertices NUM_VERTICES
|
|
106
|
+
Number of vertices (nodes)
|
|
107
|
+
-e NUM_EDGES, --num-edges NUM_EDGES
|
|
108
|
+
Number of edges per snapshot
|
|
109
|
+
-k COMMUNITIES, --communities COMMUNITIES
|
|
110
|
+
Number of communities
|
|
111
|
+
-t SNAPSHOTS, --snapshots SNAPSHOTS
|
|
112
|
+
Number of snapshots
|
|
113
|
+
--eta ETA Community stability factor (0.0 to 1.0)
|
|
114
|
+
--gamma {0,1} Fix transition probabilities (default: 0 for current
|
|
115
|
+
memberships)
|
|
116
|
+
--beta EDGE_SAMPLING_RATE
|
|
117
|
+
Edge sampling rate (0.0 to 1.0)
|
|
118
|
+
--feature-dim FEATURE_DIM
|
|
119
|
+
Dimensionality of node features
|
|
120
|
+
--feature-center-distance FEATURE_CENTER_DISTANCE
|
|
121
|
+
Distance between feature clusters
|
|
122
|
+
--feature-cluster-variance FEATURE_CLUSTER_VARIANCE
|
|
123
|
+
Variance of feature clusters (default: 1.0)
|
|
124
|
+
--feature-groups FEATURE_GROUPS
|
|
125
|
+
Number of feature groups (default: k)
|
|
126
|
+
--edge-feature-dim EDGE_FEATURE_DIM
|
|
127
|
+
Dimensionality of edge features
|
|
128
|
+
--edge-center-distance EDGE_CENTER_DISTANCE
|
|
129
|
+
Distance between edge feature clusters
|
|
130
|
+
--edge-cluster-variance EDGE_CLUSTER_VARIANCE
|
|
131
|
+
Variance of edge feature clusters (default: 1.0)
|
|
132
|
+
--fix-probabilities Use fixed transition probabilities (default: False)
|
|
133
|
+
--no-reverse Keep the generation order of snapshots (default:
|
|
134
|
+
reversed)
|
|
135
|
+
--uniform-all Uniform transition probabilities (i.e., including
|
|
136
|
+
current community)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Example
|
|
140
|
+
|
|
141
|
+
To generate graphs with the same configuration used in the experimental evaluation of the paper:
|
|
142
|
+
|
|
143
|
+
```none
|
|
144
|
+
./tadc-sbm.py --communities 8 \
|
|
145
|
+
--snapshots 8 \
|
|
146
|
+
--num-vertices 1024 \
|
|
147
|
+
--num-edges 10240 \
|
|
148
|
+
--eta 1 \
|
|
149
|
+
--gamma 0 \
|
|
150
|
+
--feature-dim 32 \
|
|
151
|
+
--feature-center 6.0
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
See the included [examples](examples) directory for sample outputs used in the accompanying paper.
|
|
155
|
+
|
|
156
|
+
> Varying the value of $\eta \in [0, 1]$ (`--eta`) produces snapshots with different community stability rates, while the value of $\gamma \in \\{0, 1\\}$ (`--gamma`) fixes the community transition probabilities for nodes in each snapshot.
|
|
157
|
+
|
|
158
|
+
### Data conversion
|
|
159
|
+
|
|
160
|
+
Resulting output is saved in compressed NetworkX-compatible and NumPy formats, and may be opened with a number of libraries and tools.
|
|
161
|
+
See also: the [`convert`](https://networkx-temporal.readthedocs.io/en/stable/api/utils.html#networkx_temporal.utils.convert.convert) and [`read_graph`](https://networkx-temporal.readthedocs.io/en/stable/api/readwrite.html#networkx_temporal.readwrite.read_graph) functions from NetworkX-Temporal.
|
|
162
|
+
|
|
163
|
+
## Acknowledgements
|
|
164
|
+
|
|
165
|
+
Google Research for the [graph embedding simulations](https://github.com/google-research/google-research/tree/master/graph_embedding/simulations) that TADC-SBM is based on.
|
|
166
|
+
|
|
167
|
+
## Cite
|
|
168
|
+
|
|
169
|
+
In case this repository is useful for your research, kindly consider citing:
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
@inproceedings{tadcsbm2025,
|
|
173
|
+
author={Passos, Nelson A. R. A. and Carlini, Emanuele and Trani, Salvatore},
|
|
174
|
+
booktitle={2025 IEEE Symposium on Computers and Communications (ISCC)},
|
|
175
|
+
title={TADC-SBM: a Time-varying, Attributed, Degree-Corrected Stochastic Block Model},
|
|
176
|
+
year={2025},
|
|
177
|
+
volume={},
|
|
178
|
+
number={},
|
|
179
|
+
pages={1-6},
|
|
180
|
+
keywords={Representation learning;Systematics;Computational modeling;Perturbation methods;Stochastic processes;Transportation;Benchmark testing;Stability analysis;Recommender systems;Synthetic data;Temporal Graphs;Community Detection;Stochastic Block Modeling;Graph Representation Learning},
|
|
181
|
+
doi={10.1109/ISCC65549.2025.11326334}
|
|
182
|
+
}
|
|
183
|
+
```
|
tadc_sbm-0.1.5/README.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# TADC-SBM: a Time-varying, Attributed, Degree-Corrected Stochastic Block Model
|
|
2
|
+
|
|
3
|
+
[](https://colab.research.google.com/github/nelsonaloysio/tadcsbm/blob/main/notebook.ipynb)
|
|
4
|
+
[](https://github.com/nelsonaloysio/tadcsbm/blob/main/LICENSE)
|
|
5
|
+
[](https://nelsonaloysio.github.io/files/tadcsbm2025.pdf)
|
|
6
|
+
[](https://doi.org/10.1109/ISCC65549.2025.11326334)
|
|
7
|
+
|
|
8
|
+
This is the code repository for the accompanying paper:
|
|
9
|
+
|
|
10
|
+
> Passos, N.A.R.A., Carlini, E., Trani, S. (2025). [TADC-SBM: a Time-varying, Attributed, Degree-Corrected Stochastic Block Model](https://ieeexplore.ieee.org/document/11326334). 2025 IEEE Symposium on Computers and Communications (ISCC), Bologna, Italy, 2025, pp. 1-6.
|
|
11
|
+
|
|
12
|
+
___
|
|
13
|
+
|
|
14
|
+
## About
|
|
15
|
+
|
|
16
|
+
TADC-SBM is a synthetic dataset generator based on [Ghasemian et al. (2016)](http://dx.doi.org/10.1103/PhysRevX.6.031005) and [Tsitsulin et al. (2021)](https://doi.org/10.48550/arXiv.2204.01376) that produces temporal graphs with varying community structures, attribute features, and mesoscale dynamics, suited for community detection and graph representation learning benchmarks under controlled experimental settings:
|
|
17
|
+
|
|
18
|
+
[]()
|
|
19
|
+
|
|
20
|
+
where $\mathbf{B}$ is the block matrix describing the probability of an edge being created among nodes in each community and $\boldsymbol{\tau}$ is the transition matrix with the probabilities of nodes switching communities over time.
|
|
21
|
+
Node- and edge-level attribute features are drawn from a multivariate distribution considering the node communities in either the first or the last graph snapshot, optionally representing hierarchical (nested) structures in the feature space.
|
|
22
|
+
|
|
23
|
+
## Requirements
|
|
24
|
+
|
|
25
|
+
Requirements can be installed from [PyPI (requirements.txt)](requirements.txt) or using [conda (environment.yml)](environment.yml).
|
|
26
|
+
|
|
27
|
+
> The [graph-tool](https://graph-tool.skewed.de/) library must be available in the user space: `conda install -c conda-forge graph-tool`.
|
|
28
|
+
|
|
29
|
+
It is **not** advised to install the environment from conda as-is (but you certainly may!). Instead, try the following, more flexible environment to solve. Last tested with **Python 3.11** (but should work recent versions as well):
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
conda create -n tadcsbm -c conda-forge python=3.11 graph-tool # tested with 2.96
|
|
33
|
+
conda activate tadcsbm
|
|
34
|
+
pip install -r requirements.txt
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Alternatively, see the [graph-tool documentation](https://graph-tool.skewed.de) for other platforms and package managers, including Docker and Homebrew.
|
|
38
|
+
|
|
39
|
+
### Installation
|
|
40
|
+
|
|
41
|
+
The package is available on test PyPI as `tadcsbm` and can be installed with:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install --index-url https://test.pypi.org/simple/ tadcsbm
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
A binary script `tadc-sbm` is included for command line usage, which can be run with `python -m tadc-sbm` or simply `tadc-sbm` if the package is installed. Note that it is not necessary to install the package to run the script.
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
To import the generator function in your code:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from tadcsbm import tadcsbm_simulator
|
|
55
|
+
sbm = tadcsbm_simulator(...)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
An interactive example may be found in the included [notebook](notebook.ipynb) file.
|
|
59
|
+
|
|
60
|
+
### Command line
|
|
61
|
+
|
|
62
|
+
A command line interface is included to stremaline graph generation:
|
|
63
|
+
|
|
64
|
+
```none
|
|
65
|
+
usage: tadc-sbm.py [-h] -n NUM_VERTICES -e NUM_EDGES -k COMMUNITIES
|
|
66
|
+
[-t SNAPSHOTS] [--eta ETA] [--gamma {0,1}]
|
|
67
|
+
[--beta EDGE_SAMPLING_RATE] [--feature-dim FEATURE_DIM]
|
|
68
|
+
[--feature-center-distance FEATURE_CENTER_DISTANCE]
|
|
69
|
+
[--feature-cluster-variance FEATURE_CLUSTER_VARIANCE]
|
|
70
|
+
[--feature-groups FEATURE_GROUPS]
|
|
71
|
+
[--edge-feature-dim EDGE_FEATURE_DIM]
|
|
72
|
+
[--edge-center-distance EDGE_CENTER_DISTANCE]
|
|
73
|
+
[--edge-cluster-variance EDGE_CLUSTER_VARIANCE]
|
|
74
|
+
[--no-reverse] [--uniform-all] [--dir OUTPUT_DIR]
|
|
75
|
+
[--ext OUTPUT_EXT]
|
|
76
|
+
|
|
77
|
+
options:
|
|
78
|
+
-h, --help show this help message and exit
|
|
79
|
+
-n NUM_VERTICES, --num-vertices NUM_VERTICES
|
|
80
|
+
Number of vertices (nodes)
|
|
81
|
+
-e NUM_EDGES, --num-edges NUM_EDGES
|
|
82
|
+
Number of edges per snapshot
|
|
83
|
+
-k COMMUNITIES, --communities COMMUNITIES
|
|
84
|
+
Number of communities
|
|
85
|
+
-t SNAPSHOTS, --snapshots SNAPSHOTS
|
|
86
|
+
Number of snapshots
|
|
87
|
+
--eta ETA Community stability factor (0.0 to 1.0)
|
|
88
|
+
--gamma {0,1} Fix transition probabilities (default: 0 for current
|
|
89
|
+
memberships)
|
|
90
|
+
--beta EDGE_SAMPLING_RATE
|
|
91
|
+
Edge sampling rate (0.0 to 1.0)
|
|
92
|
+
--feature-dim FEATURE_DIM
|
|
93
|
+
Dimensionality of node features
|
|
94
|
+
--feature-center-distance FEATURE_CENTER_DISTANCE
|
|
95
|
+
Distance between feature clusters
|
|
96
|
+
--feature-cluster-variance FEATURE_CLUSTER_VARIANCE
|
|
97
|
+
Variance of feature clusters (default: 1.0)
|
|
98
|
+
--feature-groups FEATURE_GROUPS
|
|
99
|
+
Number of feature groups (default: k)
|
|
100
|
+
--edge-feature-dim EDGE_FEATURE_DIM
|
|
101
|
+
Dimensionality of edge features
|
|
102
|
+
--edge-center-distance EDGE_CENTER_DISTANCE
|
|
103
|
+
Distance between edge feature clusters
|
|
104
|
+
--edge-cluster-variance EDGE_CLUSTER_VARIANCE
|
|
105
|
+
Variance of edge feature clusters (default: 1.0)
|
|
106
|
+
--fix-probabilities Use fixed transition probabilities (default: False)
|
|
107
|
+
--no-reverse Keep the generation order of snapshots (default:
|
|
108
|
+
reversed)
|
|
109
|
+
--uniform-all Uniform transition probabilities (i.e., including
|
|
110
|
+
current community)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Example
|
|
114
|
+
|
|
115
|
+
To generate graphs with the same configuration used in the experimental evaluation of the paper:
|
|
116
|
+
|
|
117
|
+
```none
|
|
118
|
+
./tadc-sbm.py --communities 8 \
|
|
119
|
+
--snapshots 8 \
|
|
120
|
+
--num-vertices 1024 \
|
|
121
|
+
--num-edges 10240 \
|
|
122
|
+
--eta 1 \
|
|
123
|
+
--gamma 0 \
|
|
124
|
+
--feature-dim 32 \
|
|
125
|
+
--feature-center 6.0
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
See the included [examples](examples) directory for sample outputs used in the accompanying paper.
|
|
129
|
+
|
|
130
|
+
> Varying the value of $\eta \in [0, 1]$ (`--eta`) produces snapshots with different community stability rates, while the value of $\gamma \in \\{0, 1\\}$ (`--gamma`) fixes the community transition probabilities for nodes in each snapshot.
|
|
131
|
+
|
|
132
|
+
### Data conversion
|
|
133
|
+
|
|
134
|
+
Resulting output is saved in compressed NetworkX-compatible and NumPy formats, and may be opened with a number of libraries and tools.
|
|
135
|
+
See also: the [`convert`](https://networkx-temporal.readthedocs.io/en/stable/api/utils.html#networkx_temporal.utils.convert.convert) and [`read_graph`](https://networkx-temporal.readthedocs.io/en/stable/api/readwrite.html#networkx_temporal.readwrite.read_graph) functions from NetworkX-Temporal.
|
|
136
|
+
|
|
137
|
+
## Acknowledgements
|
|
138
|
+
|
|
139
|
+
Google Research for the [graph embedding simulations](https://github.com/google-research/google-research/tree/master/graph_embedding/simulations) that TADC-SBM is based on.
|
|
140
|
+
|
|
141
|
+
## Cite
|
|
142
|
+
|
|
143
|
+
In case this repository is useful for your research, kindly consider citing:
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
@inproceedings{tadcsbm2025,
|
|
147
|
+
author={Passos, Nelson A. R. A. and Carlini, Emanuele and Trani, Salvatore},
|
|
148
|
+
booktitle={2025 IEEE Symposium on Computers and Communications (ISCC)},
|
|
149
|
+
title={TADC-SBM: a Time-varying, Attributed, Degree-Corrected Stochastic Block Model},
|
|
150
|
+
year={2025},
|
|
151
|
+
volume={},
|
|
152
|
+
number={},
|
|
153
|
+
pages={1-6},
|
|
154
|
+
keywords={Representation learning;Systematics;Computational modeling;Perturbation methods;Stochastic processes;Transportation;Benchmark testing;Stability analysis;Recommender systems;Synthetic data;Temporal Graphs;Community Detection;Stochastic Block Modeling;Graph Representation Learning},
|
|
155
|
+
doi={10.1109/ISCC65549.2025.11326334}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tadc-sbm"
|
|
7
|
+
version = "0.1.5"
|
|
8
|
+
description = "A Time-varying, Attributed, Degree-Corrected Stochastic Block Model"
|
|
9
|
+
requires-python = ">=3.7"
|
|
10
|
+
readme = {file = "README.md", content-type = "text/markdown"}
|
|
11
|
+
# license = "Apache Software License 2.0"
|
|
12
|
+
# license-files = ["LICENSE.md"]
|
|
13
|
+
keywords = ["Temporal Network", "Attributed Graph", "Graph Generative Model", "Graph Sampling"]
|
|
14
|
+
authors = [
|
|
15
|
+
{name = "Nelson Aloysio Reis de Almeida Passos", email = "nelson.reis@phd.unipi.it"}
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Intended Audience :: Information Technology",
|
|
21
|
+
"License :: OSI Approved :: Apache Software License",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
24
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
# "graph-tool=2.96", # conda install -c conda-forge graph-tool
|
|
28
|
+
"matplotlib>=3.10.1",
|
|
29
|
+
"networkx>=3.4.2",
|
|
30
|
+
"networkx-temporal>=1.2.1",
|
|
31
|
+
"numpy==1.26.4",
|
|
32
|
+
"pandas==2.2.3",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://pypi.org/p/tadc-sbm/"
|
|
37
|
+
Repository = "https://github.com/nelsonaloysio/tadc-sbm"
|
|
38
|
+
Issues = "https://github.com/nelsonaloysio/tadc-sbm/issues"
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.packages.find]
|
|
41
|
+
where = ["."]
|
|
42
|
+
include = ["tadcsbm*"]
|
|
43
|
+
exclude = ["tadcsbm.tests*"]
|
|
44
|
+
|
|
45
|
+
[project.scripts]
|
|
46
|
+
tadc-sbm = "tadcsbm.main:main"
|
tadc_sbm-0.1.5/setup.cfg
ADDED
tadc_sbm-0.1.5/setup.py
ADDED