|
20 | 20 | function_module=_reticula_ext, |
21 | 21 | api_module_name=__name__) |
22 | 22 |
|
23 | | -_pair_vertex_types = set([ |
| 23 | +_pair_vertex_types = set( |
24 | 24 | getattr(_reticula_ext, f"pair_{i.__name__}_{i.__name__}") |
25 | | - for i in _simple_vertex_types]) |
| 25 | + for i in _simple_vertex_types) |
26 | 26 |
|
27 | 27 | _static_edge_prefixes = [ |
28 | 28 | "directed_edge", "undirected_edge", |
|
32 | 32 | _all_vertex_types = set(_reticula_ext.types.vertex_types) |
33 | 33 |
|
34 | 34 | for _e in _static_edge_prefixes: |
| 35 | + _vert_types = _simple_vertex_types | _pair_vertex_types |
| 36 | + if _e in {"directed_edge", "undirected_edge"}: |
| 37 | + _vert_types = _all_vertex_types |
35 | 38 | setattr(_sys.modules[__name__], |
36 | 39 | _e, _generic_attribute( |
37 | 40 | attr_prefix=_e, |
|
48 | 51 | function_module=_reticula_ext, |
49 | 52 | api_module_name=__name__)) |
50 | 53 |
|
| 54 | +_static_network_types = set( |
| 55 | + getattr(_reticula_ext, f"{_e[:-4]}network_{_t.__name__}") |
| 56 | + for _e in ["directed_edge", "undirected_edge"] |
| 57 | + for _t in _all_vertex_types) |
| 58 | + |
| 59 | +_static_network_types |= set( |
| 60 | + getattr(_reticula_ext, f"{_e[:-4]}network_{_t.__name__}") |
| 61 | + for _e in ["directed_hyperedge", "undirected_hyperedge"] |
| 62 | + for _t in _simple_vertex_types | _pair_vertex_types) |
| 63 | + |
51 | 64 | from ._reticula_ext import ( |
52 | 65 | mersenne_twister) |
53 | 66 |
|
|
115 | 128 | function_module=_reticula_ext, |
116 | 129 | api_module_name=__name__)) |
117 | 130 |
|
| 131 | +_temporal_network_types = set( |
| 132 | + getattr(_reticula_ext, f"{_e[:-4]}network_{_v.__name__}_{_t.__name__}") |
| 133 | + for _e in _temporal_edge_prefixes |
| 134 | + for _v in _temporal_edge_verts |
| 135 | + for _t in _time_types) |
| 136 | + |
| 137 | +_all_network_types = _static_network_types | _temporal_network_types |
118 | 138 |
|
119 | 139 | _vertex_generic_attrs = [ |
120 | 140 | "component", "component_size", "component_size_estimate"] |
|
149 | 169 | arg_names=("edge_type",), |
150 | 170 | options={(t,) for t in _all_edge_types}, |
151 | 171 | function_module=_reticula_ext, |
152 | | - api_module_name=__name__) |
| 172 | + api_module_name=__name__, |
| 173 | + default_callable=_reticula_ext.is_network_edge) |
153 | 174 | is_static_edge = _generic_attribute( |
154 | 175 | attr_prefix="is_static_edge", |
155 | 176 | arg_names=("edge_type",), |
156 | 177 | options=set((t,) for t in _all_edge_types), |
157 | 178 | function_module=_reticula_ext, |
158 | | - api_module_name=__name__) |
| 179 | + api_module_name=__name__, |
| 180 | + default_callable=_reticula_ext.is_static_edge) |
159 | 181 | is_temporal_edge = _generic_attribute( |
160 | 182 | attr_prefix="is_temporal_edge", |
161 | 183 | arg_names=("edge_type",), |
162 | 184 | options={(t,) for t in _all_edge_types}, |
163 | 185 | function_module=_reticula_ext, |
164 | | - api_module_name=__name__) |
| 186 | + api_module_name=__name__, |
| 187 | + default_callable=_reticula_ext.is_temporal_edge) |
| 188 | + |
165 | 189 | is_instantaneous = _generic_attribute( |
166 | 190 | attr_prefix="is_instantaneous", |
167 | 191 | arg_names=("edge_type",), |
168 | | - options={(t,) for t in _all_edge_types}, |
| 192 | + options={(t,) for t in _all_edge_types | _all_network_types}, |
169 | 193 | function_module=_reticula_ext, |
170 | | - api_module_name=__name__) |
| 194 | + api_module_name=__name__, |
| 195 | + default_callable=_reticula_ext.is_instantaneous) |
171 | 196 | is_undirected = _generic_attribute( |
172 | 197 | attr_prefix="is_undirected", |
173 | 198 | arg_names=("edge_type",), |
174 | | - options={(t,) for t in _all_edge_types}, |
| 199 | + options={(t,) for t in _all_edge_types | _all_network_types}, |
175 | 200 | function_module=_reticula_ext, |
176 | | - api_module_name=__name__) |
| 201 | + api_module_name=__name__, |
| 202 | + default_callable=_reticula_ext.is_undirected) |
| 203 | +is_directed = _generic_attribute( |
| 204 | + attr_prefix="is_directed", |
| 205 | + arg_names=("edge_type",), |
| 206 | + options={(t,) for t in _all_edge_types | _all_network_types}, |
| 207 | + function_module=_reticula_ext, |
| 208 | + api_module_name=__name__, |
| 209 | + default_callable=_reticula_ext.is_directed) |
177 | 210 | is_dyadic = _generic_attribute( |
178 | 211 | attr_prefix="is_dyadic", |
179 | 212 | arg_names=("edge_type",), |
180 | | - options={(t,) for t in _all_edge_types}, |
| 213 | + options={(t,) for t in _all_edge_types | _all_network_types}, |
181 | 214 | function_module=_reticula_ext, |
182 | | - api_module_name=__name__) |
| 215 | + api_module_name=__name__, |
| 216 | + default_callable=_reticula_ext.is_dyadic) |
183 | 217 |
|
184 | 218 |
|
185 | 219 | _random_network_generic_attrs = [ |
|
0 commit comments