How to construct colimits in the category of diagrams in $\mathbf{Sets}$ Let $\mathbf{DSets}$ be the category with


*

*Functors $F\colon \mathbf{C} \to \mathbf{Sets}$ as objects, where $\mathbf{C}$ is a category,

*Pairs $(L,\lambda)$ as morphisms between objects $F \colon \mathbf{C} \to \mathbf{Sets}$ and $F' \colon \mathbf{C'} \to \mathbf{Sets}$, where $L$ is a functor from $\mathbf{C}$ to $\mathbf{C'}$, and $\lambda$ is a natural transformation from $F$ to $F'L$.


I've been informed that $\mathbf{DSets}$ is cocomplete, and I'm trying to understand how colimits are built. Consider the small example below.


*

*Let $\mathbf{C}$ be the category with two objects $X$ and $Y$ and only one non-trivial morphism $f$ between them.

*Let $F\colon \mathbf{C} \to \mathbf{Sets}$ be the functor such that $F(X) = \{a,b\}$, $F(Y)=\{c,d,e\}$, $F(f)(a)=c$, and $F(f)(b)=d$.

*Let $F'\colon \mathbf{C} \to \mathbf{Sets}$ be the functor such that $F'(X) = \{p,q,r\}$, $F(Y)=\{u,v\}$, $F(f)(p)=u$, $F(f)(q)=v$, and $F(f)(r)=v$.
Let $T$ be the terminal object of $\mathbf{DSets}$, and let


*

*$(L,\lambda)$ be the morphism from $T$ to $F$ such that the single object of $T$ is sent to $Y$, and the singleton is sent to $c$, and

*$(L',\lambda')$ be the morphism from $T$ to $F'$ such that the single object of $T$ is sent to $X$, and the singleton is sent to $r$.


What would be the pushout $R \colon \mathbf{C''} \to \mathbf{Sets}$ of the diagram $F \leftarrow T \rightarrow F'$ ? What I have so far: 


*

*$\mathbf{C''}$ is the category with three objects $X'$, $Y'$ and $Z'$ and three non-trivial morphisms $X' \to Y'$, $Y' \to Z'$, $X' \to Z'$. It comes from amalgamating $Y$ and $X$ in $\mathbf{C}$ and $\mathbf{C'}$.

*$R(X')$ is a two-element set $\{a',b'\}$, $R(Z')$ is a two-element set $\{u',v'\}$, and $R(Y')$ is a five-element set $\{c|r,d',e',p',q'\}$ which is the amalgamated coproduct of $F(Y)$ and $F'(X)$,

*$R(X' \to Y')$ sends $a'$ and $b'$ to $c|r$ and $d'$ respectively, and $R(Y' \to Z')$ sends $c|r$, $q'$ and $p'$ to $v$, $v$, and $u$ respectively.


To finish the construction of this colimit, I should identify the images of $d'$ and $e'$ by $R(Y' \to Z')$, but this is where I'm confused because I don't see how I should pick them, and the definition of colimits is not helping me.
Rather than giving the solution directly, I would appreciate any hint to find it myself.
 A: $\mathbf{DSets}$ admits a canonical forgetful functor $\pi$ to the category $\mathbf{Cat}$ of small categories. Given a diagram $D:J\to \mathbf{DSets}$, its colimit is a diagram indexed by the colimit, call in $\mathbf{C}_D$, of $\pi\circ D$. To construct it, we first construct a diagram $D':J\to [\mathbf{C}_D,\mathbf{Set}]$ via the left Kan extension along the legs $\pi(D(j))\to \mathbf{C}_D$ of the cocone defining $\mathbf{C}_D$. Then $\mathrm{colim} D=\mathrm{colim} D'$. 
For instance, in your example we have $J=\bullet\leftarrow\bullet\to \bullet$ and $\pi \circ D =(X\to Y)\leftarrow Y \to (Y\to Z)$, while $\mathrm{colim}\pi\circ D= X\to Y\to Z$. The left Kan extension along the inclusion $(X\to Y)\to (X\to Y\to Z)$ sends a functor $F=S\to T$, where $S=F(X)$ and $T=F(Y)$, to the functor $S\to T\to T$. The left Kan extension along $Y\to (X\to Y\to Z)$ sends $S$ to the functor $0\to S\to S$, and the left Kan extension along $(Y\to Z)\to (X\to Y\to Z)$ sends $S\to T$ to $0\to S\to T$. 
Now, suppose $D$ is any diagram mapping to $\pi\circ D$, rather than your specific example. Let the value of $D$ over $X\to Y$ be $A\to B$, the value over $Y$ alone be $C$ and the value over $Y\to Z$ be $D\to E$. Then to give $D$ as a whole is just to give functions $C\to B$ and $C\to D$. Now, $D'$ becomes the diagram in $[X\to Y\to Z,\mathbf{Set}]$ given by $(A\to B\to B)\leftarrow (0\to C\to C)\to (0\to D\to E)$, whose pushout is given by $A\to B\sqcup_C D\to B\sqcup_C E$. 
The background to this possibly elaborate-looking construction is that the forgetful functor $\mathbf{DSets}\to \mathbf{Cat}$ is a Grothendieck opfibration via the left Kan extension functors, and such a construction always makes the total category of a Grothendieck opfibration cocomplete if the base and the fibers are, assuming the transition functors are cocontinuous.
