返回自循环边的数目。
自循环边的两端具有相同的节点。
自体翻转的数量。
参见
nodes_with_selfloops
selfloop_edges
实例
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc >>> G.add_edge(1, 1) >>> G.add_edge(1, 2) >>> nx.number_of_selfloops(G) 1