Program to find intersection of subgroups of free groups As the title says, I am working on examples for a research project I'm doing, and I need a way to efficiently calculate the intersection of subgroups of a free group (say, of rank 2). Are there any computer programs to do this, or any papers explaining how such a program could be written?

The algorithm is easy and well known. Let $A, B$ be finitely generated subgroups of a free group $F$. Construct the Stallings cores $U,V$ of these subgroups. These are labeled graphs whose labels-generators of $F$ and which have basepoints $u,v$. Then $A$ (resp. $B$) consists of all labels of reduced loops of $U$ (resp. $V$) at $u$ (resp. $v$). Then consider the pull-back graph $U*V$ which has vertices $(x,y)$ where $x$ is a vertex of $U$, $y$ is a vertex of $V$. The edges have the form $(x,y)--(xs,ys)$ where $[x,xs]$ (resp $[y,ys]$) is an edge of $U$ (resp. $V$) starting at $x$ (resp. $y$) and labeled by $s$. Then $A\cap B$ is the set of labels of reduced loops of $U*V$ at $(u,v)$. That is $A\cap B$ is the fundamental group of $U*V$ with basepoint $(u,v)$.
