The BuildPackageGraph function, and many related ones, are used only from the test, though it is hard to deduce that (and it looks like production code). The reason is that this package was designed test-first, with instructions for how to productionize it; that has since been done.
We should move it all the test-only code into a _test.go file, for clarity.