-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNamed-graphs.raku
More file actions
142 lines (103 loc) · 2.78 KB
/
Copy pathNamed-graphs.raku
File metadata and controls
142 lines (103 loc) · 2.78 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/usr/bin/env raku
use v6.d;
use Graph::Circulant;
use Graph::Complete;
use Graph::CompleteKaryTree;
use Graph::Cycle;
use Graph::Grid;
use Graph::Hypercube;
use Graph::Path;
use Graph::Petersen;
use Graph::Star;
use Graph::Wheel;
my $viz = 'wl';
##---------------------------------------------------------
## Circulant
say '=' x 100;
say 'Circulant';
say '-' x 100;
my $cicrculant = Graph::Circulant.new(n => 5, j => 3, prefix => '');
say $cicrculant;
say $cicrculant."$viz"();
##---------------------------------------------------------
## Complete
say '=' x 100;
say 'Complete';
say '-' x 100;
my $complete = Graph::Complete.new(n => 6, prefix => '');
say $complete;
say $complete."$viz"();
## Exporting to WL with WL Graph options:
# say $complete.wl(ImageSize => 600, GraphLayout => "LayeredEmbedding", Background => "`GrayLevel[0.3]`");
##---------------------------------------------------------
## CompleteKaryTree
say '=' x 100;
say 'CompleteKaryTree';
say '-' x 100;
my $kary-tree = Graph::CompleteKaryTree.new(n => 4, k => 3, prefix => '');
say $kary-tree;
say $kary-tree."$viz"();
##---------------------------------------------------------
## Cycle
say '=' x 100;
say 'Cycle';
say '-' x 100;
my $cycle = Graph::Cycle.new(n => 6, prefix => '');
say $cycle;
say $cycle."$viz"();
##---------------------------------------------------------
## Hypercube
say '=' x 100;
say 'Hypercube';
say '-' x 100;
my $hypercube = Graph::Hypercube.new(n => 3, prefix => 'g');
say $hypercube;
say $hypercube."$viz"();
##---------------------------------------------------------
## Grid
say '=' x 100;
say 'Grid';
say '-' x 100;
my $grid = Graph::Grid.new(rows => 7, columns => 5, prefix => 'g');
say $grid;
say $grid."$viz"();
##---------------------------------------------------------
## KnightTour
say '=' x 100;
say 'KnightTour';
say '-' x 100;
my $knight = Graph::Grid.new(rows => 7, columns => 5, prefix => '');
say $knight;
say $knight."$viz"();
##---------------------------------------------------------
## Star
say '=' x 100;
say 'Star';
say '-' x 100;
my $star = Graph::Star.new(leaves => 7, center => '0', prefix => '', :directed);
say $star;
say $star."$viz"();
##---------------------------------------------------------
## Path
say '=' x 100;
say 'Path';
say '-' x 100;
my $path = Graph::Path.new('a'..'k', prefix => 'note:', :directed);
say $path;
say $path."$viz"();
##---------------------------------------------------------
## Petersen
say '=' x 100;
say 'Petersen';
say '-' x 100;
my $petersen = Graph::Petersen.new(prefix => '');
say $petersen;
say $petersen."$viz"();
##---------------------------------------------------------
## Wheel
say '=' x 100;
say 'Wheel';
say '-' x 100;
my $wheel = Graph::Wheel.new(spokes => 7, center => '0', prefix => '');
say $wheel;
say $wheel."$viz"();