Output result

def output(self, options, args, dependencies):
        """Output result
        
        """
        if options.reverse:
            dependencies = map(lambda x: x[::-1], dependencies)
        
        if options.json_file:
            self._output_json(options.json_file, dependencies)
            logger.notify("Dependencies relationships result is in %s now", 
                          options.json_file)
        
        if options.display_graph or options.py_dot or options.py_graphviz:
            import networkx as nx

            # extract name and version
            def convert(pair):
                return (
                    pretty_project_name(pair[0]), 
                    pretty_project_name(pair[1]),
                )
            plain_dependencies = map(convert, dependencies)
            dg = nx.DiGraph()
            dg.add_edges_from(plain_dependencies)
            if options.py_dot:
                logger.notify("Writing dot to %s with Pydot ...", 
                              options.py_dot)
                from networkx.drawing.nx_pydot import write_dot
                write_dot(dg, options.py_dot)
            if options.py_graphviz:
                logger.notify("Writing dot to %s with PyGraphviz ...", 
                              options.py_graphviz)
                from networkx.drawing.nx_agraph import write_dot
                write_dot(dg, options.py_graphviz)
            if options.display_graph:
                import matplotlib.pyplot as plt
                logger.notify("Drawing graph ...")
                if not plain_dependencies:
                    logger.notify("There is no dependency to draw.")
                else:
                    nx.draw(dg)
                    plt.show()