

def nodes_with_selfloops(self):
    'Return a list of nodes with self loops.\n\n        A node with a self loop has an edge with both ends adjacent\n        to that node.\n\n        Returns\n        -------\n        nodelist : list\n            A list of nodes with self loops.\n\n        See Also\n        --------\n        selfloop_edges, number_of_selfloops\n\n        Examples\n        --------\n        >>> G = nx.Graph()   # or DiGraph, MultiGraph, MultiDiGraph, etc\n        >>> G.add_edge(1,1)\n        >>> G.add_edge(1,2)\n        >>> list(G.nodes_with_selfloops())\n        [1]\n        '
    return [n for (n, nbrs) in self.adj.items() if (n in nbrs)]

dataset/ETHPy150Open networkx/networkx/networkx/classes/tests/timingclasses.py TimingGraph.nodes_with_selfloops/original