Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

reticula-0.6.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25.8 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

reticula-0.6.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25.8 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

reticula-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

reticula-0.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

reticula-0.6.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

reticula-0.6.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file reticula-0.6.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for reticula-0.6.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 39288d3efef513e2791a9c2dff6dec332357b65a6cb3df344014c2af6f1dec7e
MD5 646bb0edaf084d067870d1117f7f826d
BLAKE2b-256 1e6b455d002a014886cfeb9daccd61461a7eb29ee3b9f0e414801e6c53ef2d36

See more details on using hashes here.

File details

Details for the file reticula-0.6.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for reticula-0.6.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0b336721c8912ca212c32153595e285fe98b0efb4c1fe07fbb56a5e354aae3a5
MD5 0ceda6db3f26887838db49d6d84e2976
BLAKE2b-256 a6d7feda449177e7a812594b2228b1bfb66efce7ae429914be5e1b3a9c9b199d

See more details on using hashes here.

File details

Details for the file reticula-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for reticula-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a65f7662df4efd8d33c380ab37946ab907518ff8311db5796428af617af00b03
MD5 b0d6c97db9abc3ddc0fa3a1498a98d6d
BLAKE2b-256 777dfb49661e6f778c8a8772fc1544ef26b0c73819a650bfb108f54bfd097af7

See more details on using hashes here.

File details

Details for the file reticula-0.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for reticula-0.6.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ec8a63d487f05cc69c4449ad9a4d04852846204902f1849500b8452e22e5a69c
MD5 3d4aa5cdc2d6395dd208d70bc7df67ce
BLAKE2b-256 0c0387ba1054c4d6b4fae4d13d4811685afa909f2ef7550fc685610ef9a9a2be

See more details on using hashes here.

File details

Details for the file reticula-0.6.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for reticula-0.6.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4a0c0cdbac9727d38bc3450edd52e70639e8656eb4291381ab9ba47a369c316a
MD5 0ae3c9e57709509861385ce45611b592
BLAKE2b-256 024a13f701476272ee6ea0e041cf44deb5973c8f1b8c3a2a7c149c81a9d06043

See more details on using hashes here.

File details

Details for the file reticula-0.6.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for reticula-0.6.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5158c2913de1215bd4373b1a8242145a75b7b35423ef609cc6228c9a046bdd1e
MD5 d9cef4dc978d767634de40785f53ef9d
BLAKE2b-256 a5c1c8d41e9a0a62410bd9b2fee63e1b2ca3536e3acb974070ceee721520e3ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page