Homology of a graph - Weibel's Introduction to Homological Algebra exercise 1.1.6. The following is a question from Charles A. Weibel's An Introduction to Homological Algebra:

Exercise 1.1.6. Let $\Gamma$ be a finite graph with $V$ vertices $(v_1, \ldots, v_V)$ and $E$ edges $(e_1, \ldots, e_E)$. If we orient the edges, we can form the indcidence matrix of the graph. This is a $V \times E$ matrix whose $(ij)$ entry is $+1$ if the edge $e_j$ starts at $v_i$, $-1$ if the edge  ends at $v_i$, and $0$ otherwise.
Let $C_0$ be the free $R$-module on the vertices, $C_1$ the free $R$-module on the edges, $C_n=0$ if $n\ne 0,1$, and $d: C_1\rightarrow C_0$ be the incidence matrix.
If $\Gamma$ is connected, show that $H_0(C)$ and $H_1(C)$ are free $R$-modules of dimensions $1$ and $V-E-1$ respectively.

I was able to do the first one and the last one seems to be incorrect. For example, this link asserts that the number must be $E - V + 1$.
The answer in the link solves it assuming that the module is free a priori and then compute the rank. The comment then says that one can solve it for $R = \Bbb Z$ and use something called as the Universal Coefficients Theorem. Since this is an earlier part in the book, I feel like there should be something simple. (I also don't know the Theorem, so I wish to see a different solution anyway.)

My work.
For $H_1$, the relevant part of the sequence is $$0 \to C_1 \xrightarrow{d} C_0.$$
Thus, we simply need to compute $\ker(d)$.
One can also note that $d$ is essentially acting as the "boundary map", i.e., given any edge $e$, we have $d(e) = v_i - v_j$, where $v_i$ is the starting point of $e$ and $v_j$ the ending point.
Thus, there are some obvious elements in the kernel: namely, all cycles. I have a hunch that the cycles will form a basis. At least, the number matches for some simple cases like the ones below.

However, it not clear to me why there would be $E + 1 - V$ many cycles.
 A: Here is a complete solution based on @Leo's hint. Choose a spanning tree, say it is the subgraph $T=\Gamma(e_1,...,e_{V-1})$ (since $\Gamma$ is connected, a spanning tree exists and has precisely $V-1$ edges.)
For an edge $e_i$ outside $T$, the graph $T\cup \{e_i\}$ has a unique cycle $c_i=e+\sum_{j=1}^{V-1}\mu_je_j$ where the coefficients $\mu_j\in \{\pm 1, 0\}$ are chosen to orient the edges appropriately so that $d(c_i)=0$. Then $\{e_1,...,e_{V-1}, c_V,...,c_E\}$ is a basis for $R^E$.
Now for $2\leq i \leq V$ there is a unique $v_1\to v_i$ path in $T$, this has form $p_i=\sum_{j=1}^{V-1}\mu_je_j$ where $\mu_j\in\{\pm 1, 0\}$ are coefficients to orient the edges so that $d(p_i) = v_i-v_1$. It should be immediate that $\{p_2,...,p_V\}$ is a basis for the submodule $\langle e_1,...,e_{V-1}\rangle \subset R^E$.
Thus we have $R^E \cong \langle p_2,...,p_V\rangle \oplus \langle c_V,...,c_E \rangle \cong R^{V-1}\oplus R^{E-V+1}$. Ít is immediate that $d:\langle p_2,...,p_V\rangle \rightarrow \langle v_2-v_1,...,v_V-v_1 \rangle$ is an isomorphism, and hence the first homology is $\ker d\cong \langle c_V,...,c_E\rangle \cong R^{E-V+1}$ as required.
