Analyse temporal network and hypergraphs efficiently.
Project description
Python bindings for Reticula
Installation
The library offers pre-compiled Wheels for manylinux2014
compatible systems.
That is, Linux systems with GNU C Library (glibc) version 2.17 and newer. The
library currently supports Python version 3.8, 3.9 and 3.10.
$ pip install reticula
Installing from source
Alternatively you can install the library from source:
Clone the library:
$ git clone https://github.com/arashbm/reticula-python.git
Build the Wheel:
$ cd reticula-python
$ pip install .
Note that compiling source requires an unbelievable amount (> 40GB) of RAM.
Basic examples
Generate a random static network and investigate:
>>> import reticula as ret
>>> state = ret.mersenne_twister(42) # create a pseudorandom number generator
>>> g = ret.random_gnp_graph[ret.int64](n=100, p=0.02, random_state=state)
>>> g
<undirected_network[int64] with 100 verts and 110 edges>
>>> g.vertices()
[0, 1, 2, 3, .... 99]
>>> g.edges()
[undirected_edge[int64](0, 16), undirected_edge[int64](0, 20),
undirected_edge[int64](0, 31), undirected_edge[int64](0, 51), ...]
>>> ret.connected_components(g)
[<component[int64] of 1 nodes: {9}>, <component[int64] of 1 node {33}>, ...]
>>> lcc = max(ret.connected_components(g), key=len)
>>> lcc
<component[int64] of 93 nodes: {99, 96, 95, 94, ...}>
>>> g2 = ret.vertex_induced_subgraph(g, lcc)
>>> g2
<undirected_network[int64] with 93 verts and 109 edges>
A more complete example of static network percolation analysis, running on
multiple threads, can be found in
examples/static_network_percolation/
Create a random fully-mixed temporal network and calculate simple (unconstrained) reachability from node 0 at time 0 to all nodes and times.
>>> import reticula as ret
>>> state = ret.mersenne_twister(42)
>>> g = ret.random_fully_mixed_temporal_network[ret.int64](\
... size=100, rate=0.01, max_t=1024, random_state=state)
>>> adj = ret.temporal_adjacency.simple[\
... ret.undirected_temporal_edge[ret.int64, ret.double]]()
>>> cluster = ret.out_cluster(\
... temporal_network=g, temporal_adjacency=adj, vertex=0, time=0.0)
>>> cluster
<temporal_cluster[undirected_temporal_edge[int64, double],
simple[undirected_temporal_edge[int64, double]]] with volume 100
and lifetime (0 1.7976931348623157e+308]>
>>> cluster.covers(vertex=12, time=100.0)
True
>>> # Let's see all intervals where vert 15 is reachable from vert 0 at t=0.0:
>>> list(cluster.interval_sets()[15])
[(3.099055278145548, 1.7976931348623157e+308)]
Let's now try limited waiting-time (with dt = 5.0) reachability:
>>> import reticula as ret
>>> state = ret.mersenne_twister(42)
>>> g = ret.random_fully_mixed_temporal_network[int64](\
... size=100, rate=0.01, max_t=1024, random_state=state)
>>> adj = ret.temporal_adjacency.limited_waiting_time[\
... ret.undirected_temporal_edge[ret.int64, ret.double]](dt=5.0)
>>> cluster = ret.out_cluster(\
... temporal_network=g, temporal_adjacency=adj, vertex=0, time=0.0)
>>> cluster
<temporal_cluster[undirected_temporal_edge[int64, double],
limited_waiting_time[undirected_temporal_edge[int64, double]]] with
volume 100 and lifetime (0 1028.9972186553928]>
>>> cluster.covers(vertex=15, time=16.0)
True
>>> list(cluster.interval_sets()[15])
[(3.099055278145548, 200.17866501023616),
(200.39858803326402, 337.96139372380003),
...
(1017.5258263596586, 1028.9149586273347)]
>>> # Total "human-hours" of reachability cluster
>>> cluster.mass()
101747.97444555275
>>> # Survival time of the reachability cluster
>>> cluster.lifetime()
(0.0, 1028.9972186553928)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for reticula-0.4.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4c6312e72acb0253a759b7d07181f383ddde4ec68b47094228a45d862eebb1f |
|
MD5 | 16c4a2b9c7c390a761ab4d424d285d71 |
|
BLAKE2b-256 | 4966116dc60daae2d186f30ee4d2719834b2053db75d893079cc8587ddd934f4 |
Hashes for reticula-0.4.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 526dd3f17bef152233ee59e1ad3dbfe8b97563364e8e7739e5945faa9c31f279 |
|
MD5 | ddff8fc78d4fca5e69aee44032a1e399 |
|
BLAKE2b-256 | 99f9af82e74d4589ed0a350d7b1dc61337598f8d029f698ea2ba0bce39065420 |
Hashes for reticula-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d8b435d51c1214405f3aad32549541b97184693ae98016c2e4c9d20f4d157f5 |
|
MD5 | 6738cd71ca3d2539fca3e340a5fd3abf |
|
BLAKE2b-256 | 09090cf0bece156f901ab238ee4d4b3484182230b6b90dea5f47eb821a1ed157 |
Hashes for reticula-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2be6c4c43f2900640a38aacc147e26bd52be3af5165a35273a77a16638b9c7cf |
|
MD5 | ee5570c53fece4554762798aaee173c8 |
|
BLAKE2b-256 | 1e3dae364717e6a2a8faf8d6ecc147eddf0c4f9ba74a8c0abcec9d2f31db0882 |
Hashes for reticula-0.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | adf47ff5e583628d08e6f1c97a3fd5f045446a05c2d89dac73a13b48a0fb6e49 |
|
MD5 | fc6e3c15b589853711e2eade04787889 |
|
BLAKE2b-256 | a9480f346afe46b1d35b5ddba0b4a62ca2a0c45e209c5e2aed7cdb00618306e1 |
Hashes for reticula-0.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf23cd53f5f66a16e65557d092a33a26ea0c153dd738b27e7fe85bf065a22138 |
|
MD5 | af2d2b807c008c26cefc1bc12cc54323 |
|
BLAKE2b-256 | 084e732e8c9a554a1c7668d9d6744613208e152085afe8265f42f1d5c7086131 |