# List of path arrows in GAP

I am using the QPA package with GAP and have the following problem:

I want to, given a path $p$, obtain a list (preferably ordered) of the arrows which make up $p$.

For example, if I have arrows $a,b,c$ in a path algebra $kQ$ and I have the path $p=ab$, I want the list $[a,b]$ to be returned from some function where I only have to input the path (and maybe the path algebra).

I did some digging and only found such a function for the quiver but not the path algebra: 3.7-4 in https://folk.ntnu.no/oyvinso/QPA/qpa/doc/chap3_mj.html#X7C8294338676C80E is a "WalkOfPath" function which returns such a list, but this only works for paths seen as paths in the quiver instead of paths seen as elements of a path algebra. There also does not appear to be a way to take a path of a path algebra and convert it back to a path in the quiver.

Any feedback is appreciated, cheers.

Edit: I have made a function which produces an unordered list of the arrows in a path, however this does not display them in the order in which they appear in the path (the latter would be better, so I am leaving the question open to answering). Also, my function does not include arrow multiplicities, which is something I really want out of it. Here is my function:

patharrows := function(pathalg, path)
local i, arrows, output, rels, ideal;
if path=Zero(path) then
return [];
fi;
arrows := NthPowerOfArrowIdeal(pathalg, 1);
output := [];
for i in [1..Length(arrows)] do
rels := [arrows[i]];
ideal := Ideal(pathalg, rels);
if \in(path, ideal) then
fi;
od;
return output;
end;


Alas! I scanned the QPA manual and missed the following gem:

 LeadingMonomial(elem)


where elem is an element of the path algebra (call it $kQ$ with $Q$ being the quiver and $k$ the ground field). This function returns the tip of elem with respect to the given ordering for the Groebner basis calculations as a path in the quiver $Q$ rather than an element of the path algebra $kQ$. In particular, the tip of any monomial (regardless of the admissible ordering) is the monomial itself, and so if you input a monomial element of $kQ$ as elem then LeadingMonomial(elem) is the same monomial element regarded as a path in the quiver $Q$.

Now that we can play with our monomial element of $kQ$ as a path in $Q$, we can use the function

 WalkOfPath(path)


by setting path := LeadingMonomial(elem) and this function returns an ordered list of the arrows appearing in path. If you then want to interpret the arrows in this ordered list as elements of the path algebra $kQ$ rather than arrows in $Q$ (which is what the above does), you can use

 ElementOfPathAlgebra(kQ, path)


which embeds path into $kQ$.

• Its amazing what a look into the manual can find (Variation on Westheimer's discovery: en.wikiquote.org/wiki/Frank_Westheimer). Aug 21 '18 at 20:33
• Along the same line, in my work experience the manual was often sardonically referred to (especially when recommending its reading to newcomers) as 'the book of revelation'. Dec 12 '18 at 8:11