Skip to content

Commit 48c11e5

Browse files
Merge branch 'digraphs:main' into main
2 parents 673c8ff + 1f56fb0 commit 48c11e5

16 files changed

Lines changed: 433 additions & 85 deletions

File tree

.codecov.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,11 @@ coverage:
1111
default:
1212
target: 100
1313
threshold: 0
14-
informational: false # Do fail the check if the diff is not 100% covered
14+
informational: true # Don't fail the check if the diff is not 100% covered
1515
changes: # Information about changes in coverage outside the diff
1616
default:
1717
informational: true # Don't fail the check
1818

19-
# Comment to post on PRs
20-
comment: false
21-
2219
ignore:
2320
- "extern/"
2421
- "gap/utils.gi"

.github/workflows/manual.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
gap-version: latest
4141
- uses: gap-actions/build-pkg-docs@v2
4242
- name: Upload compiled manuals . . .
43-
uses: actions/upload-artifact@v5
43+
uses: actions/upload-artifact@v7
4444
with:
4545
name: Digraphs manual
4646
retention-days: 7

.github/workflows/os.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ jobs:
3838
pkgs-to-clone: https://github.com/digraphs/graphviz.git https://github.com/gap-packages/NautyTracesInterface.git
3939
pkgs-to-build: io orb datastructures grape profiling NautyTracesInterface
4040

41-
4241
steps:
4342
- uses: actions/checkout@v5
4443
- uses: gap-actions/setup-cygwin@v2
@@ -93,22 +92,20 @@ jobs:
9392
uses: gap-actions/run-pkg-tests@v4
9493
with:
9594
testfile: tst/github_actions/install.g
95+
coverage: "false"
9696
- name: Run DigraphsTestStandard . . .
9797
uses: gap-actions/run-pkg-tests@v4
9898
with:
9999
testfile: tst/github_actions/standard.g
100+
coverage: "false"
100101
- name: Run DigraphsTestManualExamples . . .
101102
uses: gap-actions/run-pkg-tests@v4
102103
with:
103104
testfile: tst/github_actions/examples.g
105+
coverage: "false"
104106
- name: Run DigraphsTestExtreme . . .
105107
uses: gap-actions/run-pkg-tests@v4
106108
if: ${{ runner.os != 'Windows' }}
107109
with:
108110
testfile: tst/github_actions/extreme.g
109-
- uses: gap-actions/process-coverage@v3
110-
- uses: codecov/codecov-action@v5
111-
with:
112-
token: ${{ secrets.CODECOV_TOKEN }}
113-
# codecov/codecov-action seems unreliable on Windows
114-
fail_ci_if_error: ${{ runner.os != 'Windows' }}
111+
coverage: "false"

.github/workflows/ubuntu.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ jobs:
4141
pkgs-to-clone: https://github.com/digraphs/graphviz.git https://github.com/gap-packages/NautyTracesInterface.git
4242
pkgs-to-build: io orb datastructures profiling grape NautyTracesInterface
4343

44-
- gap-version: v4.11 # Note: NautyTracesInterface requires GAP 4.12
45-
mode: default # There wouldn't be much point testing GAP v4.11 with only needed packages. The only difference is whether Grape is loaded.
44+
- gap-version: v4.11 # Note: NautyTracesInterface requires GAP 4.12
45+
mode: default # There wouldn't be much point testing GAP v4.11 with only needed packages. The only difference is whether Grape is loaded.
4646
pkgs-to-clone: https://github.com/digraphs/graphviz.git
4747
pkgs-to-build: io* orb* datastructures* profiling* grape*
4848

@@ -92,7 +92,8 @@ jobs:
9292
testfile: tst/github_actions/extreme.g
9393
mode: ${{ matrix.mode }}
9494
- uses: gap-actions/process-coverage@v3
95+
if: ${{ matrix.gap-version == 'master' && matrix.mode == 'default'}}
9596
- uses: codecov/codecov-action@v5
97+
if: ${{ matrix.gap-version == 'master' && matrix.mode == 'default'}}
9698
with:
9799
token: ${{ secrets.CODECOV_TOKEN }}
98-
fail_ci_if_error: true

