Goto Chapter: Top 1 2 3 4 5 6 7 8 9 A Bib Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

7 Homomorphisms
 7.1 Acting on digraphs
 7.2 Isomorphisms, and Canonical labellings
 7.3 Homomorphisms of digraphs

7 Homomorphisms

7.1 Acting on digraphs

7.1-1 OnDigraphs
‣ OnDigraphs( digraph, perm )( operation )
‣ OnDigraphs( digraph, trans )( operation )

Returns: A digraph.

If digraph is a digraph, and the second argument perm is a permutation of the vertices of digraph, then this operation returns a digraph constructed by relabelling the vertices of digraph according to perm. Note that for an automorphism f of a digraph, we have OnDigraphs(digraph, f) = digraph.

If the second argument is a transformation trans of the vertices of digraph, then this operation returns a digraph constructed by transforming the source and range of each edge according to trans, and then removing any multiple edges. If trans is indeed a permutation, then the result coincides with relabelling the vertices of digraph according to trans.

The DigraphVertexLabels (5.1-10) of digraph will not be retained in the returned digraph.

gap> gr := Digraph([[3], [1, 3, 5], [1], [1, 2, 4], 
> [2, 3, 5]]);
<digraph with 5 vertices, 11 edges>
gap> new := OnDigraphs(gr, (1,2));
<digraph with 5 vertices, 11 edges>
gap> OutNeighbours(new);
[ [ 2, 3, 5 ], [ 3 ], [ 2 ], [ 2, 1, 4 ], [ 1, 3, 5 ] ]
gap> gr := Digraph([[2], [], [2]]);
<digraph with 3 vertices, 2 edges>
gap> t := Transformation([1, 2, 1]);;
gap> new := OnDigraphs(gr, t);
<digraph with 3 vertices, 1 edge>
gap> OutNeighbours(new);
[ [ 2 ], [  ], [  ] ]
gap> ForAll(DigraphEdges(gr),
>  e -> IsDigraphEdge(new, [e[1] ^ t, e[2] ^ t]));
true

7.1-2 OnMultiDigraphs
‣ OnMultiDigraphs( digraph, pair )( operation )
‣ OnMultiDigraphs( digraph, perm1, perm2 )( operation )

Returns: A digraph.

If digraph is a digraph, and pair is a pair consisting of a permutation of the vertices and a permutation of the edges of digraph, then this operation returns a digraph constructed by relabelling the vertices and edges of digraph according to perm[1] and perm[2], respectively.

In its second form, OnMultiDigraphs returns a digraph with vertices and edges permuted by perm1 and perm2, respectively.

Note that OnDigraphs(digraph, perm)=OnMultiDigraphs(digraph, [perm, ()]) where perm is a permutation of the vertices of digraph. If you are only interested in the action of a permutation on the vertices of a digraph, then you can use OnDigraphs instead of OnMultiDigraphs.

gap> gr1 := Digraph([[3, 6, 3], [], [3], [9, 10], [9], 
> [],  [], [10, 4, 10], [], []]);
<multidigraph with 10 vertices, 10 edges>
gap> p := DigraphCanonicalLabelling(gr1);
[ (1,9,5,3,10,6,4,7), (1,7,9,5,2,8,4,10,3,6) ]
gap> gr2 := OnMultiDigraphs(gr1, p);
<multidigraph with 10 vertices, 10 edges>
gap> OutNeighbours(gr2);
[ [  ], [  ], [ 5 ], [  ], [  ], [  ], [ 5, 6 ], [ 6, 7, 6 ], 
  [ 10, 4, 10 ], [ 10 ] ]

7.2 Isomorphisms, and Canonical labellings

7.2-1 AutomorphismGroup
‣ AutomorphismGroup( digraph )( attribute )
‣ AutomorphismGroup( digraph, colors )( operation )

Returns: A permutation group.

If digraph is a digraph without multiple edges, then this function returns the automorphism group of digraph, as a group of permutations on the vertices of digraph.

If the colors argument is specified, then the group will consist of only those automorphisms which respect the given colouring. The colouring colors can be in one of two forms:

The automorphism group is found using bliss by Tommi Junttila and Petteri Kaski.

