Analyse temporal network and hypergraphs efficiently.
Project description
Python bindings for Reticula
Installation
The library offers pre-compiled Wheels for x64 Windows and Linux. The library currently supports Python version 3.8 or newer and experimentally, PyPy 3.9.
$ 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 from 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.9.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bec8f734dbbc3cb0977c1cf87c5627fdc257df4ef4ad912250bebbb18c535470 |
|
MD5 | 9633efbbacd2bdabeea3c44069219087 |
|
BLAKE2b-256 | 5a092e9bad66f68e71930ef6740d367b860f9da585f7b691c003c97d62c6c9ec |
Hashes for reticula-0.9.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e82f786d748e578ca473fb18acdd43ac539098b8a37ad4486e200ea1280af37 |
|
MD5 | cde8eb60cec7628c575971366091df19 |
|
BLAKE2b-256 | d9dfe8cc1c13491ebf3da93f6b429010abf01fbcd137cf81eaecff67f137f784 |
Hashes for reticula-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8b6180e8c4bb1d3657a03b8fec97e848a092cfdb6456d0c6acf055ae5b4c561 |
|
MD5 | 111ece7265075976b55cb1f59e092185 |
|
BLAKE2b-256 | f3980d7ac791c16f2cac56a1a9d0685bc616a1d724b3a8e880bae98934632c4a |
Hashes for reticula-0.9.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7da6903aaeebc8f0b3bd643cc678099d517010732633ea49f71d902f31862bf |
|
MD5 | ac8d7b5e48eae08bd351f690266d6eeb |
|
BLAKE2b-256 | 20a873a4325ddbfdaaece9d00faea420918fb298e29ef1524794982b1da1fe4e |
Hashes for reticula-0.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7dda7fa3e58311a351aeb43e250f97838fa803a69c5524cac26531625773c37 |
|
MD5 | a79c667b58e46f732f8701dffd67f21f |
|
BLAKE2b-256 | f78f8ffac28091de7dca863d0a2d2aeec7be033aed593dfcb7f3e6711c2dcb81 |
Hashes for reticula-0.9.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5504665aa9986609cb234dcfa7bdf399ffd80cc5a944566d539bd724a937e1c0 |
|
MD5 | 7990a3583cfd00fd259489cc002b84b4 |
|
BLAKE2b-256 | 0f3b13f3b780ffa8de5b665a370d842afd2c23cabfc1f08fa8436847e4eff1c4 |
Hashes for reticula-0.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca8a6ce302654723e31d687eb51f269e4c2f4c1ec95339855880bc03abc08df7 |
|
MD5 | d919bae4b97c45c5d4173ab8e8316380 |
|
BLAKE2b-256 | e1c5f50ea7f3d57d532ec675565c3d449c0bd53a9a966f24fb823bff2d25356b |
Hashes for reticula-0.9.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bb0037857447ced489d3cbe2dc2f269baff71e371cf386e8c923c136a6636cc |
|
MD5 | cbd28f6d3a898c230798268348dec96b |
|
BLAKE2b-256 | 0d4a5b57ba5b21441dd3e6f687bed1ca9e11bc74ca04b8411f29e5e734f2c65b |
Hashes for reticula-0.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 707bff926e6bff2bbab049e255c0585adefa16d3090baf36b6d8c4c9172205c6 |
|
MD5 | 465fa428fda7a788832f87596d76190b |
|
BLAKE2b-256 | d41cf4767f4964aece0f674826c34fb7cbf5f8071a7388d9c78128abe551030d |