Skip to content

Commit

Permalink
Add IsModularLatticeDigraph (#629)
Browse files Browse the repository at this point in the history
* Add IsModularLatticeDigraph

* Add IsModularLatticeDigraph

* Add documentation and tests

---------

Co-authored-by: Murray Whyte <[email protected]>
  • Loading branch information
james-d-mitchell and Murray Whyte authored Apr 3, 2024
1 parent f4c601e commit 30ac2d7
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 6 deletions.
34 changes: 34 additions & 0 deletions doc/prop.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,40 @@ false]]></Example>
</ManSection>
<#/GAPDoc>

<#GAPDoc Label="IsModularLatticeDigraph">
<ManSection>
<Prop Name="IsModularLatticeDigraph" Arg="digraph"/>
<Returns><K>true</K> or <K>false</K>.</Returns>
<Description>
<C>IsModularLatticeDigraph</C> returns <K>true</K> if the digraph
<A>digraph</A> is a <E>modular lattice digraph</E>.<P/>

A <E>modular lattice digraph</E> is a <E>lattice digraph</E>
(<Ref Prop="IsLatticeDigraph"/>) which is modular. That is to say,
the <E>lattice digraph</E> representing <M>N5</M> is not
embeddable as a lattice
(see <URL>https://en.wikipedia.org/wiki/Modular_lattice</URL> and
<Ref Prop="IsLatticeEmbedding"/>).

&MUTABLE_RECOMPUTED_PROP;

<Example><![CDATA[
gap> D := ChainDigraph(5);
<immutable chain digraph with 5 vertices>
gap> D := DigraphReflexiveTransitiveClosure(D);
<immutable preorder digraph with 5 vertices, 15 edges>
gap> IsModularLatticeDigraph(D);
true
gap> N5 := Digraph([[2, 3], [4], [4], []]);
<immutable digraph with 4 vertices, 4 edges>
gap> DigraphReflexiveTransitiveClosure(N5);
<immutable preorder digraph with 4 vertices, 9 edges>
gap> IsModularLatticeDigraph(N5);
false
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>

<#GAPDoc Label="IsPreorderDigraph">
<ManSection>
Expand Down
1 change: 1 addition & 0 deletions doc/z-chap5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<#Include Label="DigraphMeetTable">
<#Include Label="IsUpperSemimodularDigraph">
<#Include Label="IsDistributiveLatticeDigraph">
<#Include Label="IsModularLatticeDigraph">
</Section>

<Section><Heading>Regularity</Heading>
Expand Down
1 change: 1 addition & 0 deletions gap/prop.gd
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ DeclareProperty("IsJoinSemilatticeDigraph", IsDigraph);
DeclareProperty("IsMeetSemilatticeDigraph", IsDigraph);
DeclareProperty("IsPermutationDigraph", IsDigraph);
DeclareProperty("IsDistributiveLatticeDigraph", IsDigraph);
DeclareProperty("IsModularLatticeDigraph", IsDigraph);
DeclareSynonymAttr("IsLatticeDigraph",
IsMeetSemilatticeDigraph and IsJoinSemilatticeDigraph);
DeclareSynonymAttr("IsPreorderDigraph",
Expand Down
21 changes: 15 additions & 6 deletions gap/prop.gi
Original file line number Diff line number Diff line change
Expand Up @@ -661,19 +661,28 @@ end);

InstallMethod(IsDistributiveLatticeDigraph, "for a digraph", [IsDigraph],
function(D)
local N5, M3;
local M3;

if not IsLatticeDigraph(D) then
return false;
fi;

N5 := DigraphReflexiveTransitiveClosure(
Digraph([[2, 4], [3], [5], [5], []]));
M3 := DigraphReflexiveTransitiveClosure(
Digraph([[2, 3, 4], [5], [5], [5], []]));

if LatticeDigraphEmbedding(N5, D) <> fail or
LatticeDigraphEmbedding(M3, D) <> fail then
return IsModularLatticeDigraph(D) and
LatticeDigraphEmbedding(M3, D) = fail;
end);

InstallMethod(IsModularLatticeDigraph, "for a digraph", [IsDigraph],
function(D)
local N5;
if not IsLatticeDigraph(D) then
return false;
fi;
return true;

N5 := DigraphReflexiveTransitiveClosure(
Digraph([[2, 4], [3], [5], [5], []]));

return LatticeDigraphEmbedding(N5, D) = fail;
end);
27 changes: 27 additions & 0 deletions tst/standard/prop.tst
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,33 @@ gap> D := DigraphReflexiveTransitiveClosure(D);
gap> IsDistributiveLatticeDigraph(D);
true

# IsModularLatticeDigraph
gap> D := Digraph([[11, 10], [], [2], [2], [3], [4, 3], [6, 5], [7], [7],
> [8], [9, 8]]);
<immutable digraph with 11 vertices, 14 edges>
gap> D := DigraphReflexiveTransitiveClosure(D);
<immutable preorder digraph with 11 vertices, 60 edges>
gap> IsModularLatticeDigraph(D);
true
gap> D := ChainDigraph(10);
<immutable chain digraph with 10 vertices>
gap> D := DigraphReflexiveTransitiveClosure(D);
<immutable preorder digraph with 10 vertices, 55 edges>
gap> IsModularLatticeDigraph(D);
true
gap> D := Digraph([[2, 4], [3, 5], [9], [5, 6], [7], [7, 8], [9], [9], []]);
<immutable digraph with 9 vertices, 12 edges>
gap> D := DigraphReflexiveTransitiveClosure(D);
<immutable preorder digraph with 9 vertices, 34 edges>
gap> IsModularLatticeDigraph(D);
false
gap> M3 := Digraph([[2, 3, 4], [5], [5], [5], []]);
<immutable digraph with 5 vertices, 6 edges>
gap> M3 := DigraphReflexiveTransitiveClosure(M3);
<immutable preorder digraph with 5 vertices, 12 edges>
gap> IsModularLatticeDigraph(M3);
true

# IsPartialOrderDigraph
gap> gr := NullDigraph(5);
<immutable empty digraph with 5 vertices>
Expand Down

0 comments on commit 30ac2d7

Please sign in to comment.