Skip to content

Commit b9045e8

Browse files
Fix examples
1 parent c286747 commit b9045e8

31 files changed

+531
-278
lines changed

PackageInfo.g

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
#
2-
# graphviz: This package facilitates the creation of graph descriptions in the
3-
# DOT language of the Graphviz graph drawing software from GAP
4-
#
5-
# This file contains package meta data. For additional information on
6-
# the meaning and correct usage of these fields, please consult the
7-
# manual of the "Example" package as well as the comments in its
8-
# PackageInfo.g file.
9-
#
1+
#############################################################################
2+
##
3+
## PackageInfo.g
4+
## Copyright (C) 2024 Matthew Pancer
5+
##
6+
## Licensing information can be found in the README file of this package.
7+
##
8+
#############################################################################
9+
##
10+
1011
SetPackageInfo(rec(
1112

1213
PackageName := "graphviz",
@@ -26,6 +27,18 @@ Persons := [
2627
PostalAddress := Concatenation("Mathematical Institute, North Haugh,",
2728
" St Andrews, Fife, KY16 9SS, Scotland"),
2829
Place := "St Andrews",
30+
Institution := "University of St Andrews"),
31+
rec(
32+
FirstNames := "Matthew",
33+
LastName := "Pancer",
34+
WWWHome := "?",
35+
Email := "mp322@st-andrews.ac.uk",
36+
IsAuthor := true,
37+
IsMaintainer := true,
38+
PostalAddress := Concatenation("Mathematical Institute, North Haugh,",
39+
" St Andrews, Fife, KY16 9SS, Scotland"),
40+
# TODO correct? Or should be cs?
41+
Place := "St Andrews",
2942
Institution := "University of St Andrews")],
3043

3144
SourceRepository := rec(Type := "git",

examples/angles.gi renamed to examples/angles.g

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
#############################################################################
2+
##
3+
## angles.g
4+
## Copyright (C) 2024 Matthew Pancer
5+
##
6+
## Licensing information can be found in the README file of this package.
7+
##
8+
#############################################################################
9+
##
10+
111
# https://graphviz.readthedocs.io/en/stable/examples.html
212
# https://www.graphviz.org/Gallery/gradient/angles.html
313

@@ -21,7 +31,7 @@ for pair in pairs do
2131
od;
2232
GraphvizSetAttr(cluster1,
2333
"label",
24-
"\"Linear Angle Variations (white to black gradient)\"");
34+
"Linear Angle Variations (white to black gradient)");
2535

2636
cluster2 := GraphvizAddSubgraph(g, "cluster_2");
2737
GraphvizSetAttr(cluster2, "fontcolor", "white");
@@ -38,7 +48,9 @@ for pair in pairs do
3848
pair[1], pair[2]));
3949
od;
4050
GraphvizSetAttr(cluster2, "label",
41-
"\"Radial Angle Variations (white to black gradient)\"");
51+
"Radial Angle Variations (white to black gradient)");
4252

4353
GraphvizAddEdge(g, "n5", "n14");
44-
Print(AsString(g), "\n");
54+
Print(AsString(g));
55+
Splash(g);
56+
QUIT;

examples/btree.g

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#############################################################################
2+
##
3+
## btree.g
4+
## Copyright (C) 2024 Matthew Pancer
5+
##
6+
## Licensing information can be found in the README file of this package.
7+
##
8+
#############################################################################
9+
##
10+
11+
# https://graphviz.readthedocs.io/en/stable/examples.html
12+
# https://graphviz.org/Gallery/directed/unix.html
13+
LoadPackage("graphviz");
14+
15+
s := GraphvizDigraph("g");
16+
GraphvizSetAttr(s, "node [shape=record, height=.1]");
17+
18+
GraphvizSetAttr(GraphvizAddNode(s, "node0"), "label", "<f0> |<f1> G|<f2>");
19+
GraphvizSetAttr(GraphvizAddNode(s, "node1"), "label", "<f0> |<f1> E|<f2>");
20+
GraphvizSetAttr(GraphvizAddNode(s, "node2"), "label", "<f0> |<f1> B|<f2>");
21+
GraphvizSetAttr(GraphvizAddNode(s, "node3"), "label", "<f0> |<f1> F|<f2>");
22+
GraphvizSetAttr(GraphvizAddNode(s, "node4"), "label", "<f0> |<f1> R|<f2>");
23+
GraphvizSetAttr(GraphvizAddNode(s, "node5"), "label", "<f0> |<f1> H|<f2>");
24+
GraphvizSetAttr(GraphvizAddNode(s, "node6"), "label", "<f0> |<f1> Y|<f2>");
25+
GraphvizSetAttr(GraphvizAddNode(s, "node7"), "label", "<f0> |<f1> A|<f2>");
26+
GraphvizSetAttr(GraphvizAddNode(s, "node8"), "label", "<f0> |<f1> C|<f2>");
27+
28+
GraphvizAddEdge(s, "node0:f2", "node4:f1");
29+
GraphvizAddEdge(s, "node0:f0", "node1:f1");
30+
GraphvizAddEdge(s, "node1:f0", "node2:f1");
31+
GraphvizAddEdge(s, "node1:f2", "node3:f1");
32+
GraphvizAddEdge(s, "node2:f2", "node8:f1");
33+
GraphvizAddEdge(s, "node2:f0", "node7:f1");
34+
GraphvizAddEdge(s, "node4:f2", "node6:f1");
35+
GraphvizAddEdge(s, "node4:f0", "node5:f1");
36+
37+
Print(AsString(s));
38+
Splash(s);
39+
QUIT;

