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 or newer.
$ 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.8.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6403363c688edfbd528a7899b73a25dc8a607a9f24086cb6ac418401fb38e283 |
|
MD5 | eef8a5979a7896fd384c475a922ecaad |
|
BLAKE2b-256 | 0ea5ee966906087caea860d0d8b4de6e7b376ed705596d1dac1f543d2dd7610b |
Hashes for reticula-0.8.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 544f45d46f1de1a1ee1c0b28d99a0abd69969866dc5a0d63fb6b943d8d1fba66 |
|
MD5 | 0e01ea1a416836001a4d9da105eb1e68 |
|
BLAKE2b-256 | cf068e889fe2962646060fd863b5c1bcb2e2843f221ff1074d9ba58f7d72ea88 |
Hashes for reticula-0.8.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7414cfbf303ad7367bbb14828aa1916d99235f09c96533c449741935b4dc8a95 |
|
MD5 | 9caa6fc7d018d9385b07957ee5537850 |
|
BLAKE2b-256 | e3e5e0b64d465d1fe7cdfcfc70ef43b278ed9d687005d65c7b99458658f2bbe2 |
Hashes for reticula-0.8.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa69cc28acd2bff743ce8c32972d4e7b71a44fcd176e3bc6fae91bf81af074ea |
|
MD5 | 7b231a9995b7e5b7b7bb6a45339a5b67 |
|
BLAKE2b-256 | 0909a0c6764d1bf27427182e734802b91cd73c036870025d4cdc29ff3070693b |
Hashes for reticula-0.8.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0343e4fb2b2158f7bf122cdd25231d5d757c0464c230b89a5e6e745c6d41a82c |
|
MD5 | 3fba4530a63d3ffb193dc4d6e6bed1fe |
|
BLAKE2b-256 | d7216940e8cd33cac1a66868d737ed56a0c575dec3ad89fcc78d3985f853c93d |
Hashes for reticula-0.8.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebb69e458b827c1a98a692de32a940c6d36ef7dc218673f4881f6bcb41c1293e |
|
MD5 | 567501fc5c7944918959df0c38c7a13f |
|
BLAKE2b-256 | e9594e774635fe2c891e994885f950a8b52ab330a870b8604d444d1715b771e5 |