def biggest_root_name()

in uberpoet/dotreader.py [0:0]


    def biggest_root_name(self, dep_map):
        # type: (Dict[str, List[str]]) -> str
        """
        WARNING: Doesn't work currently.  It's a TODO to fix this.
        Finds the root with the most reachable nodes under it inside a DAG.
        The biggest root is probably the app tree.

        With this you don't have to pass in the root node name to self.read_dot_file(...)
        """
        roots = self.find_roots_in_dep_map(dep_map)
        root_name = None
        if len(roots) == 1:
            root_name = roots[0]
        elif len(roots) == 0:
            raise ValueError("Cyclic dependency graph given (len(roots) == 0), aborting")
        else:
            max_size = -1
            for r in roots:
                size = len(self.reachability_set(dep_map, r))
                if size > max_size:
                    root_name, max_size = r, size
        return root_name