예제 #1
0
 def __setitem__(self, name, value):
     if not _is_string_like(value):  value=str(value)
     ghandle=gv.agroot(self.handle) # get root graph
     if ghandle==self.handle:
         gv.agattr_label(self.handle,self.type,name,value)
     else:
         gv.agsafeset_label(ghandle,self.handle,name,value,'')
예제 #2
0
 def subgraph_root(self, nbunch=None, name=None):
     """Return root graph of subgraph or None if graph is root graph.
     """
     handle=gv.agroot(self.handle)
     if handle is None: return None
     H=self.__class__(strict=self.strict,
                      directed=self.directed,
                      handle=handle,name=name)
     return H