-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathHypergraph.wlt
More file actions
72 lines (50 loc) · 1.92 KB
/
Copy pathHypergraph.wlt
File metadata and controls
72 lines (50 loc) · 1.92 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
<|
"HypergraphPlot" -> <|
"init" -> (
Attributes[Global`testUnevaluated] = Attributes[Global`testSymbolLeak] = {HoldAll};
Global`testUnevaluated[args___] := SetReplace`PackageScope`testUnevaluated[VerificationTest, args];
Global`testSymbolLeak[args___] := SetReplace`PackageScope`testSymbolLeak[VerificationTest, args];
Global`$hypergraphSymmetries = SetReplace`Hypergraph`PackagePrivate`$hypergraphSymmetries;
),
"tests" -> {
(* Argument Checks *)
(** Argument count **)
testUnevaluated[
Hypergraph[],
{Hypergraph::argt}
],
testUnevaluated[
Hypergraph[{{1, 1, 1}}, "Ordered", 1],
{Hypergraph::argt}
],
(** 1st argument **)
testUnevaluated[
Hypergraph[{1, 1, 1}],
{Hypergraph::invalidHyperedges}
],
(** 2nd argument **)
testUnevaluated[
Hypergraph[{{1, 1, 1}}, "Directed"],
{Hypergraph::invalidSymmetry}
],
(* Constructor *)
VerificationTest[HypergraphQ[Hypergraph[{{1, 1, 1}}]]],
VerificationTest[HypergraphQ[Hypergraph[{{1, {1}}, {{1}, x, y}}]]],
(* Default 2nd argument *)
VerificationTest[Hypergraph[{{1}}] === Hypergraph[{{1}}, "Ordered"]],
(* Available symmetries *)
VerificationTest[AllTrue[Hypergraph[{{1}}, #] & /@ $hypergraphSymmetries, HypergraphQ]],
(* Accessors *)
With[{hg = Hypergraph[{{1, 1, 2}, {2, 5, 4, 3}, {3, 6}}, "Unordered"]},
{
VerificationTest[VertexList[hg], {1, 2, 5, 4, 3, 6}],
VerificationTest[EdgeList[hg], {{1, 1, 2}, {2, 5, 4, 3}, {3, 6}}],
VerificationTest[Normal[hg], EdgeList[hg]],
VerificationTest[VertexCount[hg] === Length[VertexList[hg]] === 6],
VerificationTest[EdgeCount[hg] === Length[EdgeList[hg]] === 3],
VerificationTest[HypergraphSymmetry[hg], "Unordered"]
}
]
}
|>
|>