From groups to groupoids. Let $\mathcal{G}$ be a groupoid and $p$ an object in $\mathcal{G}.$ It is well known that the set ${\rm Mor}_{\mathcal{G}}(p,p)$ is a group.
I would like to know if there is a way to recognize a group $G$ as a group of morphisms, that is:
Given a group $G,$ i want to find a connected groupoid $\mathcal{G}$ (different from $G$)  and an object $p$ of $\mathcal{G}$ such that $G={\rm Mor}_{\mathcal{G}}(p,p).$
Thanks.
 A: If $G$ is a group, you can construct a groupoid with exactly one object $p$ whose endomorphism group is $G$.
If you want there to be more objects, add an object $q$, and two inverse isomorphisms $\alpha:p\to q$ and $\beta:q\to p$, set $\hom(p,p)=G=\hom(q,q)$ with its composition, and define compositions with $\alpha$ and $\beta$ in the obvious way.
Later. If $G$ is a group and $X$ a set, there is a groupoid $G_X$ with objcts the elements of $X$, with arrows $X\times G\times X$, with domain and target functions defined so that the arrow $(x,g,y)$ goes from $y$ to $x$, and composition of $(x,g,y)$ and $(y,h,z)$ is $(x,gh,z)$. The endomorphissm group of $x\in X$ in this groupoid is the set of arrows of the form $(x,g,x)$ with $g\in G$, and composition was defined so that the multiplication of these things coincides with that of $g$.
A: In fact a connected groupoid $G$ is uniquely determined by a group $G(x_0)$ and a tree groupoid $T$.  

A tree groupoid is a groupoid $T$ such that $T(x,y)$ is always a singleton or, equivalently, if $T$ is connected and an object group $T(x)$ is trivial.

If you are given a tree $T$ and a group which we will denote $G(x_0)$ where $x_0$ is an object of $T$, then we can construct a groupoid $G=T* G(x_0)$ whose


*

*objects are the objects of $T$,

*arrows from $x$ to $y$ are the arrows in $T$ and the strings of the form 
$$\tau_y g\tau_x^{-1} \quad g\ne 1\in G(x_0),\ \tau_y\in T(x_0,y),\ x,y\in\text{Ob}(T)$$



This groupoid $G=T*G(x_0)$ has a universal property: There are inclusions $i:T\to G$ and $j:G(x_0)\to G$ and for every pair of morphisms $k:T→H, l:G(x_0)→H$ such that $k(x_0)=l(x_0)$ there is a unique morphisms $m:G→H$ with $mi=k,mj=l$.

Conversely, if a connected groupoid $G$ is given, then it has a wide (with all objects) tree subgroupoid $T$, and one can show that $G=T*G(x_0)$. The tree $T$ is constructed by fixing an object $x_0$, then choosing $\tau_x\in T(x_0,x)$ where $\tau_{x_0}=1$, and finally put $\tau_{xy}=\tau_y\tau_x^{-1}$.
Edit: What I've written may sound more complex than it actually is. A tree groupoid is actually determined by its set of objects alone. If $O$ is a set and $x_0$ an object in $O$, then there is a graph $\Gamma$ with one edge $τ_x$ from $x_0$ to every other object $x$. A graph always generates a free groupoid, and the free groupoid $F\Gamma$ consists of the elements $τ_x, τ^{-1}_x, τ_yτ^{-1}_x$. Clearly any tree groupoid $T$ with objects $O$ is just $F\Gamma$ with relabelled edges.
This emphasises that a connected groupoid is nothing more than a group $G$ and a set of objects.
A: Every connected groupoid $\mathcal{G}$ that has an object $p$ such that $\hom(p,p) \cong G$ is actually equivalent to $G$ as a category.
But conversely, every category equivalent to $G$ is going to be a groupoid with the properties you desire.
