code: func (g *Graph) Finalize() (errs errors.MultiError) {
  	if g.finalized {
  		return
  	}
  
  	for _, e := range g.edges {
  		if !e.Parent.Declared() || !e.Child.Declared() {
  			errs = append(errs, &DanglingEdgeError{Edge: e})
  		}
  	}
  
  	g.finalized = len(errs) == 0
  	return
  }
docs: // Finalize finishes the graph construction by verifying there are no "dangling"
  // edges: all edges ever added by AddEdge should connect nodes that were at some
  // point defined by AddNode.
  //
  // Finalizing an already finalized graph is not an error.
  //
  // A finalized graph is immutable (and frozen in Starlark sense): all subsequent
  // calls to AddNode/AddEdge return an error. Conversely, freezing the graph via
  // Freeze() finalizes it, panicking if the finalization fails. Users of Graph
  // are expected to finalize the graph themselves (checking errors) before
  // Starlark tries to freeze it.
  //
  // Once finalized, the graph becomes queryable.