Clean up NetworkGraphBuilder

Here I clean up NetworkGraphBuilder, where most of the work for ST_Graph is done. I tried to split up the buildGraph method as much as possible into smaller, easier-to-understand methods.

This is a preliminary step on the way to fixing #27.
Next in line: #28.