-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathAcyclicGraphTake.wlt
More file actions
95 lines (81 loc) · 2.41 KB
/
Copy pathAcyclicGraphTake.wlt
File metadata and controls
95 lines (81 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<|
"AcyclicGraphTake" -> <|
"init" -> (
Attributes[Global`testUnevaluated] = {HoldAll};
Global`testUnevaluated[args___] := SetReplace`PackageScope`testUnevaluated[VerificationTest, args];
),
"tests" -> {
(* Verification tests *)
VerificationTest[
EdgeList[AcyclicGraphTake[Graph[{1 -> 2, 2 -> 3, 2 -> 4, 3 -> 4, 4 -> 5, 5 -> 6}], {2, 5}]],
EdgeList[Graph[{2 -> 3, 2 -> 4, 3 -> 4, 4 -> 5}]]
],
VerificationTest[
EdgeList[AcyclicGraphTake[Graph[{1 -> 2, 2 -> 3, 3 -> 4, 4 -> 5}], {2, 5}]],
EdgeList[Graph[{2 -> 3, 3 -> 4, 4 -> 5}]]
],
VerificationTest[
AcyclicGraphTake[Graph[{1 -> 2, 2 -> 3, 3 -> 4}], {1, 1}],
Graph[{1}, {}]
],
VerificationTest[
EdgeList[AcyclicGraphTake[Graph[{1 -> 2, 2 -> 3, 4 -> 3}], {1, 4}]],
{}
],
(* unevaluated *)
(* argument count *)
With[{
dag = Graph[{1 -> 2, 2 -> 3}],
loopGraph = Graph[{1 -> 1, 1 -> 2}],
undirectedGraph = Graph[{1 <-> 2, 2 <-> 3}],
cyclicGraph = Graph[{1 -> 2, 2 -> 1}]
},
{
testUnevaluated[
AcyclicGraphTake[],
{AcyclicGraphTake::argrx}
],
testUnevaluated[
AcyclicGraphTake[x],
{AcyclicGraphTake::argr}
],
(* first argument: graph *)
testUnevaluated[
AcyclicGraphTake[x, ],
{AcyclicGraphTake::invalidGraph}
],
testUnevaluated[
AcyclicGraphTake[loopGraph, x],
{AcyclicGraphTake::invalidGraph}
],
testUnevaluated[
AcyclicGraphTake[undirectedGraph, x],
{AcyclicGraphTake::invalidGraph}
],
testUnevaluated[
AcyclicGraphTake[cyclicGraph, x],
{AcyclicGraphTake::invalidGraph}
],
(* second argument: vertex list *)
testUnevaluated[
AcyclicGraphTake[dag, x],
{AcyclicGraphTake::invalidVertexList}
],
testUnevaluated[
AcyclicGraphTake[dag, {x, y, z}],
{AcyclicGraphTake::invalidVertexList}
],
testUnevaluated[
AcyclicGraphTake[dag, {6, 1}],
{AcyclicGraphTake::invalidVertex}
],
testUnevaluated[
AcyclicGraphTake[dag, {1, 6}],
{AcyclicGraphTake::invalidVertex}
]
}
]
},
"options" -> <|"Parallel" -> False|>
|>
|>