TITLE: how to compute the homology groups of graphs?
QUESTION [5 upvotes]: how should I compute the homology groups of graphs for example the homology groups of $K5$ ?
is it related to the genus of the graph?

REPLY [3 votes]: A finite graph $G$ is a $1$-complex, so its $H_n$ vanish for $n\ge2$.
If it is connected then $H_0(G,\Bbb Z)\cong\Bbb Z$. Then it is homotopy
equivalent to a bouquet of circles, so $H_1(G,\Bbb Z)\cong\Bbb Z^a$
for some $a$. Its Euler characteristic is $1-a$, and that equals $v-e$
where $v$ and $e$ are the number of vertices and edges, respectively.
For non-connected graphs, you could compute the homology of each component.