返回具有自循环的节点上的迭代器。
具有自循环的节点有一条边,其两端与该节点相邻。
具有自循环的节点上的迭代器。
参见
selfloop_edges
number_of_selfloops
实例
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc >>> G.add_edge(1, 1) >>> G.add_edge(1, 2) >>> list(nx.nodes_with_selfloops(G)) [1]