Repository navigation
Add IsDigraphRotationSystem
#954
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1530,6 +1530,34 @@ gap> DigraphAllChordlessCycles(D); | |
| </ManSection> | ||
| <#/GAPDoc> | ||
|
|
||
|
|
||
| <#GAPDoc Label="DigraphIsRotationSystem"> | ||
| <ManSection> | ||
| <Oper Name="IsDigraphRotationSystem" Arg="digraph, list"/> | ||
| <Returns>A boolean.</Returns> | ||
| <Description> | ||
| If <A>digraph</A> is a symmetric digraph and <A>list</A> is a rotation system of <A>digraph</A>, | ||
| then <C>IsDigraphRotationSystem</C> returns <C>true</C> if <A>list</A> is a rotation system for | ||
| <A>digraph</A>, and <C>false</C> otherwise. | ||
| <A>list</A> is a rotation system of <A>digraph</A> if <A>list</A> has an entry for each vertex | ||
| <C>v</C> containing all neighbours of <C>v</C>. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you maybe add a little more detail here, I'm not sure I could identify when this function returns true and when it returns false from what you've written here. |
||
|
|
||
| The operation <C>IsDigraphRotationSystem</C> ignores multiple edges and loops.<P/> | ||
| Here are some examples: | ||
| <Example><![CDATA[ | ||
| gap> D1 := DigraphSymmetricClosure(CycleDigraph(4));; | ||
| gap> planar := PlanarEmbedding(D1);; | ||
| gap> IsDigraphRotationSystem(D1, planar); | ||
| true | ||
| gap> nonPlanar := [[2, 4], [1, 3], [2, 4], [1, 3]];; | ||
| gap> IsDigraphRotationSystem(D1, nonPlanar); | ||
| true | ||
| ]]></Example> | ||
| </Description> | ||
| </ManSection> | ||
| <#/GAPDoc> | ||
|
|
||
|
|
||
| <#GAPDoc Label="FacialWalks"> | ||
| <ManSection> | ||
| <Oper Name="FacialWalks" Arg="digraph, list"/> | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1853,6 +1853,37 @@ InstallMethod(DigraphAllChordlessCycles, "for a digraph", | |||||||||
| [IsDigraph], | ||||||||||
| D -> DigraphAllChordlessCyclesOfMaximalLength(D, INTOBJ_MAX)); | ||||||||||
|
|
||||||||||
| # Checks if a given list is a rotation system for a given digraph | ||||||||||
| InstallMethod(IsDigraphRotationSystem, "for a digraph and a list", | ||||||||||
| [IsDigraph, IsList], | ||||||||||
| function(digraph, rotationSystem) | ||||||||||
|
|
||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| local D, i, v; | ||||||||||
|
|
||||||||||
| if not IsSymmetricDigraph(digraph) then | ||||||||||
| ErrorNoReturn("the argument <D> must be a symmetric digraph,"); | ||||||||||
| fi; | ||||||||||
|
|
||||||||||
| if Length(rotationSystem) <> DigraphNrVertices(digraph) then | ||||||||||
|
Comment on lines
+1865
to
+1867
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| return false; | ||||||||||
| fi; | ||||||||||
|
|
||||||||||
| D := DigraphRemoveLoops(DigraphRemoveAllMultipleEdges( | ||||||||||
| DigraphMutableCopyIfMutable(digraph))); | ||||||||||
|
|
||||||||||
| for i in [1 .. Length(rotationSystem)] do | ||||||||||
| if Length(rotationSystem[i]) <> Length(OutNeighboursOfVertex(D, i)) then | ||||||||||
| return false; | ||||||||||
| fi; | ||||||||||
| for v in rotationSystem[i] do | ||||||||||
| if not IsDigraphEdge(D, i, v) then | ||||||||||
| return false; | ||||||||||
| fi; | ||||||||||
| od; | ||||||||||
| od; | ||||||||||
| return true; | ||||||||||
| end); | ||||||||||
|
|
||||||||||
| # Compute for a given rotation system the facial walks | ||||||||||
| InstallMethod(FacialWalks, "for a digraph and a dense list", | ||||||||||
| [IsDigraph, IsDenseList], | ||||||||||
|
|
@@ -1863,17 +1894,9 @@ function(D, rotationSystem) | |||||||||
| ErrorNoReturn("the argument <D> must be a symmetric digraph,"); | ||||||||||
| fi; | ||||||||||
|
|
||||||||||
| if Length(rotationSystem) <> DigraphNrVertices(D) | ||||||||||
| or not ForAll(rotationSystem, IsList) then | ||||||||||
| ErrorNoReturn("the 2nd argument (dense list <rotationSystem>) is not a ", | ||||||||||
| "rotation system for the 1st argument (digraph <D>), ", | ||||||||||
| "expected a list of ", DigraphNrVertices(D), " lists,"); | ||||||||||
| fi; | ||||||||||
|
|
||||||||||
| if Union(rotationSystem) <> DigraphVertices(D) then | ||||||||||
| ErrorNoReturn("the 2nd argument (dense list <rotationSystem>) is not a ", | ||||||||||
| "rotation system for the 1st argument (digraph <D>), ", | ||||||||||
| "expected its union to be the vertices of <D>,"); | ||||||||||
| if not IsDigraphRotationSystem(D, rotationSystem) then | ||||||||||
| ErrorNoReturn("the 2nd argument (list <rotationSystem>) is not a rotation ", | ||||||||||
| "system for the 1st argument (digraph <D>)"); | ||||||||||
| fi; | ||||||||||
|
|
||||||||||
| # computes a facial cycles starting with the edge 'startEdge' | ||||||||||
|
|
@@ -3639,6 +3662,7 @@ function(digraph) | |||||||||
| fi; | ||||||||||
|
|
||||||||||
| return Minimum(min, Minimum(OutDegrees(EdgeD)), Minimum(InDegrees(EdgeD))); | ||||||||||
|
|
||||||||||
| end); | ||||||||||
|
|
||||||||||
| # The following function is a transliteration from python to GAP of | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reads a little strangely "if ... list is a rotation system, then ... returns true, if list is a rotation system" probably the first "rotation system" should be "list"