1 | initial version |
As a first step:
sage: p=posets.PentagonPoset()
sage: Q=DiGraph([(x,y,'c'+str(x)+str(y)) for x,y in p.cover_relations()])
sage: Q.path_semigroup().algebra(QQ)
Path algebra of Digraph on 5 vertices over Rational Field
Then you need a general way to pass this path algebra and its elements to gap.
2 | No.2 Revision |
As a first step:
sage: p=posets.PentagonPoset()
sage: Q=DiGraph([(x,y,'c'+str(x)+str(y)) for x,y in p.cover_relations()])
sage: Q.path_semigroup().algebra(QQ)
Path algebra of Digraph on 5 vertices over Rational Field
Then you need a general way to pass this path algebra and its elements to gap.
EDIT
Here is an helper function:
def gap_text(P):
Q = DiGraph([(x,y,'x'+str(x)+str(y)) for x, y in P.cover_relations()])
SG = Q.path_semigroup()
A = SG.algebra(ZZ)
rels = []
for a, b in P.relations():
if Q.in_degree(b) > 1 and Q.out_degree(a) > 1:
paths = Q.all_paths(a, b)
if len(paths) > 1:
prod_paths = [A.prod(A(Q.edge_label(pa[i], pa[i+1]))
for i in range(len(pa) - 1))
for pa in paths]
rels += [prod_paths[0] - pi for pi in prod_paths[1:]]
txt0 = 'Q:=Quiver({},{});'.format(Q.size(),Q.edges())
txt1 = 'kQ:=PathAlgebra(Rationals,Q);'
txt2 = 'AssignGeneratorVariables(kQ);'
txt3 = 'rel:={};'.format(rels)
txt4 = 'A:=kQ/rel;'
return txt0 + txt1 + txt2 + txt3 + txt4
that gives
sage: p=posets.DivisorLattice(6)
sage: gap_text(p)
"Q:=Quiver(4,[(1, 2, 'x12'), (1, 3, 'x13'), (2, 6, 'x26'), (3, 6, 'x36')]);kQ:=PathAlgebra(Rationals,Q);AssignGeneratorVariables(kQ);rel:=[-x13*x36 + x12*x26];A:=kQ/rel;"
3 | No.3 Revision |
As a first step:
sage: p=posets.PentagonPoset()
sage: Q=DiGraph([(x,y,'c'+str(x)+str(y)) for x,y in p.cover_relations()])
sage: Q.path_semigroup().algebra(QQ)
Path algebra of Digraph on 5 vertices over Rational Field
Then you need a general way to pass this path algebra and its elements to gap.
EDIT
Here is an a better helper function:
def gap_text(P):
Z = P.relabel()
Z = Z.relabel(lambda s: s+1)
Q = DiGraph([(x,y,'x'+str(x)+str(y)) for x, y in P.cover_relations()])
Z.cover_relations()])
SG = Q.path_semigroup()
A = SG.algebra(ZZ)
rels = []
for a, b in P.relations():
Z.relations():
if Q.in_degree(b) > 1 and Q.out_degree(a) > 1:
paths = Q.all_paths(a, b)
if len(paths) > 1:
prod_paths = [A.prod(A(Q.edge_label(pa[i], pa[i+1]))
for i in range(len(pa) - 1))
for pa in paths]
rels += [prod_paths[0] - pi for pi in prod_paths[1:]]
txt0 = 'Q:=Quiver({},{});'.format(Q.size(),Q.edges())
'Q:=Quiver({},{});'.format(Q.size(),[list(e) for e in Q.edges()])
txt1 = 'kQ:=PathAlgebra(Rationals,Q);'
txt2 = 'AssignGeneratorVariables(kQ);'
txt3 = 'rel:={};'.format(rels)
txt4 = 'A:=kQ/rel;'
return txt0 + txt1 + txt2 + txt3 + txt4
that gives
sage: p=posets.DivisorLattice(6)
sage: gap_text(p)
"Q:=Quiver(4,[(1, 2, 'x12'), (1, 3, 'x13'), (2, 6, 'x26'), (3, 6, 'x36')]);kQ:=PathAlgebra(Rationals,Q);AssignGeneratorVariables(kQ);rel:=[-x13*x36 + x12*x26];A:=kQ/rel;"
4 | No.4 Revision |
As a first step:
sage: p=posets.PentagonPoset()
sage: Q=DiGraph([(x,y,'c'+str(x)+str(y)) for x,y in p.cover_relations()])
sage: Q.path_semigroup().algebra(QQ)
Path algebra of Digraph on 5 vertices over Rational Field
Then you need a general way to pass this path algebra and its elements to gap.
EDIT
Here is a better helper function:
def gap_text(P):
Z = P.relabel()
Z = Z.relabel(lambda s: s+1)
Q = DiGraph([(x,y,'x'+str(x)+str(y)) for x, y in Z.cover_relations()])
SG = Q.path_semigroup()
A = SG.algebra(ZZ)
rels = []
for a, b in Z.relations():
if Q.in_degree(b) > 1 and Q.out_degree(a) > 1:
paths = Q.all_paths(a, b)
if len(paths) > 1:
prod_paths = [A.prod(A(Q.edge_label(pa[i], pa[i+1]))
for i in range(len(pa) - 1))
for pa in paths]
rels += [prod_paths[0] - pi for pi in prod_paths[1:]]
txt0 = 'Q:=Quiver({},{});'.format(Q.size(),[list(e) 'Q:=Quiver({},{});'.format(Q.num_verts(),[list(e) for e in Q.edges()])
txt1 = 'kQ:=PathAlgebra(Rationals,Q);'
txt2 = 'AssignGeneratorVariables(kQ);'
txt3 = 'rel:={};'.format(rels)
txt4 = 'A:=kQ/rel;'
return txt0 (txt0 + txt1 + txt2 + txt3 + txt4
txt4).replace("'", '"')
that gives
sage: p=posets.DivisorLattice(6)
sage: gap_text(p)
"Q:=Quiver(4,[(1, 2, 'x12'), (1, 3, 'x13'), (2, 6, 'x26'), (3, 6, 'x36')]);kQ:=PathAlgebra(Rationals,Q);AssignGeneratorVariables(kQ);rel:=[-x13*x36 + x12*x26];A:=kQ/rel;"