doc/digraphs.bib

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@ @article{Gab00
8282
Bdsk-Url-1 = {https://www.sciencedirect.com/science/article/pii/S002001900000051X},
8383
}
8484

85+
@article{HP05,
86+
title = {A simple linear time algorithm for cograph recognition},
87+
journal = {Discrete Applied Mathematics},
88+
volume = {145},
89+
number = {2},
90+
pages = {183-197},
91+
year = {2005},
92+
note = {Structural Decompositions, Width Parameters, and Graph Labelings},
93+
issn = {0166-218X},
94+
doi = {https://doi.org/10.1016/j.dam.2004.01.011},
95+
url = {https://www.sciencedirect.com/science/article/pii/S0166218X04002446},
96+
author = {Michel Habib and Christophe Paul},
97+
keywords = {Modular decomposition, Graphs, Algorithms},
98+
}
99+
85100
@inproceedings{JK07,
86101
Author = {Tommi Junttila and Petteri Kaski},
87102
Booktitle = {Proceedings of the Ninth Workshop on Algorithm Engineering and

doc/io.xml

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,88 @@
88
#############################################################################
99
##
1010

11+
12+
<#GAPDoc Label="EncodingFormats">
13+
<Subsection Label="EncodingFormats">
14+
<Heading>Encoding Formats</Heading>
15+
<List>
16+
<Mark> Graph6 </Mark>
17+
<Item>
18+
<E> Graph6 </E> is a graph data format for storing undirected graphs
19+
with no multiple edges nor loops of size up to <M> 2^{36} - 1 </M> in
20+
printable characters. Graphs that do not fit the above criteria cannot be
21+
guaranteed to be accurately encoded as Graph6. The format consists of two parts. The first part
22+
uses one to eight bytes to store the number of vertices. And the second
23+
part is the upper half of the adjacency matrix converted into ASCII
24+
characters. For a more detailed description see <URL Text='Graph6'>
25+
http://cs.anu.edu.au/~bdm/data/formats.txt</URL>.
26+
</Item>
27+
28+
<Mark> Sparse6 </Mark>
29+
<Item>
30+
<E> Sparse6 </E> is a graph data format for storing undirected graphs
31+
with possibly multiple edges or loops. The maximal number of vertices
32+
allowed is <M> 2^{36} - 1 </M>. The format consists of two parts. The
33+
first part uses one to eight bytes to store the number of vertices.
34+
And the second part only stores information about the edges.
35+
Therefore, the <E> Sparse6 </E> format return a more compact encoding
36+
then <E> Graph6 </E> for sparse graph, i.e. graphs where the number
37+
of edges is much less than the number of vertices squared. Sparse6 can
38+
faithfully encode any symmetric digraph. For a more
39+
detailed description see <URL Text='Sparse6'>
40+
http://cs.anu.edu.au/~bdm/data/formats.txt</URL>.
41+
</Item>
42+
43+
<Mark> Digraph6 </Mark>
44+
<Item>
45+
<E>Digraph6</E> is a new format based on <E> Graph6 </E>, but designed
46+
for digraphs. The entire adjacency matrix is stored, and
47+
therefore there is support for directed edges and single-vertex loops.
48+
However, multiple edges are not supported.
49+
</Item>
50+
51+
<Mark> DiSparse6 </Mark>
52+
<Item>
53+
<E>DiSparse6</E> is a new format based on <E> Sparse6 </E>, but
54+
designed for digraphs. In this format the list of edges is
55+
partitioned into increasing and decreasing edges, depending whether the
56+
edge has its source bigger than the range. Then both sets of edges are
57+
written separately in <E> Sparse6 </E> format with a separation symbol
58+
in between. Any digraph can be properly encoded with a DiSparse6 representation.
59+
</Item>
60+
<Mark> dreadnaut </Mark>
61+
<Item>
62+
<E>dreadnaut</E> is a graph data format designed for directed and undirected graphs.
63+
The format supports loops but multiple edges are ignored. The format consists of an
64+
initial section that defines the graph's structural properties, such as the number of
65+
vertices, the starting value for vertices, and whether the graph is directed. This is followed
66+
by a list of edges. For more information and examples of the format see
67+
<URL Text="nauty and Traces User's Guide">http://pallini.di.uniroma1.it/Guide.html</URL>.
68+
</Item>
69+
<Mark> DIMACS </Mark>
70+
<Item>
71+
<E>DIMACS</E> is a graph data format that can be used for symmetric digraphs.
72+
For a more detailed description, see <Ref Oper="WriteDIMACSDigraph"/>
73+
</Item>
74+
</List>
75+
76+
NOTE: These functions do not signal an error if <A>digraph</A> has features that
77+
the chosen format does not support. In that case the encoding may not be equal
78+
to <A>digraph</A>. For example, <C>Digraph6String</C>
79+
silently drops multiple edges, since Digraph6 stores only the adjacency
80+
matrix:
81+
<Log><![CDATA[
82+
gap> gr := Digraph([[2, 2], []]);
83+
<immutable multidigraph with 2 vertices, 2 edges>
84+
gap> Digraph6String(gr);
85+
"+AG"
86+
gap> DigraphFromDigraph6String(last) = gr;
87+
false
88+
]]></Log>
89+
90+
</Subsection>
91+
<#/GAPDoc>
92+
1193
<#GAPDoc Label="IteratorFromDigraphFile">
1294
<ManSection>
1395
<Func Name="IteratorFromDigraphFile" Arg="filename [, decoder]"/>
@@ -233,6 +315,10 @@ gap> DigraphFromGraph6String(IsMutableDigraph, "IheA@GUAo");
233315
be mutable or immutable.
234316
If no first argument is provided, then an immutable
235317
digraph is returned by default.
318+
319+
Note that some digraphs will not be accurately recovered if they were
320+
encoded in an invalid format; see <Ref Subsect="EncodingFormats" Style="Number"/> for
321+
full limitations. <P/>
236322
<Example><![CDATA[
237323
gap> DigraphFromGraph6String("?");
238324
<immutable empty digraph with 0 vertices>
@@ -496,13 +582,18 @@ gap> ReadDigraphs(filename);
496582
<Oper Name="DiSparse6String" Arg="digraph"/>
497583
<Returns>A string.</Returns>
498584
<Description>
499-
These four functions return a highly compressed string fully describing the
585+
These four functions return a highly compressed string describing the
500586
digraph <A>digraph</A>. <P/>
501587

502588
Graph6 and Digraph6 are formats best used on small, dense graphs, if
503589
applicable. For larger, sparse graphs use <E>Sparse6</E> and
504590
<E>Disparse6</E> (this latter also preserves multiple edges). <P/>
505591

592+
A detailed description of the formats: Graph6, Digraph6,
593+
Sparse6, and DiSparse6, the kinds of digraphs that each format can encode,
594+
and their comparative strengths and weaknesses, is given in
595+
<Ref Subsect="EncodingFormats" Style="Number"/>. <P/>
596+
506597
See <Ref Func="WriteDigraphs"/>.
507598
<Example><![CDATA[
508599
gap> gr := Digraph([[2, 3], [1], [1]]);

doc/prop.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,50 @@ true
875875
</ManSection>
876876
<#/GAPDoc>
877877

878+
<#GAPDoc Label="IsCograph">
879+
<ManSection>
880+
<Prop Name="IsCograph" Arg="digraph"/>
881+
<Returns><K>true</K> or <K>false</K>.</Returns>
882+
<Description>
883+
If <A>digraph</A> is a symmetric digraph without loops or multiple edges, then the
884+
property returns true if <A>digraph</A> is a cograph, and false if it is not.
885+
<P/>
886+
887+
A symmetric digraph without loops or multiple edges is called a <E>cograph</E>
888+
if it does not contain a copy of the path graph on four vertices as
889+
an induced subgraph. Equivalently, cographs are those graphs which may be
890+
reached starting from a single vertex under the operations of series and parallel
891+
composition.
892+
<P/>
893+
894+
This function implements the algorithm for cograph recogntition given in
895+
<Cite Key="HP05"/>.
896+
<P/>
897+
898+
&MUTABLE_RECOMPUTED_PROP;
899+
900+
<Example><![CDATA[
901+
gap> D := DigraphByEdges([[1, 2], [2, 3], [3, 4], [4, 1]]);
902+
<immutable digraph with 4 vertices, 4 edges>
903+
gap> D := DigraphSymmetricClosure(D);
904+
<immutable symmetric digraph with 4 vertices, 8 edges>
905+
gap> IsCograph(D);
906+
true
907+
gap> D := DigraphByEdges([[1, 2], [2, 3], [3, 4]]);
908+
<immutable digraph with 4 vertices, 3 edges>
909+
gap> D := DigraphSymmetricClosure(D);
910+
<immutable symmetric digraph with 4 vertices, 6 edges>
911+
gap> IsCograph(D);
912+
false
913+
gap> D := CompleteDigraph(5);
914+
<immutable complete digraph with 5 vertices>
915+
gap> IsCograph(D);
916+
true
917+
]]></Example>
918+
</Description>
919+
</ManSection>
920+
<#/GAPDoc>
921+
878922
<#GAPDoc Label="IsFunctionalDigraph">
879923
<ManSection>
880924
<Prop Name="IsFunctionalDigraph" Arg="digraph"/>

doc/z-chap5.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
<#Include Label="IsEdgeTransitive">
8282
<#Include Label="IsVertexTransitive">
8383
<#Include Label="Is2EdgeTransitive">
84+
<#Include Label="IsCograph">
8485
</Section>
8586

8687

doc/z-chap9.xml

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -11,65 +11,9 @@
1111

1212
<Section><Heading>Reading and writing digraphs to a file</Heading>
1313
This section describes different ways to store and read graphs
14-
from a file in the &Digraphs; package.
15-
<List>
16-
<Mark> Graph6 </Mark>
17-
<Item>
18-
<E> Graph6 </E> is a graph data format for storing undirected graphs
19-
with no multiple edges nor loops of size up to <M> 2^{36} - 1 </M> in
20-
printable characters. The format consists of two parts. The first part
21-
uses one to eight bytes to store the number of vertices. And the second
22-
part is the upper half of the adjacency matrix converted into ASCII
23-
characters. For a more detail description see <URL Text='Graph6'>
24-
http://cs.anu.edu.au/~bdm/data/formats.txt</URL>.
25-
</Item>
26-
27-
<Mark> Sparse6 </Mark>
28-
<Item>
29-
<E> Sparse6 </E> is a graph data format for storing undirected graphs
30-
with possibly multiple edges or loops. The maximal number of vertices
31-
allowed is <M> 2^{36} - 1 </M>. The format consists of two parts. The
32-
first part uses one to eight bytes to store the number of vertices.
33-
And the second part only stores information about the edges.
34-
Therefore, the <E> Sparse6 </E> format return a more compact encoding
35-
then <E> Graph6 </E> for sparse graph, i.e. graphs where the number
36-
of edges is much less than the number of vertices squared. For a more
37-
detail description see <URL Text='Sparse6'>
38-
http://cs.anu.edu.au/~bdm/data/formats.txt</URL>.
39-
</Item>
40-
41-
<Mark> Digraph6 </Mark>
42-
<Item>
43-
<E>Digraph6</E> is a new format based on <E> Graph6 </E>, but designed
44-
for digraphs. The entire adjacency matrix is stored, and
45-
therefore there is support for directed edges and single-vertex loops.
46-
However, multiple edges are not supported.
47-
</Item>
48-
49-
<Mark> DiSparse6 </Mark>
50-
<Item>
51-
<E>DiSparse6</E> is a new format based on <E> Sparse6 </E>, but
52-
designed for digraphs. In this format the list of edges is
53-
partitioned into increasing and decreasing edges, depending whether the
54-
edge has its source bigger than the range. Then both sets of edges are
55-
written separately in <E> Sparse6 </E> format with a separation symbol
56-
in between.
57-
</Item>
58-
<Mark> dreadnaut </Mark>
59-
<Item>
60-
<E>dreadnaut</E> is a graph data format designed for directed and undirected graphs.
61-
The format supports loops but multiple edges are ignored. The format consists of an
62-
initial section that defines the graph's structural properties, such as the number of
63-
vertices, the starting value for vertices, and whether the graph is directed. This is followed
64-
by a list of edges. For more information and examples of the format see
65-
<URL Text="nauty and Traces User's Guide">http://pallini.di.uniroma1.it/Guide.html</URL>.
66-
</Item>
67-
<Mark> DIMACS </Mark>
68-
<Item>
69-
<E>DIMACS</E> is a graph data format that can be used for symmetric digraphs.
70-
For a more detailed description, see <Ref Oper="WriteDIMACSDigraph"/>
71-
</Item>
72-
</List>
14+
from a file in the &Digraphs; package as well as their limitations.
15+
16+
<#Include Label="EncodingFormats">
7317
<#Include Label="String">
7418
<#Include Label="DigraphFromGraph6String">
7519
<#Include Label="Graph6String">

gap/prop.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ DeclareProperty("IsPermutationDigraph", IsDigraph);
5454
DeclareProperty("IsDistributiveLatticeDigraph", IsDigraph);
5555
DeclareProperty("IsModularLatticeDigraph", IsDigraph);
5656
DeclareProperty("Is2EdgeTransitive", IsDigraph);
57+
DeclareProperty("IsCograph", IsDigraph);
5758
DeclareSynonymAttr("IsLatticeDigraph",
5859
IsMeetSemilatticeDigraph and IsJoinSemilatticeDigraph);
5960
DeclareSynonymAttr("IsPreorderDigraph",

0 commit comments

Comments
 (0)