Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more detail to the doc and the README file #29

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ ArchiveURL := Concatenation(~.PackageWWWHome,
~.Version),
ArchiveFormats := ".tar.gz",

AbstractHTML := "TODO",

PackageDoc := rec(
BookName := "graphviz",
ArchiveURLSubset := ["doc"],
Expand All @@ -75,4 +73,30 @@ Dependencies := rec(

AvailabilityTest := ReturnTrue,

TestFile := "tst/testall.g"));
TestFile := "tst/testall.g",

AutoDoc := rec(
TitlePage := rec(
Copyright := """&copyright; by J. D. Mitchell and M. Pancer.<P/>
&GAPGraphviz; is free software; you can redistribute it and/or modify
it, under the terms of the GNU General Public License, version 3 of
the License, or (at your option) any later, version.""",
Abstract := """
This package facilitates the creation and rendering of graph
descriptions in the &DOT; language of the &Graphviz; graph drawing
software from &GAP;.
<P/>

Create a graphviz object, assemble the graph by adding nodes and edges,
and retrieve its &DOT; source code string. Save the source code to a file
and render it with the &Graphviz; installation of your system.
<P/>

Use the <Ref Func="Splash"/> function to directly inspect the resulting
graph.
<P/>

This package was inspired by the python package of the same name
&PyGraphviz;.""")),

AbstractHTML := ~.AutoDoc.TitlePage.Abstract));
130 changes: 120 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,126 @@
# The GAP package graphviz
## README

TODO: add a description of your package; perhaps also instructions how how to
install and use it, resp. where to find out more
### Graphviz package for GAP

## Contact
#### Copyright (C) 2024 by J. D. Mitchell and M. Pancer

TODO: add info on how to contact you and/or how to report issues with your
package
## Graphviz for GAP

This package facilitates the creation and rendering of graph
descriptions in the [DOT][] language of the [Graphviz][] graph drawing
software from [GAP][].

You can create a graphviz object, assemble the graph by adding nodes and
edges, attributes, labels, colours, subgraphs, and clusters, and
retrieve its [DOT][] source code string. Save the source code to a file
and render it with the [Graphviz] installation on your system.

You can use the [Splash] function to directly inspect the resulting
graph.

This package was inspired by the python package of the same name
[Python Graphviz][].

## License

TODO: Provide information on the license of your package. A license is
important as it determines who has a right to distribute your package. The
"default" license to consider is GNU General Public License v2 or later, as
that is the license of GAP itself.
This package is distributed under the GNU General Public License v2 or later.
See the `LICENSE` file for more details.

## Links

- GitHub: [https://github.com/digraphs/graphviz](https://github.com/digraphs/graphviz)
- Documentation: TODO
- Changelog: TODO
- Issue Tracker: [https://github.com/digraphs/graphviz/issues](https://github.com/digraphs/graphviz/issues)
- Download: TODO

## Installation

This package requires [GAP][] version 4.11.0 or higher. The most
up-to-date version of GAP, and instructions on how to install it, can be
obtained from the [main GAP webpage](https://www.gap-system.org). This
package has no further dependencies!

### From sources

To get the latest version of the package, download the archive file
`graphviz-x.x.x.tar.gz` from the [Graphviz package for GAP webpage][].
Then, inside the `pkg` subdirectory of your GAP installation, unpack the
archive `graphviz-x.x.x.tar.gz` in your `gap/pkg` directory, using

gunzip graphviz-x.x.x.tar.gz; tar xvf graphviz-x.x.x.tar

for example. This will create a subdirectory `graphviz-x.x.x`.

### Using the [PackageManager][]

Start GAP in the usual way, then type:

LoadPackage("PackageManager");
InstallPackage("graphviz");

## Quickstart

Create a graph object:

gap> LoadPackage("graphviz");
───────────────────────────────────────────────────────────────────────────────────
Loading graphviz 0.0.0 (TODO)
by James D. Mitchell (https://jdbm.me) and
Matthew Pancer (mp322@st-andrews.ac.uk).
Homepage: https://digraphs.github.io/graphviz
Report issues at https://github.com/digraphs/graphviz/issues
───────────────────────────────────────────────────────────────────────────────────
true
gap> dot := GraphvizDigraph("The Round Table");
<graphviz digraph "The Round Table" with 0 nodes and 0 edges>

Add nodes and edges:

gap> GraphvizSetAttr(GraphvizAddNode(dot, "A"), "label", "King Arthur");
<graphviz node "A">
gap> GraphvizSetAttr(GraphvizAddNode(dot, "B"), "label", "Sir Bedevere the Wise");
<graphviz node "B">
gap> GraphvizSetAttr(GraphvizAddNode(dot, "L"), "label", "Sir Lancelot the Brave");
<graphviz node "L">
gap> GraphvizAddEdge(dot, "A", "B");
<graphviz edge (A, B)>
gap> GraphvizAddEdge(dot, "A", "L");
<graphviz edge (A, L)>
gap> GraphvizSetAttr(GraphvizAddEdge(dot, "B", "L"), "constraint", false);

Check the generated source code:

gap> Print(AsString(dot));
//dot
digraph {
A [label="King Arthur"]
B [label="Sir Bedevere the Wise"]
L [label="Sir Lancelot the Brave"]
A -> B
A -> L
B -> L [constraint=false]
}

Save the source code:

gap> FileString("round-table.gv", AsString(dot));
134

Render and view the result:

gap> Splash(dot);

![The Round Table](https://raw.github.com/digraphs/graphviz/main/docs/png/The_Round_Table.png)

## Issues

For questions, remarks, suggestions, and issues please use the
[issue tracker](https://github.com/digraphs/graphviz/issues).

[DOT]: https://www.graphviz.org/doc/info/lang.html
[GAP]: https://www.gap-system.org
[Graphviz]: https://www.graphviz.org
[Graphviz webpage]: https://digraphs.github.io/Digraphs
[PackageManager]: https://gap-packages.github.io/PackageManager
[Python Graphviz]: https://pypi.org/project/graphviz/
Loading
Loading