gap> johnson := Digraph([[2, 3, 4, 5], [1, 3, 4, 6], 
> [1, 2, 5, 6], [1, 2, 5, 6], [1, 3, 4, 6], 
> [2, 3, 4, 5]]);
<digraph with 6 vertices, 24 edges>
gap> AutomorphismGroup(johnson);
Group([ (3,4), (2,3)(4,5), (1,2)(5,6) ])
gap> Size(last);
48
gap> cycle := CycleDigraph(9);
<digraph with 9 vertices, 9 edges>
gap> a := AutomorphismGroup(cycle);;
gap> StructureDescription(a);
"C9"
gap> a := AutomorphismGroup(cycle, [1, 2, 3, 1, 2, 3, 1, 2, 3]);;
gap> StructureDescription(a);
"C3"
gap> a := AutomorphismGroup(cycle, [[1, 4, 7], [2, 5, 8], [3, 6, 9]]);;
gap> StructureDescription(a);
"C3"

7.2-2 AutomorphismGroup
‣ AutomorphismGroup( digraph )( attribute )

Returns: A direct product of permutation groups.

If digraph is a multidigraph, then this function returns the automorphism group of digraph, as a group of permutations on the vertices and edges of digraph.

For convenience, the returned group is the direct product of the group of automorphisms of the vertices of digraph with the stabiliser of the vertices in the automorphism group of the edges. These two groups can be accessed using the Projection (Reference: Projection) with second argument 1 and 2, respectively.

The permutations in the automorphism group of the edges act on the indices of the edges of digraph.

The automorphism group is found using bliss by Tommi Junttila and Petteri Kaski.

gap> gr := DigraphEdgeUnion(CycleDigraph(3), CycleDigraph(3));          
<multidigraph with 3 vertices, 6 edges>
gap> G := AutomorphismGroup(gr);
Group([ (1,2,3), (8,9), (6,7), (4,5) ])
gap> Range(Projection(G, 1));
Group([ (1,2,3) ])
gap> Range(Projection(G, 2));
Group([ (5,6), (3,4), (1,2) ])
gap> Size(G);
24

7.2-3 DigraphGroup
‣ DigraphGroup( digraph )( attribute )

Returns: A permutation group.

If digraph was created knowing a subgroup of its automorphism group, then this group is stored in the attribute DigraphGroup. If digraph is not created knowing a subgroup of it automorphism group, then DigraphGroup returns the entire automorphism group of digraph.

Note that certain other constructor operations such as CayleyDigraph (3.5-6), BipartiteDoubleDigraph (3.3-30), and DoubleDigraph (3.3-29), may not require a group as one of the arguments, but use the standard constructor method using a group, and hence set the DigraphGroup attribute for the resulting digraph.

gap> n := 4;;
gap> adj := function(x, y)
>      return (((x-y) mod n) = 1) or (((x-y) mod n) = n-1);
>    end;;
gap> group := CyclicGroup(IsPermGroup, n);
Group([ (1,2,3,4) ])
gap> digraph := Digraph(group, [1..n], \^, adj);
<digraph with 4 vertices, 8 edges>
gap> HasDigraphGroup(digraph);
true
gap> DigraphGroup(digraph);
Group([ (1,2,3,4) ])
gap> AutomorphismGroup(digraph);
Group([ (2,4), (1,2,3,4) ])
gap> ddigraph := DoubleDigraph(digraph);
<digraph with 8 vertices, 32 edges>
gap> HasDigraphGroup(ddigraph);
true
gap> DigraphGroup(ddigraph);
Group([ (1,2,3,4)(5,6,7,8), (1,5)(2,6)(3,7)(4,8) ])
gap> AutomorphismGroup(ddigraph);
Group([ (6,8), (5,7), (4,6), (3,5), (2,4), (1,2,3,4)(5,6)(7,8) ])
gap> digraph := Digraph([[2, 3], [], []]);
<digraph with 3 vertices, 2 edges>
gap> HasDigraphGroup(digraph);
false
gap> HasAutomorphismGroup(digraph);
false
gap> DigraphGroup(digraph);
Group([ (2,3) ])
gap> HasAutomorphismGroup(digraph);
true
gap> group := DihedralGroup(8);
<pc group of size 8 with 3 generators>
gap> digraph := CayleyDigraph(group);
<digraph with 8 vertices, 24 edges>
gap> HasDigraphGroup(digraph);
true
gap> DigraphGroup(digraph);
Group([ (1,2)(3,8)(4,6)(5,7), (1,3,4,7)(2,5,6,8), (1,4)(2,6)(3,7)
(5,8) ])

