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
13 changes: 6 additions & 7 deletions doc/attr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1535,28 +1535,27 @@ gap> DigraphAllChordlessCycles(D);
<Oper Name="FacialWalks" Arg="digraph, list"/>
<Returns>A list of lists of vertices.</Returns>
<Description>
If <A>digraph</A> is an Eulerian digraph and <A>list</A> is a rotation system of <A>digraph</A>,
If <A>digraph</A> is a digraph and <A>list</A> is a rotation system of <A>digraph</A>,
then <C>FacialWalks</C> returns a list of the <E>facial walks</E> in <A>digraph</A>. <P/>

A rotation system defines for each vertex the ordering of the out-neighbours.
A rotation system defines for each vertex of a symmetric digraph the ordering of the neighbours.
For example, the method <Ref Subsect="PlanarEmbedding" Style="Number" /> computes for a
planar digraph <A>D</A> the rotation system of a planar embedding of <A>D</A>.
The facial walks of <A>digraph</A> are closed walks and they are defined by the rotation system <A>list</A>.
They describe the boundaries of the faces of the embedding of <A>digraph</A> given
by the rotation system <A>list</A>.

The operation <C>FacialWalks</C> ignores
multiple edges and loops.<P/>
The operation <C>FacialWalks</C> ignores multiple edges, loops and the direction of the edges.<P/>
Here are some examples for planar embeddings:
<Example><![CDATA[
gap> D1 := CycleDigraph(4);;
gap> planar := PlanarEmbedding(D1);
[ [ 2 ], [ 3 ], [ 4 ], [ 1 ] ]
[ [ 2, 4 ], [ 3, 1 ], [ 4, 2 ], [ 1, 3 ] ]
gap> FacialWalks(D1, planar);
[ [ 1, 2, 3, 4 ] ]
[ [ 1, 2, 3, 4 ], [ 1, 4, 3, 2 ] ]
gap> nonPlanar := [[2, 4], [1, 3], [2, 4], [1, 3]];;
gap> FacialWalks(D1, nonPlanar);
[ [ 1, 2, 3, 4 ] ]
[ [ 1, 2, 3, 4 ], [ 1, 4, 3, 2 ] ]
gap> D2 := CompleteMultipartiteDigraph([2, 2, 2]);;
gap> rotationSystem := PlanarEmbedding(D2);
[ [ 3, 5, 4, 6 ], [ 6, 4, 5, 3 ], [ 6, 2, 5, 1 ], [ 1, 5, 2, 6 ],
Expand Down
12 changes: 7 additions & 5 deletions doc/planar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,12 @@ gap> KuratowskiOuterPlanarSubdigraph(D);
in <Cite Key="BM06"/>.

<Example><![CDATA[
gap> D := Digraph([[3, 5, 10], [8, 9, 10], [1, 4], [3, 6],
gap> D := Digraph([[3, 5, 10], [8, 9, 10], [1, 4], [3, 6],
> [1, 7, 11], [4, 7], [6, 8], [2, 7], [2, 11], [1, 2], [5, 9]]);
<immutable digraph with 11 vertices, 25 edges>
gap> PlanarEmbedding(D);
[ [ 3, 10, 5 ], [ 10, 8, 9 ], [ 4, 1 ], [ 6, 3 ], [ 1, 11, 7 ],
[ 7, 4 ], [ 8, 6 ], [ 7, 2 ], [ 2, 11 ], [ 1, 2 ], [ 9, 5 ] ]
[ 7, 4 ], [ 5, 8, 6 ], [ 7, 2 ], [ 2, 11 ], [ 1, 2 ], [ 9, 5 ] ]
gap> D := Digraph([[2, 4, 7, 9, 10], [1, 3, 4, 6, 9, 10], [6, 10],
> [2, 5, 8, 9], [1, 2, 3, 4, 6, 7, 9, 10], [3, 4, 5, 7, 9, 10],
> [3, 4, 5, 6, 9, 10], [3, 4, 5, 7, 9], [2, 3, 5, 6, 7, 8], [3, 5]]);
Expand All @@ -274,8 +274,8 @@ gap> D := Digraph(IsMutableDigraph, [[3, 5, 10], [8, 9, 10], [1, 4],
> [3, 6], [1, 7, 11], [4, 7], [6, 8], [2, 7], [2, 11], [1, 2], [5, 9]]);
<mutable digraph with 11 vertices, 25 edges>
gap> PlanarEmbedding(D);
[ [ 3, 10, 5 ], [ 10, 8, 9 ], [ 4, 1 ], [ 6, 3 ], [ 1, 11, 7 ],
[ 7, 4 ], [ 8, 6 ], [ 7, 2 ], [ 2, 11 ], [ 1, 2 ], [ 9, 5 ] ]
[ [ 3, 10, 5 ], [ 10, 8, 9 ], [ 4, 1 ], [ 6, 3 ], [ 1, 11, 7 ],
[ 7, 4 ], [ 5, 8, 6 ], [ 7, 2 ], [ 2, 11 ], [ 1, 2 ], [ 9, 5 ] ]
gap> D := Digraph(IsMutableDigraph, [[2, 4, 7, 9, 10],
> [1, 3, 4, 6, 9, 10], [6, 10], [2, 5, 8, 9],
> [1, 2, 3, 4, 6, 7, 9, 10], [3, 4, 5, 7, 9, 10],
Expand Down Expand Up @@ -433,13 +433,15 @@ fail
<Attr Name="DualPlanarGraph" Arg="digraph"/>
<Returns>A digraph or <K>fail</K>.</Returns>
<Description>
If <A>digraph</A> is a planar digraph, then <Ref Attr="DualPlanarGraph"/> returns the the dual graph of <A>digraph</A>.
If <A>digraph</A> is a planar digraph, then <Ref Attr="DualPlanarGraph"/> returns the symmetric dual graph
of <A>digraph</A>.
If <A>digraph</A> is not planar, then <K>fail</K> is returned.<P/>

The dual graph of a planar digraph <A>digraph</A> has a vertex for each face of <A>digraph</A> and an edge for
each pair of faces that are separated by an edge from each other.
Vertex <A>i</A> of the dual graph corresponds to the facial walk at the <A>i</A>-th position calling
<Ref Oper="FacialWalks"/> of <A>digraph</A> with the rotation system returned by <Ref Attr="PlanarEmbedding"/>.
The directions and multiplicities of any edges in digraph are ignored by <Ref Attr="DualPlanarGraph"/>.
<P/>

Note that <Ref Attr="PlanarEmbedding"/>, and therefore
Expand Down
8 changes: 2 additions & 6 deletions gap/attr.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1859,10 +1859,6 @@ InstallMethod(FacialWalks, "for a digraph and a dense list",
function(D, rotationSystem)
local FacialWalk, facialWalks, remEdges, cycle;

if not IsEulerianDigraph(D) then
ErrorNoReturn("the 1st argument (digraph <D>) must be Eulerian");
fi;

if Length(rotationSystem) <> DigraphNrVertices(D)
or not ForAll(rotationSystem, IsList) then
ErrorNoReturn("the 2nd argument (dense list <rotationSystem>) is not a ",
Expand Down Expand Up @@ -1911,8 +1907,8 @@ function(D, rotationSystem)
return cycle;
end;

D := DigraphRemoveLoops(DigraphRemoveAllMultipleEdges(
DigraphMutableCopyIfMutable(D)));
D := DigraphSymmetricClosure(DigraphRemoveLoops(DigraphRemoveAllMultipleEdges(
DigraphMutableCopyIfMutable(D))));

facialWalks := [];
remEdges := ShallowCopy(DigraphEdges(D));
Expand Down
1 change: 1 addition & 0 deletions gap/planar.gi
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ end);

InstallMethod(PlanarEmbedding, "for a digraph", [IsDigraph],
function(D)
D := DigraphSymmetricClosure(DigraphMutableCopyIfMutable(D));
if DIGRAPHS_HasTrivialRotationSystem(D) then;
return OutNeighbors(D);
fi;
Expand Down
11 changes: 6 additions & 5 deletions tst/standard/attr.tst
Original file line number Diff line number Diff line change
Expand Up @@ -1097,8 +1097,6 @@ gap> DigraphAllUndirectedSimpleCircuits(g);
[ 9, 5, 6, 10 ], [ 9, 5, 7, 8, 6, 10 ] ]

# FacialCycles
gap> FacialWalks(ChainDigraph(3), []);
Error, the 1st argument (digraph <D>) must be Eulerian
gap> FacialWalks(CycleDigraph(3), []);
Error, the 2nd argument (dense list <rotationSystem>) is not a rotation system\
for the 1st argument (digraph <D>), expected a list of 3 lists,
Expand All @@ -1109,6 +1107,9 @@ gap> FacialWalks(CycleDigraph(3), [[4], [1], [3]]);
Error, 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>,
gap> g := ChainDigraph(3);;
gap> FacialWalks(g, PlanarEmbedding(g));
[ [ 1, 2, 3, 2 ] ]
gap> g := Digraph([]);;
gap> rotationSy := [];;
gap> FacialWalks(g, rotationSy);
Expand All @@ -1119,12 +1120,12 @@ gap> FacialWalks(g, rotationSy);
[ [ 1, 2, 3, 4, 3, 2 ] ]
gap> g := CycleDigraph(4);;
gap> planar := PlanarEmbedding(g);
[ [ 2 ], [ 3 ], [ 4 ], [ 1 ] ]
[ [ 2, 4 ], [ 3, 1 ], [ 4, 2 ], [ 1, 3 ] ]
gap> FacialWalks(g, planar);
[ [ 1, 2, 3, 4 ] ]
[ [ 1, 2, 3, 4 ], [ 1, 4, 3, 2 ] ]
gap> nonPlanar := [[2, 4], [1, 3], [2, 4], [1, 3]];;
gap> FacialWalks(g, nonPlanar);
[ [ 1, 2, 3, 4 ] ]
[ [ 1, 2, 3, 4 ], [ 1, 4, 3, 2 ] ]
gap> g := CompleteMultipartiteDigraph([2, 2, 2]);;
gap> rotationSystem := PlanarEmbedding(g);
[ [ 3, 5, 4, 6 ], [ 6, 4, 5, 3 ], [ 6, 2, 5, 1 ], [ 1, 5, 2, 6 ],
Expand Down
2 changes: 1 addition & 1 deletion tst/standard/planar.tst
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ gap> D := Digraph([[3, 5, 10], [8, 9, 10], [1, 4], [3, 6], [1, 7, 11], [4, 7],
<immutable digraph with 11 vertices, 25 edges>
gap> PlanarEmbedding(D);
[ [ 3, 10, 5 ], [ 10, 8, 9 ], [ 4, 1 ], [ 6, 3 ], [ 1, 11, 7 ], [ 7, 4 ],
[ 8, 6 ], [ 7, 2 ], [ 2, 11 ], [ 1, 2 ], [ 9, 5 ] ]
[ 5, 8, 6 ], [ 7, 2 ], [ 2, 11 ], [ 1, 2 ], [ 9, 5 ] ]
gap> D := Digraph([[2, 4, 7, 9, 10], [1, 3, 4, 6, 9, 10], [6, 10],
> [2, 5, 8, 9], [1, 2, 3, 4, 6, 7, 9, 10], [3, 4, 5, 7, 9, 10],
> [3, 4, 5, 6, 9, 10], [3, 4, 5, 7, 9], [2, 3, 5, 6, 7, 8], [3, 5]]);
Expand Down
Loading