def clear(self): """Remove all nodes, edges, and attributes from the graph.""" self.edge_attr.clear() self.node_attr.clear() self.graph_attr.clear() # now "close" existing graph and create a new graph name=gv.agnameof(self.handle) strict=self.strict directed=self.directed gv.agclose(self.handle) self.handle=gv.agraphnew(name,strict,directed)
def close(self): # may be useful to clean up graphviz data # this should completely remove all of the existing graphviz data gv.agclose(self.handle)