7.2-4 DigraphSchreierVector
‣ DigraphSchreierVector( digraph )( attribute )

Returns: A list of integers.

DigraphSchreierVector returns the so-called Schreier vector of the action of the DigraphGroup (7.2-3) on the set of vertices of digraph. The Schreier vector is a list sch of integers with with length DigraphNrVertices(digraph) where:

sch[i] < 0:

implies that i is an orbit representative and DigraphOrbitReps(digraph)[-sch[i]] = i.

sch[i] > 0:

implies that i / gens[sch[i]] is one step closer to the root (or representative) of the tree, where gens is the generators of DigraphGroup(digraph).

gap> digraph := CayleyDigraph(AlternatingGroup(4));
<digraph with 12 vertices, 24 edges>
gap> sch := DigraphSchreierVector(digraph);
[ -1, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 1 ]
gap> DigraphOrbitReps(digraph);
[ 1 ]
gap> gens := GeneratorsOfGroup(DigraphGroup(digraph)); 
[ (1,5,7)(2,4,8)(3,6,9)(10,11,12), (1,2,3)(4,7,10)(5,9,11)(6,8,12) ]
gap> 10 / gens[sch[10]];
7
gap> 7 / gens[sch[7]];
5
gap> 5 / gens[sch[5]];
1

7.2-5 DigraphOrbitReps
‣ DigraphOrbitReps( digraph )( attribute )

Returns: A list of integers.

DigraphOrbitReps returns a list of orbit representatives of the action of the DigraphGroup (7.2-3) on the set of vertices of digraph.

gap> digraph := CayleyDigraph(AlternatingGroup(4));
<digraph with 12 vertices, 24 edges>
gap> DigraphOrbitReps(digraph);
[ 1 ]
gap> digraph := Digraph([[3, 8], [], [6, 8], [7], [2, 9], [10], [7], [1], 
>                        [2, 7, 8], [8]]);
<digraph with 10 vertices, 14 edges>
gap> DigraphOrbitReps(digraph); 
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]

7.2-6 DigraphStabilizer
‣ DigraphStabilizer( digraph, v )( operation )

Returns: A permutation group.

DigraphStabilizer returns the stabilizer of the vertex v under of the action of the DigraphGroup (7.2-3) on the set of vertices of digraph.

gap> digraph := Digraph([[2, 3, 5], [1, 4, 6], [4, 2, 7], [3, 1, 8], [6, 8, 1],
>                        [5, 7, 2], [8, 5, 3], [7, 6, 4]]);
<digraph with 8 vertices, 24 edges>
gap> DigraphStabilizer(digraph, 8);
Group(())
gap> DigraphStabilizer(digraph, 2);
Group(())

7.2-7 DigraphOrbits
‣ DigraphOrbits( digraph )( attribute )

Returns: A list of lists of integers.

DigraphOrbits returns the orbits of the action of the DigraphGroup (7.2-3) on the set of vertices of digraph.

gap> G := Group((1,2,3), (1,2), (4,5,6), (7,8,9), (7,8));;
gap> gr := EdgeOrbitsDigraph(G, [1, 2]);
<digraph with 9 vertices, 6 edges>
gap> DigraphOrbits(gr);
[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ]

7.2-8 RepresentativeOutNeighbours
‣ RepresentativeOutNeighbours( digraph )( attribute )

Returns: An immutable list of immutable lists.

This function returns the list out of out-neighbours of each representative of the orbits of the action of DigraphGroup (7.2-3) on the vertex set of the digraph digraph.

More specifically, if reps is the list of orbit representatives, then a vertex j appears in out[i] each time there exists an edge with source reps[i] and range j in digraph.

If DigraphGroup (7.2-3) is trivial, then OutNeighbours (5.2-5) is returned.

gap> digraph := Digraph([[1, 2, 3, 4, 5], [3, 5], [2], [1, 2, 3, 5], 
>                        [1, 2, 3, 4]]);
<digraph with 5 vertices, 16 edges>
gap> DigraphGroup(digraph);
Group(())
gap> RepresentativeOutNeighbours(digraph);
[ [ 1, 2, 3, 4, 5 ], [ 3, 5 ], [ 2 ], [ 1, 2, 3, 5 ], [ 1, 2, 3, 4 ] ]
gap> digraph := Digraph([[2, 3, 5], [1, 4, 6], [4, 2, 7], [3, 1, 8], [6, 8, 1],
>                        [5, 7, 2], [8, 5, 3], [7, 6, 4]]);
<digraph with 8 vertices, 24 edges>
gap> DigraphGroup(digraph);
Group([ (1,2)(3,4)(5,6)(7,8), (1,3,2,4)(5,7,6,8), (1,5)(2,6)(3,8)
(4,7) ])
gap> RepresentativeOutNeighbours(digraph);
[ [ 2, 3, 5 ] ]

