pub fn root_packages<'a>(
        &'a self,
        direction: DependencyDirection,
    ) -> impl Iterator<Item = PackageMetadata<'g>> + ExactSizeIterator + 'a {
        let package_graph = self.graph;
        self.core
            .roots(self.graph.dep_graph(), self.graph.sccs(), direction)
            .into_iter()
            .map(move |package_ix| {
                package_graph
                    .metadata(&package_graph.dep_graph[package_ix])
                    .expect("invalid node index")
            })
    }
Returns the set of "root package" metadatas in the specified direction.

* If direction is Forward, return the set of packages that do not have any dependencies
within the selected graph.
* If direction is Reverse, return the set of packages that do not have any dependents within
the selected graph.

## Cycles

If a root consists of a dependency cycle, all the packages in it will be returned in
non-dev order (when the direction is forward).
guppy/src/graph/resolve.rs