def add_test_edges_1(self, manifest: Manifest) -> None:
        """This method adds additional edges to the DAG. For a given non-test
        executable node, add an edge from an upstream test to the given node if
        the set of nodes the test depends on is a subset of the upstream nodes
        for the given node."""

        # HISTORICAL NOTE: To understand the motivation behind this function,
        # consider a node A with tests and a node B which depends (either directly
        # or indirectly) on A. It would be nice if B were not executed until
        # all of the tests on A are finished. After all, we don't want to
        # propagate bad data. We can enforce that behavior by adding new
        # dependencies (edges) from tests to nodes that should wait on them.
        #
        # This function implements a rough approximation of the behavior just
        # described. In fact, for tests that only depend on a single node, it
        # always works.
        #
        # Things get trickier for tests that depend on multiple nodes. In that
        # case, if we are not careful, we will introduce cycles. That seems to
        # be the reason this function adds dependencies from a downstream node to
        # an upstream test if and only if the downstream node is already a
        # descendant of all the nodes the upstream test depends on. By following
        # that rule, it never makes the node dependent on new upstream nodes other
        # than the tests themselves, and no cycles will be created.
        #
        # One drawback (Drawback 1) of the approach taken in this function is
        # that it could still allow a downstream node to proceed before all
        # testing is done on its ancestors, if it happens to have ancestors that
        # are not also ancestors of a test with multiple dependencies.
        #
        # Another drawback (Drawback 2) is that the approach below adds far more
        # edges than are strictly needed. After all, if we have A -> B -> C,
        # there is no need to add a new edge A -> C. But this function often does.
        #
        # Drawback 2 is resolved in the new add_test_edges_2() implementation
        # below, which is also typically much faster. Drawback 1 has been left in
        # place in order to conservatively retain existing behavior, and so that
        # the new implementation can be verified against this existing
        # implementation by ensuring both resulting graphs have the same transitive
        # reduction.

        # MOTIVATING IDEA: Given a graph...
        #
        # model1 --> model2 --> model3
        #   |             |
        #   |            \/
        #  \/          test 2
        # test1
        #
        # ...produce the following...
        #
        # model1 --> model2 --> model3
        #   |       /\    |      /\ /\
        #   |       |    \/      |  |
        #  \/       |  test2 ----|  |
        # test1 ----|---------------|

        for node_id in self.graph:
            # If node is executable (in manifest.nodes) and does _not_
            # represent a test, continue.
            if (
                node_id in manifest.nodes
                and manifest.nodes[node_id].resource_type != NodeType.Test
            ):
                # Get *everything* upstream of the node
                all_upstream_nodes = nx.traversal.bfs_tree(self.graph, node_id, reverse=True)
                # Get the set of upstream nodes not including the current node.
                upstream_nodes = set([n for n in all_upstream_nodes if n != node_id])

                # Get all tests that depend on any upstream nodes.
                upstream_tests = []
                for upstream_node in upstream_nodes:
                    # This gets tests with unique_ids starting with "test."
                    upstream_tests += _get_tests_for_node(manifest, upstream_node)

                for upstream_test in upstream_tests:
                    # Get the set of all nodes that the test depends on
                    # including the upstream_node itself. This is necessary
                    # because tests can depend on multiple nodes (ex:
                    # relationship tests). Test nodes do not distinguish
                    # between what node the test is "testing" and what
                    # node(s) it depends on.
                    test_depends_on = set(manifest.nodes[upstream_test].depends_on_nodes)

                    # If the set of nodes that an upstream test depends on
                    # is a subset of all upstream nodes of the current node,
                    # add an edge from the upstream test to the current node.
                    if test_depends_on.issubset(upstream_nodes):
                        self.graph.add_edge(upstream_test, node_id, edge_type="parent_test")
This method adds additional edges to the DAG. For a given non-test
        executable node, add an edge from an upstream test to the given node if
        the set of nodes the test depends on is a subset of the upstream nodes
        for the given node.
core/dbt/compilation.py