Skip to content
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
44 changes: 26 additions & 18 deletions doc/attr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -837,17 +837,19 @@ gap> DigraphTopologicalSort(D);
<Attr Name="DigraphDegeneracy" Arg="digraph"/>
<Returns>A non-negative integer, or <K>fail</K>.</Returns>
<Description>
If <A>digraph</A> is a symmetric digraph without multiple edges - see
<Ref Prop="IsSymmetricDigraph"/> and <Ref Prop="IsMultiDigraph"/> - then
If <A>digraph</A> is a symmetric digraph without multiple edges, then
this attribute returns the degeneracy of <A>digraph</A>. <P/>

The degeneracy of a digraph is the least integer <C>k</C> such
that every induced of <A>digraph</A> contains a vertex whose number of
neighbours (excluding itself) is at most <C>k</C>. Note that this means
that loops are ignored.<P/>
The <E>degeneracy</E> of a digraph is the least integer <M>k</M> such that
every induced subdigraph of <A>digraph</A> contains a vertex with no more
than <M>k</M> neighbours (ignoring loops). <P/>

If <A>digraph</A> is not symmetric or has multiple edges then this
attribute returns <K>fail</K>.
attribute returns <K>fail</K>. See <Ref Prop="IsSymmetricDigraph"/> and
<Ref Prop="IsMultiDigraph"/>.<P/>

See also <Ref Attr="DigraphDegeneracyOrdering"/>.

<Example><![CDATA[
gap> D := DigraphSymmetricClosure(ChainDigraph(5));;
gap> DigraphDegeneracy(D);
Expand All @@ -873,19 +875,25 @@ gap> DigraphDegeneracy(D);
<Attr Name="DigraphDegeneracyOrdering" Arg="digraph"/>
<Returns>A list of integers, or <K>fail</K>.</Returns>
<Description>
If <A>digraph</A> is a digraph for which
<C>DigraphDegeneracy(</C><A>digraph</A><C>)</C> is a non-negative integer
<C>k</C> - see <Ref Attr="DigraphDegeneracy"/> - then this attribute
returns a degeneracy ordering of the vertices of the vertices of
<A>digraph</A>.<P/>
If <A>digraph</A> is a symmetric digraph without multiple edges, then this
attribute returns a degeneracy ordering of the vertices of
<A>digraph</A>. <P/>

A degeneracy ordering of <A>digraph</A> is a list <C>ordering</C> of the
vertices of <A>digraph</A> ordered such that for any
position <C>i</C> of the list, the vertex <C>ordering[i]</C> has at most
<C>k</C> neighbours in later position of the list.<P/>
A <E>degeneracy ordering</E> of <A>digraph</A> is a list of all the vertices
of <A>digraph</A>, ordered such that any vertex has at most <M>k</M>
neighbours that appear after it in the list, where <M>k</M> is equal to
<C>DigraphDegeneracy(<A>digraph</A>)</C>.<P/>

The existence of this ordering acts as a demonstration that <A>digraph</A>'s
degeneracy is at most <M>k</M>: in any induced subdigraph, the vertex that
appears earliest in the degeneracy ordering must have degree at most
<M>k</M>.<P/>

If <A>digraph</A> is not symmetric or has multiple edges then this
attribute returns <K>fail</K>. See <Ref Prop="IsSymmetricDigraph"/> and
<Ref Prop="IsMultiDigraph"/>.<P/>

If <C>DigraphDegeneracy(</C><A>digraph</A><C>)</C> returns <K>fail</K>,
then this attribute returns <K>fail</K>.
See also <Ref Attr="DigraphDegeneracy"/>.
<Example><![CDATA[
gap> D := DigraphSymmetricClosure(ChainDigraph(5));;
gap> DigraphDegeneracyOrdering(D);
Expand Down
14 changes: 13 additions & 1 deletion tst/standard/attr.tst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#@local G, H, M, M1, P, S, a, adj, adj1, adj2, adjacencies, b
#@local circuit, complete15, comps, cycle12, e, edgeCut, erev, filename, forest
#@local g, gNew, gr, gr1, gr2, gr3, gr4, grid, group, i, id, isGraph, j, mat
#@local multiple, names, nbs, nonPlanar, order, planar, probs, proj, r, rd
#@local multiple, names, nbs, nonPlanar, order, outs, planar, probs, proj, r, rd
#@local reflextrans, reflextrans1, reflextrans2, representatives, rev, rgr
#@local rotationSy, rotationSystem, scc, schreierVector, sink, soccer, str
#@local table, temp, topo, trans, trans1, trans2, tree, wcc, x, y, z
Expand Down Expand Up @@ -1515,6 +1515,18 @@ gap> DigraphDegeneracy(gr);
gap> DigraphDegeneracyOrdering(gr);
[ 6, 4, 3, 2, 5, 1 ]

# DigraphDegeneracy for a more interesting graph
# (and check the degeneracy ordering)
gap> D := DigraphFromGraph6String("OwCWWLCE?G?@C?A??@??@");;
gap> outs := OutNeighbours(D);;
gap> DigraphDegeneracy(D);
2
gap> order := DigraphDegeneracyOrdering(D);;
gap> ForAll([1 .. Length(order)], i ->
> Length(Intersection(outs[order[i]], order{[i .. Length(order)]}))
> <= DigraphDegeneracy(D));
true

# DigraphGirth with known automorphisms
gap> gr := Digraph([[2, 3, 4, 5], [6, 3], [6, 2], [6], [6], [1]]);;
gap> DigraphGirth(gr);
Expand Down
Loading