Number of components of a disjoint union of spaces Let $(X_i)_{i\in I}$ be a family of nonempty and path-connected topological spaces. I want to show that
$$\pi_0(\bigsqcup_i X_i)\cong I,$$
that is, $\bigsqcup_i X_i$ has $|I|$-many connected components. Here $\bigsqcup_i X_i$ denotes the coproduct of the family $(X_i)$ in the category of topological spaces. If the path components functor $\pi_0\colon \mathrm{Top}\to\mathrm{Set}$ preserves colimits, then here is a short proof:
$$\pi_0(\bigsqcup_i X_i)\cong \bigsqcup_i \pi_0(X_i)\cong \bigsqcup_{i\in I} \{\bullet\}\cong I.$$
For this to work it would be nice to have:
Question 1: Does $\pi_0$ have a right adjoint? Does it at least preserve all colimits (not just of path-connected spaces)?
Question 2: Is it true that $\pi_0(\bigsqcup_i X_i)\cong I$? I think $[(x,i)]\mapsto i$, where $[(x,i)]$ is the path component of $(x,i)\in \bigsqcup_i X_i$, $x\in X_i$, is a bijection, but I'm stuck in the formal verification of that. What needs to be checked is that there is a path from $(x,i)$ to $(y,j)$ if and only if $i=j$ (which intuitively makes sense). Okay, now that I write about it, the "if" part should follow from the path-connectedness of $X_i$ for all $i\in I$. But the "only if" part seems hard.
Is there a more elegant way of proving $\pi_0(\bigsqcup_i X_i)\cong I$ or is that bijection the way to go?
Question 3: What happens if we replace $\pi_0$ by the set of connected components?
Bonus question: Does the connected component functor from directed multigraphs (presheaves on $\bullet \rightrightarrows\bullet$) to sets have a right adjoint?
 A: Q1: No, there isn't. The reason, intuitively speaking, is that not every topological space $X$ is the coproduct of its path-components $X_i,\,i\in I$, but clearly $\pi_0(X)$ is the coproduct of $\pi_0(X_i),\,i\in I$. To turn this into a formal proof, assume $R\colon\mathbf{Set}\rightarrow\mathbf{Top}$ is a right-adjoint. Then we have a sequence of natural isomorphisms
\begin{multline}\mathrm{Hom}_{\mathbf{Top}}(\coprod_iX_i,-)\cong\prod_i\mathrm{Hom}_{\mathbf{Top}}(X_i,R(-))\cong\prod_i\mathrm{Hom}_{\mathbf{Set}}(\pi_0(X_i),-)\\
\cong\mathrm{Hom}_{\mathbf{Set}}(\coprod_i\pi_0(X_i),-)\cong\mathrm{Hom}_{\mathbf{Set}}(\pi_0(X),-)\cong\mathrm{Hom}_{\mathbf{Top}}(X,R(-)).
\end{multline}
The Yoneda lemma then implies $X\cong\coprod_iX_i$, but this is not true in general.
Indeed, here's a concrete example, where we can also observe the failure of $\pi_0$ preserving colimits concretely (it does preserve coproducts, as we see in Q2). Namely, let $X$ be the topologist's sine curve, the union of $\{(x,\sin(1/x))\mid x>0\}$ and $\{0\}\times[-1,1]$, topologized as subset of $\mathbb{R}^2$. This space has two path-components, which are precisely the two sets just given. Note that the space is not the coproduct of these two path-components (in fact, the space is connected). Collapsing the interval $\{0\}\times[-1,1]$ to the point $(0,0)$ yields a quotient homeomorphic to $[0,\infty)$, which is path-connected. Categorically, this is the pushout of the inclusion $\{0\}\times[-1,1]\subseteq X$ and the constant map $\{0\}\times[-1,1]\rightarrow\{\ast\}$. Applying $\pi_0$, this turns into the pushout of the inclusion of a singleton into a two-point set and the identity of that singleton, which remains a two-point set. Hence, that colimit is not preserved.
Q2: This is correct and the map you give is the correct one. An argument has been given by Thomas Andrews in the comments. Alternatively, note that the map $p\colon\coprod_iX_i\rightarrow I,\,(x,i)\mapsto i$ is continuous, where we equip $I$ with the discrete topology. If $\gamma$ is a path in $\coprod_iX_i$, then $p\gamma$ is a path in $I$, hence must be constant, so only points within the same summand of the coproduct can be connected by a path. It is then easy to see that two points in $(x_i,i),(y_i,i)\in X_i\times\{i\}\subseteq\coprod_iX_i$ can be connected by a path (necessarily lying entirely in $X_i\times\{i\}$ by the previous argument) if and only if $x_i$ and $y_i$ can be connected by a path in $X_i$, since $X_i\cong X_i\times\{i\}$. This shows more generally that $\pi_0$ preserves coproducts. As far as I'm concerned, this explicit argument is the way to go about this.
Q3: Not every topological space is the coproduct of its connected components either, e.g. $\mathbb{Q}$ has singletons as connected components, but is not discrete. The same argument as in Q1 shows that the connected components functor does not have a right adjoint. Just like $\pi_0$, it does however preserve coproducts. I don't have an example of a colimit it fails to preserve off the top of my head, but it should be possible to cook up some.
Note however that there is a wishful candidate for a right adjoint to the connected components functor. Namely, the functor equipping every set with the discrete topology. If a topological space is the coproduct of its connected components, continuous functions from it to a discrete space are the same thing as a choice of element from the discrete space for every connected component. Thus the functor has a right adjoint when you restrict it to a nice enough subcategory of $\mathbf{Top}$, e.g. the full one on spaces where every point has a connected neighborhood. Similarly, we could also restrict to the full subcategory on spaces where every point has a path-connected neighborhood. These spaces are the coproducts of their path-components and their connected and path-components coincide, so, with some care, you get the discrete space functor as right adjoint in that case as well (this is also what Thomas Andrews alluded to in his second comment).
A: Partial answer: Note that everything here generalises to connected components and connected spaces if we replace $\pi_0$ with the connected component functor.
To prove that $\pi_0(\coprod\limits_{i \in I} X_i) \cong I$, it suffices to show that for each $i \in I$, $X_i \subseteq \coprod\limits_{i \in I} X_i$ is a maximal connected component.
Recall that each $X_i$ is both open and closed in $\coprod\limits_{i \in I} X_i$.
Clearly, we know that $X_i$ is in fact connected and contains an element $z \in X_i$. And suppose there were some even larger connected set $X_i \subseteq U$. Suppose $U$ contained some $j \in X_j$ for $j \neq i$.
Then define $V = U \setminus X_i$. Then $U = V \cup X_i$, and both $V$ and $X_i$ are inhabited and open. So $U$ is not in fact connected.
Thus, we see that the $X_i$ are precisely the maximal connected components. And there are clearly $I$ of them.
