Example #1
0
 def __str__(self):
     # print the name of the graph, see string() for dot representation
     name=gv.agnameof(self.handle)
     if name is None:
         return ""
     else:
         return name
Example #2
0
 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) 
Example #3
0
 def __new__(self,graph,name=None,nh=None):
     if nh is not None:
         n=str.__new__(self,gv.agnameof(nh))
     else:
         n=str.__new__(self,name)
         try:
             nh=gv.agnode(graph.handle,n,_Action.find)
         except KeyError:
             raise KeyError("Node %s not in graph."%n)
         
     n.ghandle=graph.handle
     n.attr=ItemAttribute(nh,1)
     n.handle=nh
     return n
Example #4
0
 def get_name(self):
     return gv.agnameof(self.handle)