Added missing license and comment to build_reduced_graph
Purge ReducedGraphParent
Remove a bunch of unnecessary .clone()s from build_reduced_graph
Deindent build_reduced_graph in preparation on making the functions free.
Move build_reduced_graph functions to free functions.

Previously, these functions were implemented upon BuildReducedGraphVisitor, which held both a reference to the resolver and
a parent module. However, since all the functions were previously implemented on Resolver, none of them used this extra
parent field, taking explicit parent arguments instead. This is confusing is error-prone, as a function might accidentally
use self.parent instead of parent. While this could have been solved by removing the explicit parent arguments, that
solution would have been either verbose (creating new visitors with new modules to recurse) or dangerous (replacing the
current parent module and remembering to replace the old one when done).