Left adjoint of the forgetful functor $\mathsf{Grpd} \to \mathsf{Cat}$? I've heard that there is a left adjoint to the forgetful functor $\mathsf{Grp} \to \mathsf{Mon}$. I wonder if there is also a left adjoint $F : \mathsf{Cat} \to \mathsf{Grpd}$ to the forgetful functor $\mathsf{Grpd} \to \mathsf{Cat}$, where $\mathsf{Grpd}$ is the category of groupoids, and if so, how $F$ explicitely may look like.
My idea was roughly, that for every category $\mathcal{A}$, the groupoid $F\mathcal{A}$ should have the same objects as $\mathcal{A}$. An arrow $f : A \to B$ in $F\mathcal{A}$ should be one of the following:


*

*a tuple $(A,f',B)$, where $f ': A \to B$ is an arrow in $\mathcal{A}$

*a tuple $(A,f',B)$, where $f' : B \to A$ is an arrow in $\mathcal{A}$, iff (??) $f'$ is not iso in $\mathcal{A}$ (this acts as an inverse of $(B,f',A)$ in $F\mathcal{A}$)

*other things that you need to have, s.t. you can compose arrows $(A, A \to B, B)$ with arrows $(B, C \to B, C)$  and so on and so forth


Of course, I don't know how to make the last point formal and hence I don't know how composition should look like. Also, I don't know whether I should throw in an inverse for every arrow or only for those, which "aren't already iso" (as indicated by the (??)).
Any thoughts one that?
 A: Your idea is basically correct.  More explicitly, $F\mathcal{A}$ has the same objects as $\mathcal{A}$ and a map $A\to B$ in $F\mathcal{A}$ can be represented as a "zigzag" of maps of $\mathcal{A}$ $$A\to C_1\leftarrow C_2\to C_3\leftarrow\dots\leftarrow C_n \to B,$$
which we think of as formally representing the composition of the rightward arrows with the inverses of the leftward arrows.  We impose an equivalence relation on such zigzags by declaring that applying any sequence of the following operations (or their inverses) turns a zigzag into an equivalent zigzag:


*

*Identity maps can be removed, with the neighboring maps then composed, as in $C_i\stackrel{f}{\to} C_{i+1}\stackrel{1}{\leftarrow} C_{i+2}\stackrel{g}{\to}C_{i+3}$ turning into $C_i\stackrel{gf}{\to}C_{i+3}$.

*Neighboring pairs of maps with the same label can be added into the middle of a zigzag, with neighboring maps then composed if they are in the same direction.  For instance, $C_i\stackrel{f}{\to}C_{i+1}\stackrel{g}{\leftarrow} C_{i+2}$ can turn into either $C_i\stackrel{f}{\to}C_{i+1}\stackrel{h}{\leftarrow} D\stackrel{h}{\to}C_{i+1}\stackrel{g}{\leftarrow} C_{i+2}$ or $C_i\stackrel{f}{\to}C_{i+1}\stackrel{h}{\to} D\stackrel{h}{\leftarrow}C_{i+1}\stackrel{g}{\leftarrow} C_{i+2}$, with the latter then reducing to $C_i\stackrel{hf}{\to}D\stackrel{hg}{\leftarrow} C_{i+2}$
Zigzags are composed in the obvious way, by concatenating and then composing adjacent arrows pointing in the same direction.  This category is a groupoid, since any zigzag has an inverse obtained by simply reversing the order of the objects and the direction of the arrows.
Once you have verified that composition really is well-defined with respect to the imposed equivalence relation (so this really does define a category), it is entirely straightforward to show this zigzag category has the desired universal property.
Just as an illustration, let me address your concern about adjoining inverses to maps which already have inverses in $\mathcal{A}$.  Suppose $f:A\to B$ and $g:B\to A$ are inverse in $\mathcal{C}$.  Then I claim that in $F\mathcal{A}$, $g$ is equal to the formal inverse of $f$, i.e. the zigzag $B\stackrel{f}{\leftarrow}A$.  Indeed, $B\stackrel{f}{\leftarrow}A$ is equivalent to $B\stackrel{f}{\leftarrow}A\stackrel{g}{\leftarrow} B\stackrel{g}{\to}A$, which reduces to $B\stackrel{1}{\leftarrow} B\stackrel{g}{\to}A$ which then further reduces to $B\stackrel{g}{\to} A$.  So we don't have to worry about adding inverses we already have; the new inverses will be equal to the old inverses.
More generally, you can perform this construction but require the leftward arrows to all lie in some subcategory $W$ of $\mathcal{A}$, and you obtain what is called the "localization" $\mathcal{A}[W^{-1}]$ of $\mathcal{A}$ at $W$.  This construction is used extensively in homotopy theory, where typically $W$ consists of some kind of "(weak) homotopy equivalences" that one wants to formally treat as isomorphisms.
Let me end with a couple remarks.  First, while the description above is fairly complicated, the mere existence of such a left adjoint is easy to prove (it follows easily, for instance, from the adjoint functor theorem).  Second, all of the above is assuming you are talking about small categories; the story becomes more complicated if you are trying to work with large but locally small categories.  The reason is that a priori, there is a large set of zigzags from $A$ to $B$ (since you can choose any objects $C_i$), and so the category $F\mathcal{A}$ may not be locally small.  There is a lot of machinery that has been developed to show that in sufficiently nice cases, localizations are still locally small, and that furthermore any map in the localization can be represented by some very restricted type of zigzag that is easier to work with than the mess above.  Some central concepts in this story are model categories and calculus of fractions.
A: What you are looking for is a particular instance of the notion of localization of a category with respect to a set of morphisms: Given a category ${\mathscr C}$ and a set of morphisms $S\subset\textsf{Mor}({\mathscr C})$, you ask for the inital functor ${\mathscr C}\to{\mathscr D}$ mapping the morphisms in $S$ to isomorphisms. Ignoring set theoretical difficulties, such can be explicitly constructed and is usually denoted ${\mathscr C}\to{\mathscr C}[S^{-1}]$; see e.g. Gelfand-Manin, A course in homological algebra.
As a special case, you may pick $S := \textsf{Mor}({\mathscr C})$, the set of all morphisms. In this case, you can see from the explicit construction of ${\mathscr C}[S^{-1}]$ that it is a groupoid, and from the universal property of the localization it follows that ${\mathscr C}\to{\mathscr C}[S^{-1}]$ is the initial functor from ${\mathscr C}$ into a groupoid. The assignment ${\mathscr C}\mapsto {\mathscr C}[\textsf{Mor}({\mathscr C})^{-1}]$ then extends to the desired left adjoint $\textsf{cat}\to\textsf{grpd}$.
Question Can one see that ${\mathscr C}[\textsf{Mor}({\mathscr C})^{-1}]$ is a groupoid from the universal property alone?
Generalization In the higher-categorical context, groupoids are replaced by spaces and categories by $\infty$-categories, and the generalization of the above  localization is the geometric realization $$\infty\textsf{-cat}\hookrightarrow\textsf{sSet}\stackrel{|\ \cdot\ |}{\longrightarrow}\textsf{Top}.$$