7.2-9 DigraphCanonicalLabelling
‣ DigraphCanonicalLabelling( digraph )( attribute )
‣ DigraphCanonicalLabelling( digraph, colors )( operation )

Returns: A permutation.

A function \(\rho\) from a digraph to a digraph is a canonical representative map if the following two conditions hold:

A canonical labelling of a digraph digraph (under \(\rho\)) is an isomorphism of digraph onto its canonical representative \(\rho(\)digraph\()\) given as a permutation of the vertices (and the edges in case digraph has multiple edges).

If the colors argument is specified, then the canonical labelling will respect the given colouring. The colouring colors can be in one of two forms:

The canonical labelling is found using bliss by Tommi Junttila and Petteri Kaski.

gap> G := Digraph(10, [1, 1, 3, 4, 4, 5, 8, 8], [6, 3, 3, 9, 10, 9, 4, 10]);
<digraph with 10 vertices, 8 edges>
gap> DigraphCanonicalLabelling(G);
(1,8,5,3,10,6,4,9,7)
gap> DigraphCanonicalLabelling(G, [[1 .. 5], [6 .. 10]]);
(1,3,5,2)(6,7)(8,9,10)
gap> DigraphCanonicalLabelling(G, [1, 1, 1, 1, 2, 3, 1, 3, 2, 1]);
(1,4,5,7)(3,6,9,8,10)
gap> p := (1,2,7,5)(3,9)(6,10,8);;
gap> H := Digraph(
>  10,
>  OnTuples([1, 1, 3, 4, 4, 5, 8, 8], p),
>  OnTuples([6, 3, 3, 9, 10, 9, 4, 10], p)
> );
<digraph with 10 vertices, 8 edges>
gap> G = H;
false
gap> OnDigraphs(G, DigraphCanonicalLabelling(G)) =
>    OnDigraphs(H, DigraphCanonicalLabelling(H));
true
gap> gr := Digraph([[7, 2, 8, 2], [7, 6], [9], [], 
> [], [], [], [2], [6], [4]]);
<multidigraph with 10 vertices, 10 edges>
gap> DigraphCanonicalLabelling(gr);
[ (1,9,7,5)(2,10,3), (1,7,3,8,2,6,10,4,5,9) ]

7.2-10 IsIsomorphicDigraph
‣ IsIsomorphicDigraph( digraph1, digraph2 )( operation )

Returns: true or false.

This operation returns true if the digraph digraph1 is isomorphic to the digraph digraph2.

This operation uses the canonical labelling of the digraphs found with bliss by Tommi Junttila and Petteri Kaski.

gap> digraph1 := CycleDigraph(4);
<digraph with 4 vertices, 4 edges>
gap> digraph2 := CycleDigraph(5);
<digraph with 5 vertices, 5 edges>
gap> IsIsomorphicDigraph(digraph1, digraph2);
false
gap> digraph2 := DigraphReverse(digraph1);
<digraph with 4 vertices, 4 edges>
gap> IsIsomorphicDigraph(digraph1, digraph2);
true
gap> digraph1 := Digraph([[], [9, 8, 9], [7], 
> [], [], [5, 3], [8], [6], [4, 5], []]);
<multidigraph with 10 vertices, 10 edges>
gap> digraph2 := Digraph([[], [4], [], [7], [], 
> [4, 5, 10, 5], [], [9], [4, 2], [2]]);
<multidigraph with 10 vertices, 10 edges>
gap> IsIsomorphicDigraph(digraph1, digraph2);
false
gap> digraph1 := Digraph([[3], [], []]);
<digraph with 3 vertices, 1 edge>
gap> digraph2 := Digraph([[], [], [2]]);
<digraph with 3 vertices, 1 edge>
gap> IsIsomorphicDigraph(digraph1, digraph2);
true

7.2-11 IsomorphismDigraphs
‣ IsomorphismDigraphs( digraph1, digraph2 )( operation )

Returns: A permutation or fail.

