def in_degree_iter(self, nbunch=None, weight=None):
        if nbunch is None:
            nodes_nbrs=self.pred.items()
        else:
            nodes_nbrs=((n,self.pred[n]) for n in self.nbunch_iter(nbunch))

        if weight is None:
            for n,nbrs in nodes_nbrs:
                yield (n, sum([len(data) for data in nbrs.values()]) )
        else:
            # edge weighted graph - degree is sum of nbr edge weights
            for n,pred in nodes_nbrs:
                deg = sum([d.get(weight,1)
                           for data in pred.values()
                           for d in data.values()])
                yield (n, deg)
Return an iterator for (node, in-degree).
dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/classes/multidigraph.py/MultiDiGraph.in_degree_iter