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))
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))
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
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