Systematically labeling arrows in GAP's QPA

57 Views Asked by At

I'm trying to build a quiver in QPA which has 42 nodes, labeled by some of the signvectors in $\{\pm 1\}^6$. I want to build a rule that assigns an arrow $a\to b$ if $a$ and $b$ differ in exactly one component, and I want to label the arrows so that I can keep their source and target in mind. For example, I would have an arrow $[-1,1,1,1,1,1]\to [-1,1,1,1,-1,1]$. I would love to be able to label arrows by their source and target: so the arrow above should be given by the triple $$[[-1,1,1,1,1,1],[-1,1,1,1,-1,1], ``p([-1,1,1,1,1,1],[-1,1,1,1,-1,1])"].$$ However, I haven't been able to code in the label correctly. My current code is

gap> a:=[-1,1,1,1,1,1]; b:=[-1,1,1,1,-1,1];[a,b,"p(a,b)"]

which returns

[[-1,1,1,1,1,1],[-1,1,1,1,-1,1],p(a,b)]

Is there some way to get this type of labeling to work?

2

There are 2 best solutions below

0
On BEST ANSWER

Is this what you want?

gap> a:=[-1,1,1,1,1,1]; b:=[-1,1,1,1,-1,1];
[ -1, 1, 1, 1, 1, 1 ]
[ -1, 1, 1, 1, -1, 1 ]
gap> [String(a),String(b), Concatenation("p(",String(a),",",String(b),")") ];
[ "[ -1, 1, 1, 1, 1, 1 ]", "[ -1, 1, 1, 1, -1, 1 ]", 
  "p([ -1, 1, 1, 1, 1, 1 ],[ -1, 1, 1, 1, -1, 1 ])" ]
1
On

Maybe helpful, but instead of embedding the source and target in the arrow's label, you might consider utilizing the SourceOfPath and TargetOfPath functions. Otherwise your vertex labels and arrow labels have redundant information.

gap> a:=[-1,1,1,1,1,1]; b:=[-1,1,1,1,-1,1];
[ -1, 1, 1, 1, 1, 1 ]
[ -1, 1, 1, 1, -1, 1 ]
gap> sa := String(a); sb := String(b);
"[ -1, 1, 1, 1, 1, 1 ]"
"[ -1, 1, 1, 1, -1, 1 ]"
gap> Q := Quiver([sa,sb],[[sa,sb,"arrow"]]);
<quiver with 2 vertices and 1 arrows>
gap> Print(SourceOfPath(Q.arrow), " -> ", TargetOfPath(Q.arrow));
[ -1, 1, 1, 1, 1, 1 ] -> [ -1, 1, 1, 1, -1, 1 ]