Skip to content

Commit 43ea96a

Browse files
committed
add temporal reachability benchmarks
1 parent f672c34 commit 43ea96a

2 files changed

Lines changed: 55 additions & 7 deletions

File tree

benchmarks/static.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Construction:
1111
"""
1212

1313
def setup(self):
14-
self.n = 2**16
14+
self.n = 2**14
1515
k = 32
1616
self.g = ret.regular_ring_lattice[ret.int64](size=self.n, degree=k)
1717
self.verts = list(self.g.vertices())
@@ -65,7 +65,7 @@ def time_is_graphic(self):
6565

6666
class Algorithms:
6767
def setup(self):
68-
self.n = 2**16
68+
self.n = 2**14
6969
k = 32
7070
self.g = ret.regular_ring_lattice[ret.int64](size=self.n, degree=k)
7171
self.g_isolated = ret.undirected_network[ret.int64](

benchmarks/temporal.py

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ class Constrction:
99
"""
1010

1111
def setup(self):
12-
self.n = 2**11
13-
rate = 16/self.n
14-
max_t = 128
12+
self.n = 2**10
13+
rate = 4/self.n
14+
max_t = 32
1515
gen = ret.mersenne_twister(42)
1616
self.g = ret.random_fully_mixed_temporal_network[ret.int64](
1717
size=self.n, rate=rate, max_t=max_t, random_state=gen)
@@ -58,8 +58,8 @@ def time_shuffled_edge_obj_construction(self):
5858
class Algorithms:
5959
def setup(self):
6060
n = 2**11
61-
rate = 16/n
62-
max_t = 128
61+
rate = 4/n
62+
max_t = 64
6363
gen = ret.mersenne_twister(42)
6464
self.g = ret.random_fully_mixed_temporal_network[ret.int64](
6565
size=n, rate=rate, max_t=max_t, random_state=gen)
@@ -76,3 +76,51 @@ def time_link_timeline(self):
7676

7777
def time_link_timelines(self):
7878
ret.link_timelines(self.g)
79+
80+
81+
class Reachability:
82+
params = [
83+
ret.temporal_adjacency.simple[
84+
ret.undirected_temporal_edge[ret.int64, ret.double]](),
85+
ret.temporal_adjacency.limited_waiting_time[
86+
ret.undirected_temporal_edge[ret.int64, ret.double]](dt=1.0),
87+
ret.temporal_adjacency.exponential[
88+
ret.undirected_temporal_edge[ret.int64, ret.double]](
89+
rate=1.0, seed=12345)
90+
]
91+
92+
param_names = ["adjacency"]
93+
94+
def setup(self, adj):
95+
gen = ret.mersenne_twister(42)
96+
97+
max_t = 32
98+
small_n = 2**6
99+
small_rate = 4/small_n
100+
self.small_g = ret.random_fully_mixed_temporal_network[ret.int64](
101+
size=small_n, rate=small_rate, max_t=max_t, random_state=gen)
102+
103+
def time_out_cluster(self, adj):
104+
ret.out_cluster(self.small_g, adj, vertex=0, time=0)
105+
106+
def time_out_clusters(self, adj):
107+
ret.out_clusters(self.small_g, adj)
108+
109+
def peakmem_out_clusters(self, adj):
110+
ret.out_clusters(self.small_g, adj)
111+
112+
def time_out_cluster_sizes(self, adj):
113+
ret.out_cluster_sizes(self.small_g, adj)
114+
115+
def peakmem_out_cluster_sizes(self, adj):
116+
ret.out_cluster_sizes(self.small_g, adj)
117+
118+
def time_out_cluster_size_estimates(self, adj):
119+
ret.out_cluster_size_estimates(self.small_g, adj,
120+
time_resolution=0.5,
121+
seed=42)
122+
123+
def peakmem_out_cluster_size_estimates(self, adj):
124+
ret.out_cluster_size_estimates(self.small_g, adj,
125+
time_resolution=0.5,
126+
seed=42)

0 commit comments

Comments
 (0)