  
  [1m[4m[31m4. Graphs of Groups and Groupoids[0m
  
  This package was originally designed to implement [22m[36mgraphs of groups[0m, a notion
  introduced  by  Serre in [S80]. It was only when this was extended to [22m[36mgraphs
  of  groupoids[0m  that  the  functions for groupoids, described in the previous
  chapters,  were  required.  The  methods  described here are based on Philip
  Higgins'  paper  [H76].  For further details see Chapter 2 of [M01]. Since a
  graph  of  groups involves a directed graph, with a group associated to each
  vertex  and  arc,  we  first  define  digraphs  with  edges  weighted by the
  generators of a free group.
  
  
  [1m[4m[31m4.1 Digraphs[0m
  
  [1m[4m[31m4.1-1 FpWeightedDigraph[0m
  
  [1m[34m> FpWeightedDigraph( [0m[22m[34mverts, arcs[0m[1m[34m ) ________________________________[0mattribute
  [1m[34m> IsFpWeightedDigraph( [0m[22m[34mdig[0m[1m[34m ) ______________________________________[0mattribute
  [1m[34m> InvolutoryArcs( [0m[22m[34mdig[0m[1m[34m ) ___________________________________________[0mattribute
  
  A  [22m[36mweighted  digraph[0m  is  a  record with two components: [22m[36mvertices[0m, which are
  usually  taken to be positive integers (to distinguish them from the objects
  in   a  groupoid);  and  [22m[36marcs[0m,  which  take  the  form  of  3-element  lists
  [22m[32m[weight,tail,head][0m.  The  [22m[36mtail[0m and [22m[36mhead[0m are the two vertices of the arc. The
  [22m[36mweight[0m  is  taken  to  be an element of a finitely presented group, so as to
  produce digraphs of type [22m[32mIsFpWeightedDigraph[0m.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> V1 := [ 5, 6 ];;[0m
    [22m[35mgap> f1 := FreeGroup( "y" );;[0m
    [22m[35mgap> y := f1.1;;[0m
    [22m[35mgap> A1 := [ [ y, 5, 6 ], [ y^-1, 6, 5 ] ];[0m
    [22m[35mgap> D1 := FpWeightedDigraph( V1, A1 );[0m
    [22m[35mweighted digraph with vertices: [ 5, 6 ][0m
    [22m[35mand arcs: [ [ y, 5, 6 ], [ y^-1, 6, 5 ] ][0m
    [22m[35mgap> inv1 := InvolutoryArcs( D1 );[0m
    [22m[35m[ 2, 1 ][0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  The  example  illustrates  the  fact  that  we require arcs to be defined in
  involutory pairs, as though they were inverse elements in a groupoid. We may
  in  future  decide  just to give [22m[32m[y,5,6][0m as the data and get the function to
  construct  the  reverse edge. The attribute [22m[32mInvolutoryArcs[0m returns a list of
  the positions of each inverse arc in the list of arcs. In the second example
  the graph is a complete digraph on three vertices.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> f3 := FreeGroup( 3, "z" );;[0m
    [22m[35mgap> z1 := f3.1;;  z2 := f3.2;;  z3 := f3.3;;[0m
    [22m[35mgap> V3 := [ 7, 8, 9 ];;[0m
    [22m[35mgap> A3 := [[z1,7,8],[z2,8,9],[z3,9,7],[z1^-1,8,7],[z2^-1,9,8],[z3^-1,7,9]];;[0m
    [22m[35mgap> D3 := FpWeightedDigraph( V3, A3 );[0m
    [22m[35mweighted digraph with vertices: [ 7, 8, 9 ][0m
    [22m[35mand arcs: [ [ z1, 7, 8 ], [ z2, 8, 9 ], [ z3, 9, 7 ], [ z1^-1, 8, 7 ],[0m
    [22m[35m  [ z2^-1, 9, 8 ], [ z3^-1, 7, 9 ] ][0m
    [22m[35m[gap> inv3 := InvolutoryArcs( D3 );[0m
    [22m[35m[ 4, 5, 6, 1, 2, 3 ][0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  
  [1m[4m[31m4.2 Graphs of Groups[0m
  
  [1m[4m[31m4.2-1 GraphOfGroups[0m
  
  [1m[34m> GraphOfGroups( [0m[22m[34mdig, gps, sgps, isos[0m[1m[34m ) ___________________________[0moperation
  [1m[34m> DigraphOfGraphOfGroups( [0m[22m[34mgg[0m[1m[34m ) ____________________________________[0mattribute
  [1m[34m> GroupsOfGraphOfGroups( [0m[22m[34mgg[0m[1m[34m ) _____________________________________[0mattribute
  [1m[34m> SubgroupsOfGraphOfGroups( [0m[22m[34mgg[0m[1m[34m ) __________________________________[0mattribute
  [1m[34m> IsomorphismsOfGraphOfGroups( [0m[22m[34mgg[0m[1m[34m ) _______________________________[0mattribute
  
  A graph of groups is traditionally defined as consisting of:
  
  --    a digraph with involutory pairs of arcs;
  
  --    a [22m[36mvertex group[0m associated to each vertex;
  
  --    a group associated to each pair of arcs;
  
  --    an injective homomorphism from each arc group to the group at the head
        of the arc.
  
  We have found it more convenient to associate to each arc:
  
  --    a subgroup of the vertex group at the tail;
  
  --    a subgroup of the vertex group at the head;
  
  --    an isomorphism between these subgroups, such that each involutory pair
        of arcs determines inverse isomorphisms.
  
  These two viewpoints are clearly equivalent.
  
  In  this implementation we require that all subgroups are of finite index in
  the vertex groups.
  
  The four attributes provide a means of calling the four items of data in the
  construction of a graph of groups.
  
  We  shall  be representing free products with amalgamation of groups and HNN
  extensions of groups, so we take as our first example the trefoil group with
  generators  a,b and relation a^3=b^2. For this we take digraph [22m[32mD1[0m above with
  an  infinite cyclic group at each vertex, generated by a and b respectively.
  The  two  subgroups  will  be  generated  by  a^3  and  b^2 with the obvious
  isomorphisms.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> ## free vertex group at 5[0m
    [22m[35mgap> fa := FreeGroup( "a" );;[0m
    [22m[35mgap> a := fa.1;;[0m
    [22m[35mgap> SetName( fa, "fa" );[0m
    [22m[35mgap> hy := Subgroup( fa, [a^3] );;[0m
    [22m[35mgap> SetName( hy, "hy" );[0m
    [22m[35mgap> ## free vertex group at 6[0m
    [22m[35mgap> fb := FreeGroup( "b" );;[0m
    [22m[35mgap> b := fb.1;;[0m
    [22m[35mgap> SetName( fb, "fb" );[0m
    [22m[35mgap> hybar := Subgroup( fb, [b^2] );;[0m
    [22m[35mgap> SetName( hybar, "hybar" );[0m
    [22m[35mgap> ## isomorphisms between subgroups[0m
    [22m[35mgap> homy := GroupHomomorphismByImagesNC( hy, hybar, [a^3], [b^2] );;[0m
    [22m[35mgap> homybar := GroupHomomorphismByImagesNC( hybar, hy, [b^2], [a^3] );;[0m
    [22m[35mgap> ## defining graph of groups G1[0m
    [22m[35mgap> G1 := GraphOfGroups( D1, [fa,fb], [hy,hybar], [homy,homybar] );[0m
    [22m[35mGraph of Groups: 2 vertices; 2 arcs; groups [ fa, fb ][0m
    [22m[35mgap> Display( G1 );[0m
    [22m[35mGraph of Groups with :-[0m
    [22m[35m    vertices: [ 5, 6 ][0m
    [22m[35m        arcs: [ [ y, 5, 6 ], [ y^-1, 6, 5 ] ][0m
    [22m[35m      groups: [ fa, fb ][0m
    [22m[35m   subgroups: [ hy, hybar ][0m
    [22m[35misomorphisms: [ [ [ a^3 ], [ b^2 ] ], [ [ b^2 ], [ a^3 ] ] ][0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m4.2-2 IsGraphOfFpGroups[0m
  
  [1m[34m> IsGraphOfFpGroups( [0m[22m[34mgg[0m[1m[34m ) __________________________________________[0mproperty
  [1m[34m> IsGraphOfPcGroups( [0m[22m[34mgg[0m[1m[34m ) __________________________________________[0mproperty
  [1m[34m> IsGraphOfPermGroups( [0m[22m[34mgg[0m[1m[34m ) ________________________________________[0mproperty
  
  This  is  a  list  of  properties  to  be  expected of a graph of groups. In
  principle  any  type  of  group  known  to [1mGAP[0m may be used as vertex groups,
  though these types are not normally mixed in a single structure.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> IsGraphOfFpGroups( G1 );[0m
    [22m[35mtrue[0m
    [22m[35mgap> IsomorphismsOfGraphOfGroups( G1 );[0m
    [22m[35m[ [ a^3 ] -> [ b^2 ], [ b^2 ] -> [ a^3 ] ][0m
    [22m[35m[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m4.2-3 RightTransversalsOfGraphOfGroups[0m
  
  [1m[34m> RightTransversalsOfGraphOfGroups( [0m[22m[34mgg[0m[1m[34m ) __________________________[0mattribute
  [1m[34m> LeftTransversalsOfGraphOfGroups( [0m[22m[34mgg[0m[1m[34m ) ___________________________[0mattribute
  
  Computation  with  graph of groups words will require, for each arc subgroup
  [22m[32mha[0m,  a  set  of representatives for the left cosets of [22m[32mha[0m in the tail vertex
  group.  As  already pointed out, we require subgroups of finite index. Since
  [1mGAP[0m  prefers  to  provide  right cosets, we obtain the right representatives
  first, and then invert them.
  
  When the vertex groups are of type [22m[32mFpGroup[0m we shall require normal forms for
  these  groups,  so we assume that such vertex groups are provided with Knuth
  Bendix  rewriting  systems  using functions from the main [1mGAP[0m library, (e.g.
  [22m[32mIsomorphismFpSemigroup[0m).
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> RTG1 := RightTransversalsOfGraphOfGroups( G1 );[0m
    [22m[35m[ [ <identity ...>, a, a^2 ], [ <identity ...>, b ] ][0m
    [22m[35mgap> LTG1 := LeftTransversalsOfGraphOfGroups( G1 );[0m
    [22m[35m[ [ <identity ...>, a^-1, a^-2 ], [ <identity ...>, b^-1 ] ] [0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  
  [1m[4m[31m4.3 Words in a Graph of Groups and their normal forms[0m
  
  [1m[4m[31m4.3-1 GraphOfGroupsWord[0m
  
  [1m[34m> GraphOfGroupsWord( [0m[22m[34mgg, tv, list[0m[1m[34m ) _______________________________[0moperation
  [1m[34m> IsGraphOfGroupsWord( [0m[22m[34mw[0m[1m[34m ) _________________________________________[0mproperty
  [1m[34m> GraphOfGroupsOfWord( [0m[22m[34mw[0m[1m[34m ) ________________________________________[0mattribute
  [1m[34m> WordOfGraphOfGroupsWord( [0m[22m[34mw[0m[1m[34m ) ____________________________________[0mattribute
  
  If [22m[32mG[0m is a graph of groups with underlying digraph [22m[32mD[0m, the following groupoids
  may  be  considered. First there is the free groupoid or path groupoid on [22m[32mD[0m.
  Since  we want each involutory pair of arcs to represent inverse elements in
  the  groupoid,  we  quotient  out  by the relations [22m[32my\^{}-1 = ybar[0m to obtain
  [22m[32mPG(D)[0m.  Secondly,  there is the discrete groupoid [22m[32mVG(D)[0m, namely the union of
  all  the  vertex  groups. Since these two groupoids have the same object set
  (the  vertices  of  [22m[32mD[0m) we can form [22m[32mA(G)[0m, the free product of [22m[32mPG(D)[0m and [22m[32mVG(D)[0m
  amalgamated  over  the  vertices.  For  further  details  of  this universal
  groupoid  construction  see  [M01].  (Note  that  these  groupoids  are  not
  implemented in this package.)
  
  An  element  of [22m[32mA(G)[0m is a graph of groups word which may be represented by a
  list  of  the form w = [g_1,y_1,g_2,y_2,...,g_n,y_n,g_n+1]. Here each y_i is
  an  arc  of  [22m[32mD[0m;  the head of y_i-1 is a vertex v_i which is also the tail of
  y_i;  and g_i is an element of the vertex group at v_i. So a graph of groups
  word requires as data the graph of groups; the tail vertex for the word; and
  a  list  of arcs and group elements. We may specify each arc by its position
  in the list of arcs.
  
  In  the  following  example,  where  [22m[32mgw1[0m  is  a word in the trefoil graph of
  groups,  the  y_i  are  specified  by  their  positions in [22m[32mA1[0m. Both arcs are
  traversed twice, so the resulting word is a loop at vertex 5.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> L1 := [ a^7, 1, b^-6, 2, a^-11, 1, b^9, 2, a^7 ];;[0m
    [22m[35mgap> gw1 := GraphOfGroupsWord( G1, 5, L1 );[0m
    [22m[35m(5)a^7.y.b^-6.y^-1.a^-11.y.b^9.y^-1.a^7(5)[0m
    [22m[35mgap> IsGraphOfGroupsWord( gw1 );[0m
    [22m[35mtrue[0m
    [22m[35mgap> [ Tail(gw1), Head(gw1) ];[0m
    [22m[35m[ 5, 5 ][0m
    [22m[35mgap> GraphOfGroupsOfWord(gw1);[0m
    [22m[35mGraph of Groups: 2 vertices; 2 arcs; groups [ fa, fb ][0m
    [22m[35mgap> WordOfGraphOfGroupsWord( gw1 );[0m
    [22m[35m[ a^7, 1, b^-6, 2, a^-11, 1, b^9, 2, a^7 ][0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m4.3-2 ReducedGraphOfGroupsWord[0m
  
  [1m[34m> ReducedGraphOfGroupsWord( [0m[22m[34mw[0m[1m[34m ) ___________________________________[0moperation
  [1m[34m> IsReducedGraphOfGroupsWord( [0m[22m[34mw[0m[1m[34m ) __________________________________[0mproperty
  
  A  graph  of  groups word may be reduced in two ways, to give a normal form.
  Firstly,  if  part  of the word has the form [22m[32m[yi, identity, yibar][0m then this
  subword  may be omitted. This is known as a length reduction. Secondly there
  are  coset  reductions. Working from the left-hand end of the word, subwords
  of  the  form [g_i,y_i,g_i+1] are replaced by [t_i,y_i,m_i(h_i)*g_i+1] where
  g_i  =  t_i*h_i  is  the  unique  factorisation  of  g_i  as  a  left  coset
  representative  times  an  element  of  the  arc  subgroup,  and  m_i is the
  isomorphism  associated  to  y_i.  Thus we may consider a coset reduction as
  passing  a  subgroup  element along an arc. The resulting normal form (if no
  length  reductions have taken place) is then [t_1,y_1,t_2,y_2,...,t_n,y_n,k]
  for  some k in the head group of y_n. For further details see Section 2.2 of
  [M01].
  
  The  reduction of the word [22m[32mgw1[0m in our example includes one length reduction.
  The four stages of the reduction are as follows:
  
  \[
       a^7b^{-6}a^{-11}b^9a^7 ~\mapsto~ a^{-2}b^0a^{-11}b^9a^7 ~\mapsto~
       a^{-13}b^9a^7 ~\mapsto~ a^{-1}b^{-8}b^9a^7 ~\mapsto~
       a^{-1}b^{-1}a^{10}.
  \]
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> nw1 := ReducedGraphOfGroupsWord( gw1 );[0m
    [22m[35m(5)a^-1.y.b^-1.y^-1.a^10(5)[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  
  [1m[4m[31m4.4 Free products with amalgamation and HNN extensions[0m
  
  [1m[4m[31m4.4-1 FreeProductWithAmalgamation[0m
  
  [1m[34m> FreeProductWithAmalgamation( [0m[22m[34mgp1, gp2, iso[0m[1m[34m ) ____________________[0moperation
  [1m[34m> IsFpaGroup( [0m[22m[34mfpa[0m[1m[34m ) ________________________________________________[0mproperty
  [1m[34m> GraphOfGroupsRewritingSystem( [0m[22m[34mfpa[0m[1m[34m ) _____________________________[0mattribute
  [1m[34m> NormalFormGGRWS( [0m[22m[34mfpa, word[0m[1m[34m ) ____________________________________[0mattribute
  
  As we have seen with the trefoil group example, graphs of groups can be used
  to obtain a normal form for free products with amalgamation G_1 *_H G_2 when
  G_1, G_2 both have rewrite systems, and H is of finite index in both G_1 and
  G_2.
  
  When  [22m[32mgp1[0m  and  [22m[32mgp2[0m are fp-groups, the operation [22m[32mFreeProductWithAmalgamation[0m
  constructs  the  required  fp-group.  When  the  two  groups are permutation
  groups,  the [22m[32mIsomorphismFpGroup[0m operation is called on both [22m[32mgp1[0m and [22m[32mgp2[0m, and
  the  resulting  isomorphism  is  transported  to  one  between  the  two new
  subgroups.
  
  The  attribute  [22m[32mGraphOfGroupsRewritingSystem[0m  of  [22m[32mfpa[0m is the graph of groups
  which  has  underlying  digraph  [22m[32mD1[0m, with two vertices and two arcs; the two
  groups as vertex groups; and the specified isomorphisms on the arcs. Despite
  the  name,  graphs  of  groups  constructed in this way [22m[36mdo not[0m belong to the
  category  [22m[32mIsRewritingSystem[0m.  This  anomaly  may  be  dealt  with  when time
  permits.
  
  The  example  below  shows  a  computation  in  the  the free product of the
  symmetric [22m[32ms3[0m and the alternating [22m[32ma4[0m, amalgamated over a cyclic subgroup [22m[32mc3[0m.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> ## set up the first group s3 and a subgroup c3=<a1>[0m
    [22m[35mgap> f1 := FreeGroup( 2, "a" );;[0m
    [22m[35mgap> rel1 := [ f1.1^3, f1.2^2, (f1.1*f1.2)^2 ];;[0m
    [22m[35mgap> s3 := f1/rel1;;[0m
    [22m[35mgap> gs3 := GeneratorsOfGroup(s3);;[0m
    [22m[35mgap> SetName( s3, "s3" );[0m
    [22m[35mgap> a1 := gs3[1];;  a2 := gs3[2];;[0m
    [22m[35mgap> H1 := Subgroup(s3,[a1]);;[0m
    [22m[35mgap> ## then the second group a4 and subgroup c3=<b1>[0m
    [22m[35mgap> f2 := FreeGroup( 2, "b" );;[0m
    [22m[35mgap> rel2 := [ f2.1^3, f2.2^3, (f2.1*f2.2)^2 ];;[0m
    [22m[35mgap> a4 := f2/rel2;;[0m
    [22m[35mgap> ga4 := GeneratorsOfGroup(a4);;[0m
    [22m[35mgap> SetName( a4, "a4" );[0m
    [22m[35mgap> b1 := ga4[1];  b2 := ga4[2];;[0m
    [22m[35mgap> H2 := Subgroup(a4,[b1]);;[0m
    [22m[35mgap> ## form the isomorphism and the fpa group[0m
    [22m[35mgap> iso := GroupHomomorphismByImages(H1,H2,[a1],[b1]);;[0m
    [22m[35mgap> fpa := FreeProductWithAmalgamation( s3, a4, iso );[0m
    [22m[35m<fp group on the generators [ fa1, fa2, fa3, fa4 ]>[0m
    [22m[35mgap> RelatorsOfFpGroup( fpa );[0m
    [22m[35m[ fa1^3, fa2^2, fa1*fa2*fa1*fa2, fa3^3, fa4^3, fa3*fa4*fa3*fa4, fa1*fa3^-1 ][0m
    [22m[35mgap> gg1 := GraphOfGroupsRewritingSystem( fpa );;[0m
    [22m[35mgap> Display( gg1 );[0m
    [22m[35mGraph of Groups with :-[0m
    [22m[35m    vertices: [ 5, 6 ][0m
    [22m[35m        arcs: [ [ y, 5, 6 ], [ y^-1, 6, 5 ] ][0m
    [22m[35m      groups: [ s3, a4 ][0m
    [22m[35m   subgroups: [ Group( [ a1 ] ), Group( [ b1 ] ) ][0m
    [22m[35misomorphisms: [ [ [ a1 ], [ b1 ] ], [ [ b1 ], [ a1 ] ] ][0m
    [22m[35mgap> LeftTransversalsOfGraphOfGroups( gg1 );[0m
    [22m[35m[ [ <identity ..>, a2^-1 ], [ <identity ..>, b2^-1, b1^-1*b2^-1, b1*b2^-1 ] ][0m
    [22m[35mgap> ## choose a word in fpa and find its normal form [0m
    [22m[35mgap> gfpa := GeneratorsOfGraphOfGroups( fpa );;[0m
    [22m[35mgap> w2 := (gfpa[1]*gfpa[2]*gfpa[3]^gfpa[4])^3;[0m
    [22m[35mfa1*fa2*fa4^-1*fa3*fa4*fa1*fa2*fa4^-1*fa3*fa4*fa1*fa2*fa4^-1*fa3*fa4[0m
    [22m[35mgap> n2 := NormalFormGGRWS( fpa, w2 );[0m
    [22m[35mfa2*fa3*fa4^-1*fa2*fa4^-1*fa2*fa3^-1*fa4*fa3^-1[0m
    [22m[35m[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m4.4-2 HnnExtension[0m
  
  [1m[34m> HnnExtension( [0m[22m[34mgp, iso[0m[1m[34m ) _________________________________________[0moperation
  [1m[34m> IsHnnGroup( [0m[22m[34mhnn[0m[1m[34m ) ________________________________________________[0mproperty
  
  For  [22m[36mHNN  extensions[0m, the appropriate graph of groups has underlying digraph
  with just one vertex and one pair of loops, weighted with [22m[32mFpGroup[0m generators
  z,z^-1.  There  is  one vertex group [22m[32mG[0m, two isomorphic subgroups [22m[32mH1,H2[0m of [22m[32mG[0m,
  with  the  isomorphism and its inverse on the loops. The presentation of the
  extension  has  one  more  generator  than  that of [22m[32mG[0m and corresponds to the
  generator z.
  
  The   functions  [22m[32mGraphOfGroupsRewritingSystem[0m  and  [22m[32mNormalFormGGRWS[0m  may  be
  applied to hnn-groups as well as to fpa-groups.
  
  In the example we take [22m[32mG=a4[0m and the two subgroups are cyclic groups of order
  3.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> H3 := Subgroup(a4,[b2]);;[0m
    [22m[35mgap> i23 := GroupHomomorphismByImages( H2, H3, [b1], [b2] );;[0m
    [22m[35mgap> hnn := HnnExtension( a4, i23 );[0m
    [22m[35m<fp group on the generators [ fe1, fe2, fe3 ]> [0m
    [22m[35mgap> phnn := PresentationFpGroup( hnn );;[0m
    [22m[35mgap> TzPrint( phnn );[0m
    [22m[35m#I  generators: [ fe1, fe2, fe3 ][0m
    [22m[35m#I  relators:[0m
    [22m[35m#I  1.  3  [ 1, 1, 1 ][0m
    [22m[35m#I  2.  3  [ 2, 2, 2 ][0m
    [22m[35m#I  3.  4  [ 1, 2, 1, 2 ][0m
    [22m[35m#I  4.  4  [ -3, 1, 3, -2 ] [0m
    [22m[35mgap> gg2 := GraphOfGroupsRewritingSystem( hnn );[0m
    [22m[35mGraph of Groups: 1 vertices; 2 arcs; groups [ a4 ][0m
    [22m[35mgap> LeftTransversalsOfGraphOfGroups( gg2 );[0m
    [22m[35m[ [ <identity ...>, b2^-1, b1^-1*b2^-1, b1*b2^-1 ],[0m
    [22m[35m  [ <identity ...>, b1^-1, b1, b2^-1*b1 ] ][0m
    [22m[35mgap> gh := GeneratorsOfGroup( hnn );;[0m
    [22m[35mgap> w3 := (gh[1]^gh[2])*gh[3]^-1*(gh[1]*gh[3]*gh[2]^2)^2*gh[3]*gh[2];[0m
    [22m[35mfe2^-1*fe1*fe2*fe3^-1*fe1*fe3*fe2^2*fe1*fe3*fe2^2*fe3*fe2 [0m
    [22m[35mgap> n3 := NormalFormGGRWS( hnn, w3 );[0m
    [22m[35mfe2*fe1*fe3*fe2*fe1*fe3   [0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  Both  fpa-groups  and  hnn-groups  are  provided  with  a  record attribute,
  [22m[32mFpaInfo(fpa)[0m   and   [22m[32mHnnInfo(hnn)[0m   respectively,  storing  the  groups  and
  isomorphisms involved in their construction.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> fpainfo := FpaInfo( fpa );[0m
    [22m[35mrec( groups := [ s3, a4 ], positions := [ [ 1, 2 ], [ 3, 4 ] ],[0m
    [22m[35m  isomorphism := [ a1 ] -> [ b1 ] )[0m
    [22m[35mgap> hnninfo := HnnInfo( hnn );[0m
    [22m[35mrec( group := a4, isomorphism := [ b1 ] -> [ b2 ] )[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  
  [1m[4m[31m4.5 GraphsOfGroupoids and their Words[0m
  
  [1m[4m[31m4.5-1 GraphOfGroupoids[0m
  
  [1m[34m> GraphOfGroupoids( [0m[22m[34mdig, gpds, subgpds, isos[0m[1m[34m ) ____________________[0moperation
  [1m[34m> IsGraphOfPermGroupoids( [0m[22m[34mgg[0m[1m[34m ) _____________________________________[0mproperty
  [1m[34m> IsGraphOfFpGroupoids( [0m[22m[34mgg[0m[1m[34m ) _______________________________________[0mproperty
  [1m[34m> GroupoidsOfGraphOfGroupoids( [0m[22m[34mgg[0m[1m[34m ) _______________________________[0mattribute
  [1m[34m> DigraphOfGraphOfGroupoids( [0m[22m[34mgg[0m[1m[34m ) _________________________________[0mattribute
  [1m[34m> SubgroupoidsOfGraphOfGroupoids( [0m[22m[34mgg[0m[1m[34m ) ____________________________[0mattribute
  [1m[34m> IsomorphismsOfGraphOfGroupoids( [0m[22m[34mgg[0m[1m[34m ) ____________________________[0mattribute
  [1m[34m> RightTransversalsOfGraphOfGroupoids( [0m[22m[34mgg[0m[1m[34m ) _______________________[0mattribute
  [1m[34m> LefvtTransversalsOfGraphOfGroupoids( [0m[22m[34mgg[0m[1m[34m ) _______________________[0mattribute
  
  Graphs  of  groups  generalise naturally to graphs of groupoids, forming the
  class  [22m[32mIsGraphOfGroupoids[0m.  There  is  now a groupoid at each vertex and the
  isomorphism  on  an  arc identifies wide subgroupoids at the tail and at the
  head.  Since  all  subgroupoids  are  wide,  every  groupoid  in a connected
  component  of  the  graph  has  the  same number of objects, but there is no
  requirement that the object sets are all the same.
  
  The example below generalises the trefoil group example in subsection 4.4.1,
  taking  at  each vertex of [22m[32mD1[0m a two-object groupoid with a free group on one
  generator, and full subgroupoids with groups < a^3 > and < b^2 >.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> Gfa := ConnectedGroupoid( [-2,-1], fa );;[0m
    [22m[35mgap> Uhy := Subgroupoid( Gfa, [ [[-2,-1], hy ] ] );;[0m
    [22m[35mgap> SetName( Gfa, "Gfa" );  SetName( Uhy, "Uhy" );[0m
    [22m[35mgap> Gfb := ConnectedGroupoid( [-4,-3], fb );;[0m
    [22m[35mgap> Uhybar := Subgroupoid( Gfb, [ [[-4,-3], hybar ] ] );;[0m
    [22m[35mgap> SetName( Gfb, "Gfb" );  SetName( Uhybar, "Uhybar" );[0m
    [22m[35mgap> mory := MorphismOfConnectedGroupoids( Uhy, Uhybar, [-4,-3], homy );;[0m
    [22m[35mgap> morybar := MorphismOfConnectedGroupoids( Uhybar, Uhy, [-2,-1], homybar );;[0m
    [22m[35mgap> gg3 := GraphOfGroupoids( D1, [Gfa,Gfb], [Uhy,Uhybar], [mory,morybar] );;[0m
    [22m[35mgap> Display(gg3);[0m
    [22m[35mGraph of Groupoids with :-[0m
    [22m[35m    vertices: [ 5, 6 ][0m
    [22m[35m        arcs: [ [ y, 5, 6 ], [ y^-1, 6, 5 ] ][0m
    [22m[35m   groupoids:[0m
    [22m[35mFp Connected Groupoid: Gfa[0m
    [22m[35m  objects: [ -2, -1 ][0m
    [22m[35m    group: fa = <[ a ]>[0m
    [22m[35mFp Connected Groupoid: Gfb[0m
    [22m[35m  objects: [ -4, -3 ][0m
    [22m[35m    group: fb = <[ b ]>[0m
    [22m[35msubgroupoids: Connected Groupoid: Uhy[0m
    [22m[35m  objects: [ -2, -1 ][0m
    [22m[35m    group: hy = <[ a^3 ]>[0m
    [22m[35mConnected Groupoid: Uhybar[0m
    [22m[35m  objects: [ -4, -3 ][0m
    [22m[35m    group: hybar = <[ b^2 ]>[0m
    [22m[35misomorphisms: [ Groupoid morphism : Uhy -> Uhybar[0m
    [22m[35m    , Groupoid morphism : Uhybar -> Uhy[0m
    [22m[35m     ][0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m4.5-2 GraphOfGroupoidsWord[0m
  
  [1m[34m> GraphOfGroupoidsWord( [0m[22m[34mgg, tv, list[0m[1m[34m ) ____________________________[0moperation
  [1m[34m> IsGraphOfGroupoidsWord( [0m[22m[34mw[0m[1m[34m ) ______________________________________[0mproperty
  [1m[34m> GraphOfGroupoidsOfWord( [0m[22m[34mw[0m[1m[34m ) _____________________________________[0mattribute
  [1m[34m> WordOfGraphOfGroupoidsWord( [0m[22m[34mw[0m[1m[34m ) _________________________________[0mattribute
  [1m[34m> ReducedGraphOfGroupoidsWord( [0m[22m[34mw[0m[1m[34m ) ________________________________[0moperation
  [1m[34m> IsReducedGraphOfGroupoidsWord( [0m[22m[34mw[0m[1m[34m ) _______________________________[0mproperty
  
  Having  produced  the  graph  of  groupoids [22m[32mgg3[0m, we may construct left coset
  representatives; choose a graph of groupoids word; and reduce this to normal
  form. Compare the [22m[32mnw3[0m below with the normal form [22m[32mnw1[0m in subsection 4.3.2.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> f1 := GroupoidElement( Gfa, a^7, -1, -2);;[0m
    [22m[35mgap> f2 := GroupoidElement( Gfb, b^-6, -4, -4 );;[0m
    [22m[35mgap> f3 := GroupoidElement( Gfa, a^-11, -2, -1 );;[0m
    [22m[35mgap> f4 := GroupoidElement( Gfb, b^9, -3, -4 );;[0m
    [22m[35mgap> f5 := GroupoidElement( Gfa, a^7, -2, -1 );;[0m
    [22m[35mgap> L3 := [ f1, 1, f2, 2, f3, 1, f4, 2, f5 ];[0m
    [22m[35m[ [a^7 : -1 -> -2], 1, [b^-6 : -4 -> -4], 2, [a^-11 : -2 -> -1], 1,[0m
    [22m[35m  [b^9 : -3 -> -4], 2, [a^7 : -2 -> -1] ][0m
    [22m[35mgap> gw3 := GraphOfGroupoidsWord( gg3, 5, L3);[0m
    [22m[35m(5)[a^7 : -1 -> -2].y.[b^-6 : -4 -> -4].y^-1.[a^-11 : -2 -> -1].y.[b^9 :[0m
    [22m[35m-3 -> -4].y^-1.[a^7 : -2 -> -1](5)[0m
    [22m[35mgap> nw3 := ReducedGraphOfGroupoidsWord( gw3 );[0m
    [22m[35m(5)[a^-1 : -1 -> -2].y.[b^-1 : -4 -> -4].y^-1.[a^10 : -2 -> -1](5)[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  More  examples  of  these  operations  may  be  found  in  the  example file
  [1mgpd/examples/ggraph.g[0m.
  
