def plot_dot_graph ( graph , filename = None ) : if not plot . pygraphviz_available : logger . error ( "Pygraphviz is not installed, cannot generate graph plot!" ) return if not plot . PIL_available : logger . error ( "PIL is not installed, cannot display graph plot!" ) return agraph = AGraph ( graph ) agraph . layout ( prog = 'dot' ) if filename is None : filename = tempfile . mktemp ( suffix = ".png" ) agraph . draw ( filename ) image = Image . open ( filename ) image . show ( )
how to make a graph in python without an addon
Plots a graph in graphviz dot notation .
def plot_dot_graph(graph, filename=None):
    """
    Plots a graph in graphviz dot notation.

    :param graph: the dot notation graph
    :type graph: str
    :param filename: the (optional) file to save the generated plot to. The extension determines the file format.
    :type filename: str
    """
    if not plot.pygraphviz_available:
        logger.error("Pygraphviz is not installed, cannot generate graph plot!")
        return
    if not plot.PIL_available:
        logger.error("PIL is not installed, cannot display graph plot!")
        return

    agraph = AGraph(graph)
    agraph.layout(prog='dot')
    if filename is None:
        filename = tempfile.mktemp(suffix=".png")
    agraph.draw(filename)
    image = Image.open(filename)
    image.show()