def METHOD_NAME(recipes, config: Dict[str, Any], blacklist: Optional[Skiplist]=None, restrict: bool=True):
    """
    Returns the DAG of recipe paths and a dictionary that maps package names to
    lists of recipe paths to all defined versions of the package.  defined
    versions.
    Parameters
    ----------
    recipes : iterable
        An iterable of recipe paths, typically obtained via `get_recipes()`
    blacklist : set
        Package names to skip
    restrict : bool
        If True, then dependencies will be included in the DAG only if they are
        themselves in `recipes`. Otherwise, include all dependencies of
        `recipes`.
    Returns
    -------
    dag : nx.DiGraph
        Directed graph of packages -- nodes are package names; edges are
        dependencies (both run and build dependencies)
    name2recipe : dict
        Dictionary mapping package names to recipe paths. These recipe path
        values are lists and contain paths to all defined versions.
    """
    logger.info("Generating DAG")
    recipes = list(recipes)
    metadata = list(utils.parallel_iter(utils.load_meta_fast, recipes, "Loading Recipes"))
    # name2recipe is meta.yaml's package:name mapped to the recipe path.
    #
    # A name should map to exactly one recipe. It is possible for multiple
    # names to map to the same recipe, if the package name somehow depends on
    # the environment.
    name2recipe = defaultdict(set)
    for meta, recipe in metadata:
        name = meta["package"]["name"]
        if blacklist is None or not blacklist.is_skiplisted(recipe):
            name2recipe[name].update([recipe])
    def get_deps(meta, sec):
        reqs = meta.get("requirements")
        if not reqs:
            return []
        deps = reqs.get(sec)
        if not deps:
            return []
        return [dep.split()[0] for dep in deps if dep]
    def get_inner_deps(dependencies):
        dependencies = list(dependencies)
        for dep in dependencies:
            if dep in name2recipe or not restrict:
                yield dep
    dag = nx.DiGraph()
    dag.add_nodes_from(meta["package"]["name"]
                       for meta, recipe in metadata)
    for meta, recipe in metadata:
        name = meta["package"]["name"]
        dag.add_edges_from(
            (dep, name)
            for dep in set(chain(
                get_inner_deps(get_deps(meta, "build")),
                get_inner_deps(get_deps(meta, "host")),
                get_inner_deps(get_deps(meta, "run")),
            ))
        )
    return dag, name2recipe