Return the outdegree of single node or of nbunch of nodes. If nbunch is omitted or nbunch=None, then return outdegrees of *all* nodes. If with_labels=True, then return a dict that maps each n in nbunch to out_degree(n). Any nodes in nbunch that are not in the graph are (quietly) ignored. Reimplemented from networkx::base::DiGraph. Definition at line 1357 of file xbase.py. 01357 : """Return the outdegree of single node or of nbunch of nodes. If nbunch is omitted or nbunch=None, then return outdegrees of *all* nodes. If with_labels=True, then return a dict that maps each n in nbunch to out_degree(n). Any nodes in nbunch that are not in the graph are (quietly) ignored. """ # prepare nbunch if nbunch is None: # include all nodes via iterator bunch=self.nodes_iter() elif nbunch in self: # if nbunch is a single node bunch=[nbunch] else: # if nbunch is a sequence of nodes try: bunch=[n for n in nbunch if n in self] except TypeError: raise NetworkXError, "nbunch is not a node or a sequence of nodes." # nbunch ready d={} if self.multiedges: for n in bunch: d[n]=sum([len(e) for e in self.succ[n].itervalues()]) + \ sum([len(e) for e in self.pred[n].itervalues()]) else: for n in bunch: d[n]=len(self.succ[n])+len(self.pred[n]) if with_labels: return d # return the dict elif nbunch in self: return d.values()[0] # single node, so single value return d.values() # return a list def nodes_with_selfloops(self):
