def METHOD_NAME(pex):
    # type: (PEX) -> DiGraph
    graph = DiGraph(
        pex.path(),
        fontsize="14",
        labelloc="t",
        label="Dependency graph of {} for interpreter {} ({})".format(
            pex.path(),
            pex.interpreter.binary,
            InterpreterConstraint.exact_version(pex.interpreter),
        ),
    )
    marker_environment = pex.interpreter.identity.env_markers.as_dict()
    marker_environment["extra"] = ""
    present_dists = frozenset(dist.metadata.project_name for dist in pex.resolve())
    for dist in pex.resolve():
        graph.add_node(
            name=dist.project_name,
            label="{name} {version}".format(name=dist.project_name, version=dist.version),
            URL="https://pypi.org/project/{name}/{version}".format(
                name=dist.project_name, version=dist.version
            ),
            target="_blank",
        )
        for req in requires_dists(dist):
            if (
                req.project_name not in present_dists
                and req.marker
                and not req.marker.evaluate(environment=marker_environment)
            ):
                graph.add_node(
                    name=req.name,
                    color="lightgrey",
                    style="filled",
                    tooltip="inactive requirement",
                    URL="https://pypi.org/project/{name}".format(name=req.project_name),
                    target="_blank",
                )
            graph.add_edge(
                start=dist.project_name,
                end=req.name,
                label="{specifier}{marker}".format(
                    specifier=req.specifier if req.specifier else "",
                    marker="; {}".format(req.marker) if req.marker else "",
                )
                if (req.specifier or req.marker)
                else None,
                fontsize="10",
            )
    return graph