examples/btree.gi

Lines changed: 0 additions & 27 deletions
This file was deleted.

examples/cluster.gi renamed to examples/cluster.g

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
#############################################################################
2+
##
3+
## cluster.g
4+
## Copyright (C) 2024 Matthew Pancer
5+
##
6+
## Licensing information can be found in the README file of this package.
7+
##
8+
#############################################################################
9+
##
10+
111
# https://graphviz.readthedocs.io/en/stable/examples.html
212
LoadPackage("graphviz");
313
graph := GraphvizDigraph("G");
@@ -31,3 +41,5 @@ GraphvizSetAttr(graph["start"], "shape", "Mdiamond");
3141
GraphvizSetAttr(graph["end"], "shape", "Msquare");
3242

3343
Print(AsString(graph));
44+
Splash(graph);
45+
QUIT;

examples/cluster_edge.gi renamed to examples/cluster_edge.g

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
#############################################################################
2+
##
3+
## cluster_edge.g
4+
## Copyright (C) 2024 Matthew Pancer
5+
##
6+
## Licensing information can be found in the README file of this package.
7+
##
8+
#############################################################################
9+
##
10+
111
# https://graphviz.readthedocs.io/en/stable/examples.html
2-
# """https://www.graphviz.org/pdf/dotguide.pdf, Figure 20"""
12+
# https://www.graphviz.org/pdf/dotguide.pdf, Figure 20
313

414
LoadPackage("graphviz");
515

@@ -28,4 +38,5 @@ GraphvizSetAttr(e, "ltail", "cluster0");
2838

2939
GraphvizAddEdge(g, "d", "h");
3040

31-
Print(AsString(g));
41+
Splash(g);
42+
QUIT;

examples/colors.g

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#############################################################################
2+
##
3+
## colors.g
4+
## Copyright (C) 2024 Matthew Pancer
5+
##
6+
## Licensing information can be found in the README file of this package.
7+
##
8+
#############################################################################
9+
##
10+
11+
# https://graphviz.readthedocs.io/en/stable/examples.html
12+
# https://graphviz.org/docs/attr-types/color
13+
14+
LoadPackage("graphviz");
15+
g := GraphvizGraph();
16+
17+
node := GraphvizAddNode(g, "RGB: #40e0d0");
18+
GraphvizSetAttr(node, "style", "filled");
19+
GraphvizSetAttr(node, "fillcolor", "\"#40e0d0\"");
20+
21+
node := GraphvizAddNode(g, "RGBA: #ff000042");
22+
GraphvizSetAttr(node, "style", "filled");
23+
GraphvizSetAttr(node, "fillcolor", "\"#ff000042\"");
24+
25+
node := GraphvizAddNode(g, "HSV: 0.051 0.718 0.627");
26+
GraphvizSetAttr(node, "style", "filled");
27+
GraphvizSetAttr(node, "fillcolor", "0.051 0.718 0.627");
28+
29+
node := GraphvizAddNode(g, "name: deeppink");
30+
GraphvizSetAttr(node, "style", "filled");
31+
GraphvizSetAttr(node, "fillcolor", "deeppink");
32+
33+
Print(AsString(g));
34+
Splash(g);
35+
QUIT;

examples/colors.gi

Lines changed: 0 additions & 23 deletions
This file was deleted.

examples/er.gi renamed to examples/er.g

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
#############################################################################
2+
##
3+
## er.g
4+
## Copyright (C) 2024 Matthew Pancer
5+
##
6+
## Licensing information can be found in the README file of this package.
7+
##
8+
#############################################################################
9+
##
10+
111
# https://graphviz.readthedocs.io/en/stable/examples.html
2-
# """https://graphviz.org/Gallery/undirected/ER.html"""
12+
# https://graphviz.org/Gallery/undirected/ER.html
313
LoadPackage("graphviz");
414
e := GraphvizGraph("ER");
515
GraphvizSetAttr(e, "engine=\"neato\"");
@@ -49,3 +59,5 @@ GraphvizSetAttr(e, "label=\"Entity Relation Diagram\ndrawn by NEATO\"");
4959
GraphvizSetAttr(e, "fontsize=\"20\"");
5060

5161
Print(AsString(e));
62+
Splash(e);
63+
QUIT;

examples/fsm.gi renamed to examples/fsm.g

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
#############################################################################
2+
##
3+
## fsm.g
4+
## Copyright (C) 2024 Matthew Pancer
5+
##
6+
## Licensing information can be found in the README file of this package.
7+
##
8+
#############################################################################
9+
##
10+
111
# https://graphviz.readthedocs.io/en/stable/examples.html
2-
# """https://graphviz.org/Gallery/directed/fsm.html"""
12+
# https://graphviz.org/Gallery/directed/fsm.html
313
LoadPackage("graphviz");
414

515
f := GraphvizDigraph("finite_state_machine");
@@ -31,3 +41,5 @@ GraphvizSetAttr(GraphvizAddEdge(nodes, "LR_8", "LR_6"), "label", "\"S(b)\"");
3141
GraphvizSetAttr(GraphvizAddEdge(nodes, "LR_8", "LR_5"), "label", "\"S(a)\"");
3242

3343
Print(AsString(f));
44+
Splash(f);
45+
QUIT;

0 commit comments

Comments
 (0)