If digraph1 and digraph2 are isomorphic digraphs, then this operation returns an isomorphism from digraph1 to digraphs2. More precisely,

for multidigraphs

this operation returns a pair of permutations P such that OnMultiDigraphs(digraph1, P) = digraph2. The first permutation is defined on the vertices of digraph1 and the second on the edges.

for digraphs without multiple edges

this operation returns a permutation p such that OnDigraphs(digraph1, p) = digraph2.

If digraph1 and digraph2 are not isomorphic, then fail is returned.

This operation uses the canonical labelling of the digraphs found with bliss by Tommi Junttila and Petteri Kaski.

gap> digraph1 := CycleDigraph(4);          
<digraph with 4 vertices, 4 edges>
gap> digraph2 := CycleDigraph(5);
<digraph with 5 vertices, 5 edges>
gap> IsomorphismDigraphs(digraph1, digraph2);
fail
gap> gr1 := CompleteBipartiteDigraph(10, 5);
<digraph with 15 vertices, 100 edges>
gap> gr2 := CompleteBipartiteDigraph(5, 10);
<digraph with 15 vertices, 100 edges>
gap> p := IsomorphismDigraphs(gr1, gr2);
(1,6,11)(2,7,12)(3,8,13)(4,9,14)(5,10,15)
gap> OnDigraphs(gr1, p) = gr2;
true
gap> gr1 := Digraph([[3, 6, 3], [], [3], [9, 10], [9], [], 
> [], [10, 4, 10], [], []]);
<multidigraph with 10 vertices, 10 edges>
gap> gr2 := Digraph([[], [], [5], [], [], [], 
> [5, 6], [6, 7, 6], [10, 4, 10], [10]]);
<multidigraph with 10 vertices, 10 edges>
gap> IsomorphismDigraphs(gr1, gr2);
[ (1,9,5,3,10,6,4,7,2), (1,7)(2,8,4,10,6,3,9,5) ]
gap> digraph1 := Digraph([[], [], [], [], [], [], 
> [10, 10], [], [], []]);
<multidigraph with 10 vertices, 2 edges>
gap> digraph2 := Digraph([[], [3, 3], [], [], [], [],
> [], [], [], []]);
<multidigraph with 10 vertices, 2 edges>
gap> IsomorphismDigraphs(digraph1, digraph2);
[ (2,4,6,8,9,10,3,5,7), () ]

7.3 Homomorphisms of digraphs

The following methods exist to find homomorphisms between digraphs. If an argument to one of these methods is a digraph with multiple edges, then the multiplicity of edges will be ignored in order to perform the calculation; the digraph will be treated as if it has no multiple edges.

7.3-1 HomomorphismDigraphsFinder
‣ HomomorphismDigraphsFinder( gr1, gr2, hook, user_param, limit, hint, injective, image, map )( function )

Returns: The argument user_param.

This function finds homomorphisms from the graph gr1 to the graph gr2 subject to the conditions imposed by the other arguments as described below.

If f and g are homomorphisms found by HomomorphismGraphsFinder, then f cannot be obtained from g by right multiplying by an automorphism of gr2.

hook

This argument should be a function or fail.

If hook is a function, then it should have two arguments user_param (see below) and a transformation t. The function hook(user_param, t) is called every time a new homomorphism t is found by HomomorphismGraphsFinder.

If hook is fail, then a default function is used which simply adds every new homomorphism found by HomomorphismGraphsFinder to user_param, which must be a list in this case.

user_param

If hook is a function, then user_param can be any GAP object. The object user_param is used as the first argument for the function hook. For example, user_param might be a transformation semigroup, and hook(user_param, t) might set user_param to be the closure of user_param and t.

If the value of hook is fail, then the value of user_param must be a list.

limit

This argument should be a positive integer or infinity. HomomorphismGraphsFinder will return after it has found limit homomorphisms or the search is complete.

hint

This argument should be a positive integer or fail.

If hint is a positive integer, then only homorphisms of rank hint are found.

If hint is fail, then no restriction is put on the rank of homomorphisms found.

injective

This argument should be true or false. If it is true, then only injective homomorphisms are found, and if it is false there are no restrictions imposed by this argument.

image

This argument should be a subset of the vertices of the graph gr2. HomomorphismGraphsFinder only finds homomorphisms from gr1 to the subgraph of gr2 induced by the vertices image.

map

