Changing LoadGraph routine.

This commit somehow makes reading in the graph much slower, but the
code here looks nicer, so I'm keeping it.