예제 #1
0
파일: tree.py 프로젝트: thiagoki/Tdevel
 def add_node(self, n):
     if n in self:
         return  # already in tree
     elif len(self.adj) == 0:
         Graph.add_node(self, n)  # first node
     else:  # not allowed
         raise NetworkXError(\
             "adding single node %s not allowed in non-empty tree"%(n))
예제 #2
0
 def add_node(self, n):
     if n in self:
         return # already in tree
     elif len(self.adj)==0:
         Graph.add_node(self,n) # first node
     else:  # not allowed
         raise NetworkXError(\
             "adding single node %s not allowed in non-empty tree"%(n))
예제 #3
0
파일: tree.py 프로젝트: thiagoki/Tdevel
 def add_node(self, n):
     Graph.add_node(self, n)
     # this is not called from add_edge so we must assign
     # and component (else that is assigned in add_edge)
     self.comp[n] = self.nc
     self.nc += 1
예제 #4
0
 def add_node(self, n):
     Graph.add_node(self,n)
     # this is not called from add_edge so we must assign
     # and component (else that is assigned in add_edge)
     self.comp[n]=self.nc
     self.nc+=1