Skip to content

Commit f720c1f

Browse files
committed
Added SCC cycle test
1 parent 226959e commit f720c1f

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

test/scc4.test

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// SCC test, with a long path, and a branch in the middle
22
// that goes to a minimum value
33

4-
N = 100
5-
N2 = 50
4+
N = 100000
5+
N2 = 50000
66

77
V1 = 1
88
V2 = N+V1

test/scc5.test

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// SCC test with a single long path, with small cycles
2+
// between pairs of vertices
3+
4+
N = 100000
5+
6+
V1 = 1
7+
V2 = N-1+V1
8+
V3 = N+V2
9+
10+
E1 = 1
11+
E2 = N-1+E1
12+
E3 = N-1+E2
13+
E4 = N-1+E3
14+
15+
off1b = r(V1, 1)-r(E1, 1)
16+
off2b = r(V3, 1)-r(E2, 1)-1
17+
off3b = r(V2, 1)-r(E3, 1)
18+
off4b = r(V2, 1)-r(E4, 1)
19+
20+
off1d = r(V3, 1)-r(E1, 1)-N+1
21+
off2d = r(V2, 1)-r(E2, 1)
22+
off3d = r(V3, 1)-r(E3, 1)
23+
off4d = r(V3, 1)-r(E4, 1)-1
24+
25+
V %= {[1:1:V1], [V1+1:1:V2], [V2+1:1:V3]};
26+
Vmap %= <<{[1:1:V1]} -> 0*x+1, {[V1+1:1:V2]} -> 0*x+2, {[V2+1:1:V3]} -> 0*x+3>>;
27+
mapB %= <<{[1:1:E1]} -> 1*x+off1b, {[E1+1:1:E2]} -> 1*x+off2b, {[E2+1:1:E3]} -> 1*x+off3b
28+
, {[E3+1:1:E4]} -> 1*x+off4b>>;
29+
mapD %= <<{[1:1:E1]} -> 1*x+off1d, {[E1+1:1:E2]} -> 1*x+off2d, {[E2+1:1:E3]} -> 1*x+off3d
30+
, {[E3+1:1:E4]} -> 1*x+off4d>>;
31+
Emap %= <<{[1:1:E1]} -> 0*x+1, {[E1+1:1:E2], [E2+1:1:E3], [E3+1:1:E4]} -> 0*x+2>>;
32+
33+
scc(
34+
V %= {[1:1:V1], [V1+1:1:V2], [V2+1:1:V3]};
35+
Vmap %= <<{[1:1:V1]} -> 0*x+1, {[V1+1:1:V2]} -> 0*x+2, {[V2+1:1:V3]} -> 0*x+3>>;
36+
mapB %= <<{[1:1:E1]} -> 1*x+off1b, {[E1+1:1:E2]} -> 1*x+off2b, {[E2+1:1:E3]} -> 1*x+off3b
37+
, {[E3+1:1:E4]} -> 1*x+off4b>>;
38+
mapD %= <<{[1:1:E1]} -> 1*x+off1d, {[E1+1:1:E2]} -> 1*x+off2d, {[E2+1:1:E3]} -> 1*x+off3d
39+
, {[E3+1:1:E4]} -> 1*x+off4d>>;
40+
Emap %= <<{[1:1:E1]} -> 0*x+1, {[E1+1:1:E2], [E2+1:1:E3], [E3+1:1:E4]} -> 0*x+2>>;
41+
)

0 commit comments

Comments
 (0)