This argument should be a partial map from gr1 to gr2, that is, a (not necessarily dense) list of vertices of the graph gr2 of length no greater than the number vertices in the graph gr1. HomomorphismGraphsFinder only finds homomorphisms extending map (if any).

gap> gr := ChainDigraph(10);
<digraph with 10 vertices, 9 edges>
gap> gr := DigraphSymmetricClosure(gr);
<digraph with 10 vertices, 18 edges>
gap> HomomorphismDigraphsFinder(gr, gr, fail, [], infinity, 2, false,
> [3, 4], [], fail, fail);
[ Transformation( [ 3, 4, 3, 4, 3, 4, 3, 4, 3, 4 ] ), 
  Transformation( [ 4, 3, 4, 3, 4, 3, 4, 3, 4, 3 ] ) ]
gap> gr2 := CompleteDigraph(6);;
gap> HomomorphismDigraphsFinder(gr, gr2, fail, [], 1, fail, false,
> [1 .. 6], [1, 2, 1], fail, fail);
[ Transformation( [ 1, 2, 1, 3, 4, 5, 6, 1, 2, 1 ] ) ]
gap> func := function(user_param, t)
> Add(user_param, t * user_param[1]);
> end;;
gap> HomomorphismDigraphsFinder(gr, gr2, func, [Transformation([2, 2])],
> 3, fail, false, [1 .. 6], [1, 2, 1], fail, fail);
[ Transformation( [ 2, 2 ] ), 
  Transformation( [ 2, 2, 2, 3, 4, 5, 6, 2, 2, 2 ] ), 
  Transformation( [ 2, 2, 2, 3, 4, 5, 6, 2, 2, 3 ] ), 
  Transformation( [ 2, 2, 2, 3, 4, 5, 6, 2, 2, 4 ] ) ]

7.3-2 DigraphHomomorphism
‣ DigraphHomomorphism( digraph1, digraph2 )( operation )

Returns: A transformation, or fail.

A homomorphism from digraph1 to digraph2 is a mapping from the vertex set of digraph1 to a subset of the vertices of digraph2, such that every pair of vertices [i,j] which has an edge i->j is mapped to a pair of vertices [a,b] which has an edge a->b. Note that non adjacent vertices can still be mapped onto adjacent ones.

DigraphHomomorphism returns a single homomorphism between digraph1 and digraph2 if it exists, otherwise it returns fail.

gap> gr1 := ChainDigraph(3);;
gap> gr2 := Digraph([[3, 5], [2], [3, 1], [], [4]]);
<digraph with 5 vertices, 6 edges>
gap> DigraphHomomorphism(gr1, gr1);
IdentityTransformation
gap> DigraphHomomorphism(gr1, gr2);
Transformation( [ 1, 3, 1 ] )

7.3-3 HomomorphismsDigraphs
‣ HomomorphismsDigraphs( digraph1, digraph2 )( operation )
‣ HomomorphismsDigraphsRepresentatives( digraph1, digraph2 )( operation )

Returns: A list of transformations.

HomomorphismsDigraphsRepresentatives finds every DigraphHomomorphism (7.3-2) between digraph1 and digraph2, up to right multiplication by an element of the AutomorphismGroup (7.2-1) of digraph2. In other words, every homomorphism f between digraph1 and digraph2 can be written as the composition f = g * x, where g is one of the HomomorphismsDigraphsRepresentatives and x is an automorphism of digraph2.

HomomorphismsDigraphs returns all homomorphisms between digraph1 and digraph2.

gap> gr1 := ChainDigraph(3);;
gap> gr2 := Digraph([[3, 5], [2], [3, 1], [], [4]]);
<digraph with 5 vertices, 6 edges>
gap> HomomorphismsDigraphs(gr1, gr2);
[ Transformation( [ 1, 3, 1 ] ), Transformation( [ 1, 3, 3 ] ), 
  Transformation( [ 1, 5, 4, 4, 5 ] ), Transformation( [ 2, 2, 2 ] ), 
  Transformation( [ 3, 1, 3 ] ), Transformation( [ 3, 1, 5, 4, 5 ] ), 
  Transformation( [ 3, 3, 1 ] ), Transformation( [ 3, 3, 3 ] ) ]
gap> HomomorphismsDigraphsRepresentatives(gr1, CompleteDigraph(3));
[ IdentityTransformation, Transformation( [ 1, 2, 1 ] ) ]

7.3-4 DigraphMonomorphism
‣ DigraphMonomorphism( digraph1, digraph2 )( operation )

