code: func (cgs *credentialGraphSet) Prune() ([]registry.CredentialGraph, error) {
  	pruned := make([]registry.CredentialGraph, 0, len(cgs.graphs))
  
  	for _, graphs := range cgs.graphs {
  
  		// parents is the slice of IDs already seen in Previous fields.
  		// they cannot be active as they have been overwritten.
  		var parents []identity.ID
  
  		sort.Sort(graphSorter(graphs))
  		for _, graph := range graphs {
  			var activeCreds []envelope.CredentialInf
  			var err error
  			activeCreds, parents, err = cgs.activeCreds(parents, graph)
  			if err != nil {
  				return nil, err
  			}
  
  			if len(activeCreds) > 0 {
  				switch g := graph.(type) {
  				case *registry.CredentialGraphV1:
  					g.Credentials = activeCreds
  				case *registry.CredentialGraphV2:
  					g.Credentials = activeCreds
  				default:
  					return nil, errUnknownKeyringVersion
  				}
  
  				pruned = append(pruned, graph)
  			}
  		}
  	}
  
  	return pruned, nil
  }
docs: // Prune returns a slice of CredentialGraphs that contain credentials that
  // are still reachable. Each returned CredentialGraph contains *only* those
  // Credentials that are reachable, unlike Active, which returns all Credentials
  // within the CredentialGraph.