def _remove_vartrees(self, scope):
        vtnodes = [n for n in self if scope.contains(n)
                     and isinstance(scope.get(n), VariableTree)]

        for vt in vtnodes:
            succ = self.successors(vt)
            pred = self.predecessors(vt)

            if '.' in vt:
                # connect subs to parent comp
                cname = vt.split('.', 1)[0]
                if cname in succ:
                    for p in pred:
                        if p != cname and base_var(self, p) == vt:
                            self.add_edge(p, cname)
                elif cname in pred:
                    for s in succ:
                        if s != cname and base_var(self, s) == vt:
                            self.add_edge(cname, s)

        self.remove_nodes_from(vtnodes)
Ensure that document may inherit fields from a superclass document.
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/depgraph.py/DependencyGraph._remove_vartrees--crossover with--dataset/ETHPy150Open MongoEngine/mongoengine/tests/document/inheritance.py/InheritanceTest.test_inheritance_to_mongo_keys