def _gen_graph(self, modules, title='Dependency Graph'):
        """
        Invoke graphviz and generate graph
        """
        try:
            graph = Digraph(comment=title, strict=True, format='jpeg')
            logging.debug('Creating graph ..')
        except __HOLE__:
            logging.warning('graphviz module does not support strict graphs, please upgrade python graphviz !!')
            graph = Digraph(comment=title, format='jpeg')
        except:
            logging.error('Failed to create dependency graph !!')
            return None

        for name in modules:
            m = self.modules.get(name, None)
            if m is None:
                continue

            for imp in m.imports:
                graph.node(imp)
                graph.edge(name, imp)
            for inc in m.includes:
                graph.node(inc)
                graph.edge(name, inc)
            for dep in m.depends:
                graph.node(dep)
                graph.edge(dep, name)

        return self._apply_style(graph)
dataset/ETHPy150Open CiscoDevNet/yang-explorer/server/explorer/utils/dygraph.py/DYGraph._gen_graph