def view_graph(graph_str, parent=None, prune_to=None):
from rezgui.dialogs.ImageViewerDialog import ImageViewerDialog<EOL>from rez.config import config<EOL>h = hash((graph_str, prune_to))<EOL>filepath = graph_file_lookup.get(h)<EOL>if filepath and not os.path.exists(filepath):<EOL><INDENT>filepath = None<EOL><DEDENT>if filepath is None:<EOL><INDENT>suffix = "<STR_LIT>" % config.dot_image_format<EOL>fd, filepath = tempfile.mkstemp(suffix=suffix, prefix="<STR_LIT>")<EOL>os.close(fd)<EOL>dlg = WriteGraphDialog(graph_str, filepath, parent, prune_to=prune_to)<EOL>if not dlg.write_graph():<EOL><INDENT>return<EOL><DEDENT><DEDENT>graph_file_lookup[h] = filepath<EOL>dlg = ImageViewerDialog(filepath, parent)<EOL>dlg.exec_()<EOL>
View a graph.