Analyse temporal network and hypergraphs efficiently.
Project description
Python bindings for Reticula
Installation
The library offers pre-compiled Wheels for x64 Windows, MacOS and Linux. 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 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.2-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bc2281ebf93f6efa648fc02494dd3b90707d46c79504195977fedc7b86b040b |
|
MD5 | 18d38277eed860fe53d915b1d36f70c4 |
|
BLAKE2b-256 | bd765d54d88ae3c4905f12f528ae02906b61a77b475512ed3937598721eab45e |
Hashes for reticula-0.9.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e68f77e7f8e704fd1ecb4d357fb424decd19922ce633deac50bf7b0b497cf88d |
|
MD5 | daf9e6c46cbc6ac8f5f8a944cc9d1fa0 |
|
BLAKE2b-256 | b1810ce6bd37521e3072c4ec3797fe0c8b612fe1a525500a2c00f58cda113ed5 |
Hashes for reticula-0.9.2-cp311-cp311-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7645884e8aafd1bd5f6620b708f4585f9fe375f142325167644a18d3bda9747f |
|
MD5 | 67be3ab7e0d0ccfde9001e062d12109b |
|
BLAKE2b-256 | 08c794d9f0206a0be2148492f43bdb346e9e25f870241c8e9c08a24fea9eb3df |
Hashes for reticula-0.9.2-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f14a421dfdc221976aa71d6d0b042c67a902704055408af74284c54970dd851f |
|
MD5 | 5e32518fb144a13a44d7a47c400b6c71 |
|
BLAKE2b-256 | ec53015e593ebb96e32ba68233d89f71285601e05753032b1eead4ccf3b04733 |
Hashes for reticula-0.9.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02f93b52be3fb80e131a7bc787e1236afe13187772da433659feed04e17e335c |
|
MD5 | bd8e011cd0a6600f3d9b53c7474a7d65 |
|
BLAKE2b-256 | b0849dddada3ed377483f098d0a9dedddf0632f1522fea731e9a50b2d45341a1 |
Hashes for reticula-0.9.2-cp310-cp310-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfbc3f0f87075cf607bfe428d2c7c5f5e2a2c1f82a67386a2891b97cfff9e9bc |
|
MD5 | 6d42d6869adf537ea22d190f5cffc388 |
|
BLAKE2b-256 | 1021ae2399324479246587d19fdc9393c3dfa2b026f540a0ce91b91b25b33e27 |
Hashes for reticula-0.9.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f07c1b646442425f83efe42d2bc28e6fc7bd7ca8820e7db3a5f1684559e79136 |
|
MD5 | 1c8a321e3767ed39959044666b4beedc |
|
BLAKE2b-256 | ba8fe3d79e3ca04305af1f0c4e2e3865e1278d3c3cdf054e5dcdef137f39924f |
Hashes for reticula-0.9.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 602bf2d76bf1224454688c57b97326be1a1a498367faee1d3572bdb0b2e52a35 |
|
MD5 | 5b92110707ad7d9c5bed9ae8ffe90ccb |
|
BLAKE2b-256 | e55e24bfa9842ea820a9c0e637354f9b467882b1a9189fefa2b375fe140d8098 |
Hashes for reticula-0.9.2-cp39-cp39-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85428cbe6b2989e0075d264df6969e39e5704d2eb117d6ee5706c688ea6f8b92 |
|
MD5 | 6403c7b5b5431a66b50596f855fa23fd |
|
BLAKE2b-256 | d979dee22fa29cda4c63346611c24b39f1ce9918561e5d25ab06ade907b01aa1 |
Hashes for reticula-0.9.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0bdeb1f0174056da44f71b994486b1094617a0a05c274a7191d79e42e79e3a6 |
|
MD5 | 14af139316814a127ebbaa61015f3a0a |
|
BLAKE2b-256 | 2c2de383f45a6202d500badc853d9a6330a990f5c81512bd133bd750f6bcee98 |
Hashes for reticula-0.9.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cea9a8de51c17c32c6bfbcea6bb10d1c7fa95eac214a46fcafd406d5575a711 |
|
MD5 | aa0578e43e3270b96012cedd7966766d |
|
BLAKE2b-256 | 6de19ae144e6888642fae599334d69373f693fd4fbf81b4dc70dd0690f61e1e8 |
Hashes for reticula-0.9.2-cp38-cp38-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72c6ca79a90c39262d6c618bb0ec719c2e276f7a69bee321d9157be3649e6c37 |
|
MD5 | d4e3c4d8c1d1d4446be80438e9ef2595 |
|
BLAKE2b-256 | 09ddc01aed189187de3d045a7eb9c960997d28c66f7b0e11d43e9e517edb752a |