Added comments to describe graph-building algorithm at a basic level