Graphs, Surfaces and Homology