def component_graph(self):
        if self._component_graph is None:
            compset = set(all_comps(self))

            g = nx.DiGraph()

            for comp in compset:
                g.add_node(comp, self.node[comp].copy())

            for src, dest in self.list_connections():
                destcomp = dest.split('.', 1)[0]
                srccomp =  src.split('.', 1)[0]

                if srccomp in compset and destcomp in compset:
                    g.add_edge(srccomp, destcomp)

            self._component_graph = g

        return self._component_graph
Return a subgraph containing only Components
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/depgraph.py/DependencyGraph.component_graph