-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
384f9c1
commit d92d66f
Showing
47 changed files
with
2,213 additions
and
294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
# | ||
# graphviz: This package facilitates the creation of graph descriptions in the | ||
# DOT language of the Graphviz graph drawing software from GAP | ||
# | ||
# This file contains package meta data. For additional information on | ||
# the meaning and correct usage of these fields, please consult the | ||
# manual of the "Example" package as well as the comments in its | ||
# PackageInfo.g file. | ||
# | ||
############################################################################# | ||
## | ||
## PackageInfo.g | ||
## Copyright (C) 2024 Matthew Pancer | ||
## | ||
## Licensing information can be found in the README file of this package. | ||
## | ||
############################################################################# | ||
## | ||
|
||
SetPackageInfo(rec( | ||
|
||
PackageName := "graphviz", | ||
|
@@ -26,12 +27,24 @@ Persons := [ | |
PostalAddress := Concatenation("Mathematical Institute, North Haugh,", | ||
" St Andrews, Fife, KY16 9SS, Scotland"), | ||
Place := "St Andrews", | ||
Institution := "University of St Andrews"), | ||
rec( | ||
FirstNames := "Matthew", | ||
LastName := "Pancer", | ||
Email := "[email protected]", | ||
IsAuthor := true, | ||
IsMaintainer := true, | ||
PostalAddress := Concatenation("Mathematical Institute, North Haugh,", | ||
" St Andrews, Fife, KY16 9SS, Scotland"), | ||
# TODO correct? Or should be cs? | ||
Place := "St Andrews", | ||
Institution := "University of St Andrews")], | ||
|
||
SourceRepository := rec(Type := "git", | ||
URL := "https://github.com/digraphs/graphviz"), | ||
IssueTrackerURL := "https://github.com/digraphs/graphviz/issues", | ||
PackageWWWHome := "TODO", | ||
PackageWWWHome := Concatenation("https://digraphs.github.io/", | ||
~.PackageName), | ||
|
||
PackageInfoURL := Concatenation(~.PackageWWWHome, "PackageInfo.g"), | ||
README_URL := Concatenation(~.PackageWWWHome, "README.md"), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
gaplint --disable W004 $@ *.g gap/* read.g init.g PackageInfo.g makedoc.g tst/testall.g tst/*.tst tst/examples/*.tst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
This simple script adds the local variables used in a GAP tst file to the top | ||
of the file. | ||
""" | ||
import os | ||
import re | ||
import sys | ||
import textwrap | ||
|
||
import yaml | ||
from bs4 import BeautifulSoup | ||
|
||
|
||
def main(): | ||
if sys.version_info[0] < 3: | ||
raise Exception("Python 3 is required") | ||
args = sys.argv[1:] | ||
pattern1 = re.compile(r"(\w+)\s*:=") | ||
pattern2 = re.compile(r"for (\w+) in") | ||
for fname in args: | ||
lvars = [] | ||
with open(fname, "r") as f: | ||
lines = f.read() | ||
lvars.extend([x.group(1) for x in re.finditer(pattern1, lines)]) | ||
lvars.extend([x.group(1) for x in re.finditer(pattern2, lines)]) | ||
lvars = ", ".join(sorted([*{*lvars}])) | ||
lvars = [x if x[-1] != "," else x[:-1] for x in textwrap.wrap(lvars, width=72)] | ||
lvars = [""] + ["#@local " + x for x in lvars] | ||
lines = lines.split("\n") | ||
pos = next(i for i in range(len(lines)) if "START_TEST" in lines[i]) | ||
lines = lines[:pos] + lvars + lines[pos:] | ||
lines = "\n".join(lines) | ||
with open(fname, "w") as f: | ||
print(f"Writing local variables to {fname}...") | ||
f.write(lines) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
############################################################################# | ||
## | ||
## btree.g | ||
## Copyright (C) 2024 Matthew Pancer | ||
## | ||
## Licensing information can be found in the README file of this package. | ||
## | ||
############################################################################# | ||
## | ||
|
||
# https://graphviz.readthedocs.io/en/stable/examples.html | ||
# https://graphviz.org/Gallery/directed/unix.html | ||
LoadPackage("graphviz"); | ||
|
||
s := GraphvizDigraph("g"); | ||
GraphvizSetAttr(s, "node [shape=record, height=.1]"); | ||
|
||
GraphvizSetAttr(GraphvizAddNode(s, "node0"), "label", "<f0> |<f1> G|<f2>"); | ||
GraphvizSetAttr(GraphvizAddNode(s, "node1"), "label", "<f0> |<f1> E|<f2>"); | ||
GraphvizSetAttr(GraphvizAddNode(s, "node2"), "label", "<f0> |<f1> B|<f2>"); | ||
GraphvizSetAttr(GraphvizAddNode(s, "node3"), "label", "<f0> |<f1> F|<f2>"); | ||
GraphvizSetAttr(GraphvizAddNode(s, "node4"), "label", "<f0> |<f1> R|<f2>"); | ||
GraphvizSetAttr(GraphvizAddNode(s, "node5"), "label", "<f0> |<f1> H|<f2>"); | ||
GraphvizSetAttr(GraphvizAddNode(s, "node6"), "label", "<f0> |<f1> Y|<f2>"); | ||
GraphvizSetAttr(GraphvizAddNode(s, "node7"), "label", "<f0> |<f1> A|<f2>"); | ||
GraphvizSetAttr(GraphvizAddNode(s, "node8"), "label", "<f0> |<f1> C|<f2>"); | ||
|
||
GraphvizAddEdge(s, "node0:f2", "node4:f1"); | ||
GraphvizAddEdge(s, "node0:f0", "node1:f1"); | ||
GraphvizAddEdge(s, "node1:f0", "node2:f1"); | ||
GraphvizAddEdge(s, "node1:f2", "node3:f1"); | ||
GraphvizAddEdge(s, "node2:f2", "node8:f1"); | ||
GraphvizAddEdge(s, "node2:f0", "node7:f1"); | ||
GraphvizAddEdge(s, "node4:f2", "node6:f1"); | ||
GraphvizAddEdge(s, "node4:f0", "node5:f1"); | ||
|
||
Print(AsString(s)); | ||
Splash(s); | ||
QUIT; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
############################################################################# | ||
## | ||
## colors.g | ||
## Copyright (C) 2024 Matthew Pancer | ||
## | ||
## Licensing information can be found in the README file of this package. | ||
## | ||
############################################################################# | ||
## | ||
|
||
# https://graphviz.readthedocs.io/en/stable/examples.html | ||
# https://graphviz.org/docs/attr-types/color | ||
|
||
LoadPackage("graphviz"); | ||
g := GraphvizGraph(); | ||
|
||
node := GraphvizAddNode(g, "RGB: #40e0d0"); | ||
GraphvizSetAttr(node, "style", "filled"); | ||
GraphvizSetAttr(node, "fillcolor", "\"#40e0d0\""); | ||
|
||
node := GraphvizAddNode(g, "RGBA: #ff000042"); | ||
GraphvizSetAttr(node, "style", "filled"); | ||
GraphvizSetAttr(node, "fillcolor", "\"#ff000042\""); | ||
|
||
node := GraphvizAddNode(g, "HSV: 0.051 0.718 0.627"); | ||
GraphvizSetAttr(node, "style", "filled"); | ||
GraphvizSetAttr(node, "fillcolor", "0.051 0.718 0.627"); | ||
|
||
node := GraphvizAddNode(g, "name: deeppink"); | ||
GraphvizSetAttr(node, "style", "filled"); | ||
GraphvizSetAttr(node, "fillcolor", "deeppink"); | ||
|
||
Print(AsString(g)); | ||
Splash(g); | ||
QUIT; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
############################################################################# | ||
## | ||
## hello.g | ||
## Copyright (C) 2024 Matthew Pancer | ||
## | ||
## Licensing information can be found in the README file of this package. | ||
## | ||
############################################################################# | ||
## | ||
|
||
# https://graphviz.readthedocs.io/en/stable/examples.html | ||
LoadPackage("graphviz"); | ||
graph := GraphvizDigraph("G"); | ||
GraphvizAddEdge(graph, "hello", "world"); | ||
Print(AsString(graph)); | ||
Splash(graph); | ||
QUIT; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.