def _get_feature_depths(self, features):
        """
        Generate and return a mapping of {feature name -> depth} in the
        feature DAG for the given dataframe.
        """
        order = defaultdict(int)
        depths = {}
        queue = features[:]
        while queue:
            # Get the next feature.
            f = queue.pop(0)

            depths[f.unique_name()] = order[f.unique_name()]

            # Only look at dependencies if they are on the same dataframe.
            if not f.relationship_path:
                dependencies = f.get_dependencies()
                for dep in dependencies:
                    order[dep.unique_name()] = min(
                        order[f.unique_name()] - 1,
                        order[dep.unique_name()],
                    )
                    queue.append(dep)

        return depths

        Generate and return a mapping of {feature name -> depth} in the
        feature DAG for the given dataframe.
        
featuretools/computational_backends/feature_set.py