graphscope.nx.classes.function.nodes_with_selfloops¶
- graphscope.nx.classes.function.nodes_with_selfloops(G)[源代码]¶
返回一个包含自循环节点的迭代器。
具有自环的节点拥有一条两端均与该节点相邻的边。
- Returns:
nodelist – 包含自循环节点的迭代器。
- Return type:
迭代器
示例
>>> 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]