Drawing Utilities

Utilities for drawing Neet objects and graph representations.

neet.draw.view_pygraphviz(G, edgelabel=None, prog='dot', args='', suffix='', path=None, display_image=True)[source]

Views the graph G using the specified layout algorithm.

This is a modified version of view_pyagraphviz from networkx.drawing.nx_agraph to allow display toggle.

Original copyright:

Copyright (C) 2004-2019 by
    Aric Hagberg <hagberg@lanl.gov>
    Dan Schult <dschult@colgate.edu>
    Pieter Swart <swart@lanl.gov>
All rights reserved. BSD license.
Author: Aric Hagberg (hagberg@lanl.gov)
Parameters:
  • G (networkx.Graph or networkx.DiGraph) – the graph to draw
  • edgelabel (str, callable or None) – If a string, then it specifes the edge attribute to be displayed on the edge labels. If a callable, then it is called for each edge and it should return the string to be displayed on the edges. The function signature of edgelabel should be edgelabel(data), where data is the edge attribute dictionary.
  • prog (str) – Name of Graphviz layout program.
  • args (str) – Additional arguments to pass to the Graphviz layout program.
  • suffix (str) – If filename is None, we save to a temporary file. The value of suffix will appear at the tail end of the temporary filename.
  • path (str or None) – The filename used to save the image. If None, save to a temporary file. File formats are the same as those from pygraphviz.agraph.draw.
Returns:

the filename of the generated image, and a PyGraphviz graph instance

Note

If this function is called in succession too quickly, sometimes the image is not displayed. So you might consider time.sleep(.5) between calls if you experience problems.