For a graph $(G, V)$, $\# \text{edges}$ is given by the rank of $H_1(G, V)$.

Solution 1:

The pair $(G,V)$ is what is called a nice pair of spaces, meaning that there is a neighborhood of $V$ in $G$, which deformation retracts onto $V$ (for example, you can take this neighborhood to be $G$ with all the midpoints of the edges removed). It is then a theorem in algebraic topology, that if $(X,A)$ is a nice pair of spaces, the canonical projection induces isomorphisms $H_i(X,A)\rightarrow H_i(X/A,A/A)$ for all $i\ge0$. Specializing to our case, $G/V$ as a topological space is homeomorphic to a wedge of circles, one circle for each edge of $G$, and $V/V$ corresponds to the wedge point. I recommend understanding this visually. How to construct a formal argument depends on how you have formalized the condition that $G$ is a graph. If, say, a graph is a one-dimensional CW-complex, this can be argued using the canonical quotient map. Now, $H_1(\bigvee_{\text{edges}}S^1,\ast)$, where $\ast$ is the wedge point, is free abelian on the 1-simplices representing each circle. Together, this tells us that $H_1(G,V)$ is free abelian on the 1-simplices representing each edge of $G$. In particular, this group has rank equaling the number of edges of $G$.

Alternatively, you could try proving this inductively using the Mayer-Vietoris sequence for pairs of spaces. The case in which there are no edges is trivial, as $H_1(V,V)=0$. If the theorem has been proven for graphs with $n$ edges, assume $(G,V)$ is a graph with $n+1$ edges. Choose an edge $\overline{e}\subseteq G$ (this is the closed edge, i.e. it should contain the endpoints) and think of $G$ as a CW-complex. Decompose the pair $(G,V)$ into the pairs $(\overline{e},V\cap\overline{e})$ and $(G\setminus e,V\setminus(V\cap e))$. This is a decomposition into subcomplexes, so we get a Mayer-Vietoris sequence. Since $\overline{e}\cap G\setminus e=V\cap\overline{e}\cap V\setminus(V\cap e)$, the homology of the pair of intersections vanishes, so we obtain an isomorphism $H_1(\overline{e},V\cap\overline{e})\oplus H_1(G\setminus e,V\setminus(V\cap e))\rightarrow H_1(G,V)$. The former group is free on the 1-simplex representing the edge $\overline{e}$ (use the LES of the pair), the latter group is free on the edges of $G\setminus e$, which are all edges of $G$ except $e$, by hypothesis. Since the isomorphism is induced by inclusions, this proves that $H_1(G,V)$ is free on the edges of $G$. This induction proves the claim for all finite graphs $(G,V)$. The first argument did not require $G$ to be finite, so this seems less general, but what we have already proven for finite graphs suffices to get the claim for infinite $G$ as well using a limiting argument, but I'll leave it at this.