Returns: A transformation, or fail.

DigraphMonomorphism returns a single injective DigraphHomomorphism (7.3-2) between digraph1 and digraph2 if one exists, otherwise it returns fail.

gap> gr1 := ChainDigraph(3);;
gap> gr2 := Digraph([[3, 5], [2], [3, 1], [], [4]]);
<digraph with 5 vertices, 6 edges>
gap> DigraphMonomorphism(gr1, gr1);
IdentityTransformation
gap> DigraphMonomorphism(gr1, gr2);
Transformation( [ 1, 5, 4, 4, 5 ] )

7.3-5 MonomorphismsDigraphs
‣ MonomorphismsDigraphs( digraph1, digraph2 )( operation )
‣ MonomorphismsDigraphsRepresentatives( digraph1, digraph2 )( operation )

Returns: A list of transformations.

These operations behave the same as HomomorphismsDigraphs (7.3-3) and HomomorphismsDigraphsRepresentatives (7.3-3), expect they only return injective homomorphisms.

gap> gr1 := ChainDigraph(3);;
gap> gr2 := Digraph([[3, 5], [2], [3, 1], [], [4]]);
<digraph with 5 vertices, 6 edges>
gap> MonomorphismsDigraphs(gr1, gr2);
[ Transformation( [ 1, 5, 4, 4, 5 ] ), 
  Transformation( [ 3, 1, 5, 4, 5 ] ) ]
gap> MonomorphismsDigraphsRepresentatives(gr1, CompleteDigraph(3));
[ IdentityTransformation ]

7.3-6 DigraphEpimorphism
‣ DigraphEpimorphism( digraph1, digraph2 )( operation )

Returns: A transformation, or fail.

DigraphEpimorphism returns a single surjective DigraphHomomorphism (7.3-2) between digraph1 and digraph2 if one exists, otherwise it returns fail.

gap> gr1 := DigraphReverse(ChainDigraph(4));
<digraph with 4 vertices, 3 edges>
gap> gr2 := DigraphRemoveEdge(CompleteDigraph(3), [1, 2]);
<digraph with 3 vertices, 5 edges>
gap> DigraphEpimorphism(gr2, gr1);
fail
gap> DigraphEpimorphism(gr1, gr2);
Transformation( [ 1, 2, 3, 1 ] )

7.3-7 EpimorphismsDigraphs
‣ EpimorphismsDigraphs( digraph1, digraph2 )( operation )
‣ EpimorphismsDigraphsRepresentatives( digraph1, digraph2 )( operation )

Returns: A list of transformations.

These operations behave the same as HomomorphismsDigraphs (7.3-3) and HomomorphismsDigraphsRepresentatives (7.3-3), expect they only return surjective homomorphisms.

gap> gr1 := DigraphReverse(ChainDigraph(4));
<digraph with 4 vertices, 3 edges>
gap> gr2 := DigraphSymmetricClosure(CycleDigraph(3));
<digraph with 3 vertices, 6 edges>
gap> EpimorphismsDigraphsRepresentatives(gr1, gr2);
[ Transformation( [ 1, 2, 3, 1 ] ), Transformation( [ 1, 2, 3, 2 ] ), 
  Transformation( [ 1, 2, 1, 3 ] ) ]
gap> EpimorphismsDigraphs(gr1, gr2);
[ Transformation( [ 1, 2, 1, 3 ] ), Transformation( [ 1, 2, 3, 1 ] ), 
  Transformation( [ 1, 2, 3, 2 ] ), Transformation( [ 1, 3, 1, 2 ] ), 
  Transformation( [ 1, 3, 2, 1 ] ), Transformation( [ 1, 3, 2, 3 ] ), 
  Transformation( [ 2, 1, 2, 3 ] ), Transformation( [ 2, 1, 3, 1 ] ), 
  Transformation( [ 2, 1, 3, 2 ] ), Transformation( [ 2, 3, 1, 2 ] ), 
  Transformation( [ 2, 3, 1, 3 ] ), Transformation( [ 2, 3, 2, 1 ] ), 
  Transformation( [ 3, 1, 2, 1 ] ), Transformation( [ 3, 1, 2, 3 ] ), 
  Transformation( [ 3, 1, 3, 2 ] ), Transformation( [ 3, 2, 1, 2 ] ), 
  Transformation( [ 3, 2, 1, 3 ] ), Transformation( [ 3, 2, 3, 1 ] ) ]

