Skip to content

Commit 75caf03

Browse files
committed
Update Reticula to fix segfault
1 parent 91aea36 commit 75caf03

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include(FetchContent)
99
FetchContent_Declare(
1010
reticula
1111
GIT_REPOSITORY https://github.com/reticula-network/reticula.git
12-
GIT_TAG 9967986f4487fcfa96ee72f5d5a849109523fc9f)
12+
GIT_TAG 9d6ff6fa0dbe1cac4814ab7533ac7fd1793be7fa)
1313

1414
FetchContent_Declare(
1515
fmt

tests/test_graph_operations.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,40 @@ def is_constant(d):
9999
print(d1, d2, sp, r)
100100

101101
assert (math.isnan(sp) and math.isnan(r)) or sp == pytest.approx(r)
102+
103+
104+
@given(undirected_network(max_verts=30))
105+
def test_connected_components(net):
106+
ccs = ret.connected_components(net)
107+
108+
# check that it is a partition
109+
assert set(net.vertices()) == set().union(*ccs)
110+
111+
lcc = ret.largest_connected_component(net)
112+
if ccs:
113+
assert lcc == max(ccs, key=len)
114+
else:
115+
assert list(lcc) == []
116+
117+
connected_subgraph = ret.vertex_induced_subgraph(net, lcc)
118+
assert ret.is_connected(connected_subgraph)
119+
120+
from itertools import product
121+
for cc in ccs:
122+
for v in cc:
123+
assert ret.connected_component(net, v) == cc
124+
125+
for v1, v2 in product(cc, repeat=2):
126+
assert ret.is_reachable(net, v1, v2)
127+
128+
from itertools import combinations
129+
for c1, c2 in combinations(ccs, r=2):
130+
for v1, v2 in product(c1, c2):
131+
assert not ret.is_reachable(net, v1, v2)
132+
assert not ret.is_reachable(net, v2, v1)
133+
134+
135+
@given(undirected_network(self_loops=False))
136+
def test_graphicality(net):
137+
degs = ret.degree_sequence(net)
138+
assert ret.is_graphic(degs)

0 commit comments

Comments
 (0)