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 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.vertiex_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
>>> import ret.temporal_adjacency
>>> 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.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
>>> import ret.temporal_adjacency
>>> 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)]
>>> cluster.mass() # total "human-hours" of reachability
101747.97444555275
>>> 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.0.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf838a9c7e3bc1a8173e86c97fa83d1967b4b76ea6b275a4c7c7e40ec66e70ab |
|
MD5 | c938988bf2d56c95783ef92f294b5833 |
|
BLAKE2b-256 | 35882d8def9d4fa3d2294aac2ccd0fe056b5b94adfe889ff2b78745fd31d5577 |
Hashes for reticula-0.0.2-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0925c6dec9722cd2a4b1ae11004f02c827b6fa52701c11fed6f99af2a646a40d |
|
MD5 | 948e48871dbec1cafa45ec104676fd2f |
|
BLAKE2b-256 | 94c0c33f1ca72d64e56a8a39c658afd582cff57ba5598a5c6fca1e05f03f953e |
Hashes for reticula-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11e2bf32a906b34c24af4bbca9ea6d57ab0b20596e3ce3461f723150d616806b |
|
MD5 | c06bd35c0646fc130095ce447f2dc4e8 |
|
BLAKE2b-256 | cb8fd43fe8a540fb0811880477d266d6411fe308eba56d07ac09f2c087289729 |
Hashes for reticula-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b21df2cb313616b3c48ef45852bc2e549624dda36fafc01642b1dc3ffdead410 |
|
MD5 | 224312e399add01ae9e1d69b18b3dab4 |
|
BLAKE2b-256 | cb26ee1bad3f2f255a3535a625b42039cf72ee3a21b03be27c2aceec59c0018c |
Hashes for reticula-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fda10504392f708d4f580a5e74c2fe0ed2a718200bc73b5150f73e92099eec5 |
|
MD5 | 74f51782914892a975ca25e5df0f2b06 |
|
BLAKE2b-256 | adf4af0ae7bdef50b83442b983a94940b5c56dff408622795e48ea6e583fd6b3 |