7.3-8 GeneratorsOfEndomorphismMonoid
‣ GeneratorsOfEndomorphismMonoid( digraph[, colors][, limit] )( function )
‣ GeneratorsOfEndomorphismMonoidAttr( digraph )( attribute )

Returns: A list of transformations.

An endomorphism of digraph is a homomorphism DigraphHomomorphism (7.3-2) from digraph back to itself. GeneratorsOfEndomorphismMonoid, called with a single argument, returns a generating set for the monoid of all endomorphisms of digraph.

If the colors argument is specified, then it will return a generating set for the monoid of endomorphisms which respect the given colouring. The colouring colors can be in one of two forms:

If the limit argument is specified, then it will return only the first limit homomorphisms, where limit must be a positive integer or infinity.

gap> gr := Digraph(List([1 .. 3], x -> [1 .. 3]));;
gap> GeneratorsOfEndomorphismMonoid(gr);
[ Transformation( [ 1, 3, 2 ] ), Transformation( [ 2, 1 ] ), 
  IdentityTransformation, Transformation( [ 1, 2, 1 ] ), 
  Transformation( [ 1, 2, 2 ] ), Transformation( [ 1, 1, 2 ] ), 
  Transformation( [ 1, 1, 1 ] ) ]
gap> GeneratorsOfEndomorphismMonoid(gr, 3);
[ Transformation( [ 1, 3, 2 ] ), Transformation( [ 2, 1 ] ), 
  IdentityTransformation ]
gap> gr := CompleteDigraph(3);;
gap> GeneratorsOfEndomorphismMonoid(gr);
[ Transformation( [ 1, 3, 2 ] ), Transformation( [ 2, 1 ] ), 
  IdentityTransformation ]
gap> GeneratorsOfEndomorphismMonoid(gr, [1, 2, 2]);
[ Transformation( [ 1, 3, 2 ] ), IdentityTransformation ]
gap> GeneratorsOfEndomorphismMonoid(gr, [[1], [2, 3]]);
[ Transformation( [ 1, 3, 2 ] ), IdentityTransformation ]

7.3-9 DigraphColoring
‣ DigraphColoring( digraph, n )( operation )
‣ DigraphColouring( digraph, n )( operation )
‣ DigraphColoring( digraph )( operation )

Returns: A transformation, or fail.

A digraph coloring is a labeling of the vertices (using precisely n colors) in such a way that two adjacent vertices can not have the same label. Alternatively, it can be defined to be a DigraphEpimorphism (7.3-6) from digraph onto a complete digraph with n vertices.

DigraphColoring returns such an epimorphism if one exists, else it returns fail.

Note that a digraph has a 2-coloring if and only if it is bipartite, see IsBipartiteDigraph (6.1-3).

If the third form is used, a greedy algorithm is used to obtain a colouring, which possibly is not minimal.

gap> DigraphColoring(CompleteDigraph(5), 4);
fail
gap> DigraphColoring(ChainDigraph(10), 1);
fail
gap> gr := ChainDigraph(10);;
gap> t := DigraphColoring(gr, 2);
Transformation( [ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 ] )
gap> ForAll(DigraphEdges(gr), e -> e[1] ^ t <> e[2] ^ t);
true
gap> DigraphColoring(gr);
Transformation( [ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 ] )

7.3-10 DigraphEmbedding
‣ DigraphEmbedding( digraph1, digraph2 )( operation )

Returns: A transformation, or fail.

An embedding of a digraph digraph1 into another digraph digraph2 is a DigraphMonomorphism (7.3-4) from digraph1 to digraph2 which has the additional property that a pair of vertices [i,j] which have no edge i->j in digraph1 are mapped to a pair of vertices [a,b] which have no edge a->b in digraph2.

In other words, an embedding t is an isomorphism from digraph1 to the InducedSubdigraph (3.3-2) of digraph2 on the image of t.

DigraphEmbedding returns a single embedding if one exists, otherwise it returns fail.

gap> gr := ChainDigraph(3);
<digraph with 3 vertices, 2 edges>
gap> DigraphEmbedding(gr, CompleteDigraph(4));
fail
gap> DigraphEmbedding(gr, Digraph([[3], [1, 4], [1], [3]]));
Transformation( [ 2, 4, 3, 4 ] )
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 A Bib Ind

generated by GAPDoc2HTML