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.7.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92d2afbe66bc40736cb38252ba0d7ea48cc6243b59475c40ef28478a4cf8b2c3 |
|
MD5 | c5ba2e04286ef614595071768b7d79ad |
|
BLAKE2b-256 | e06b1fe01f635aea67aa30cf5834d5119bd1a1feabef5466c80fe5bc8883e44c |
Hashes for reticula-0.7.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd54163b0ae3eedcc3122a5fbfaddff75cd326fe831ddeccafcaf518ce856ddf |
|
MD5 | 20210c60829fac3878b6e11b1daf4e87 |
|
BLAKE2b-256 | 2feb2b47e622ad606d2c381febc092cd6a22b31c23f708a2a37a585bac3d81f8 |
Hashes for reticula-0.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cabc61867cd66a40c6d49db1ee5e4bd23a4549a8c430e6b8ee75d4b872a44635 |
|
MD5 | f8a61bc19b504bbf5909e49986fcf8c6 |
|
BLAKE2b-256 | d9c97c48883a0d925f4def3164b934016e70795ca561b8731f77f0714eceb43f |
Hashes for reticula-0.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27f2ad783feb2f54701e518c215fb928efd4496b3a5d84e447e3f9c1e3647957 |
|
MD5 | 38c7d0fb7c20bb4baefc3ca73e06e085 |
|
BLAKE2b-256 | 99e05058b3dae916f439b124878b4c09c8507169e2cc4eb8194ea0ab8624053e |
Hashes for reticula-0.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97d058b0ebd929f8c36c5f9219e2f4d730a9e72d108e1f2f1bfaf32146342110 |
|
MD5 | 572e0bf5959dd84ea2e86c559023cb15 |
|
BLAKE2b-256 | 2d0b1012676cbe0b01c1f843e903ba519d1941d1242a65196f15ecaff9ee53d1 |
Hashes for reticula-0.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5726a7566bb1cd863ccaebcdd3a8b3132e6606cfe799e2680ec24936ac80c844 |
|
MD5 | adecb343a29ae6be7dd6570b17ece163 |
|
BLAKE2b-256 | 9a7b4df2779793f4dbc7af4557b95673795ea247b88042c453e5fd8260fe25a9 |