def inDegree(self, vertex):
        """
           how many edges coming into this vertex
        """
        nbrs = [n.neighbours.keys() for n in self.v.values()]
        # flatten the nested list
        nbrs = list(itertools.chain(*nbrs))

        return nbrs.count(vertex)

           how many edges coming into this vertex
        
recipes/Python/579141_Simple_Graph_library/recipe-579141.py