networkx.DiGraph.nodes_with_selfloops
networkx.DiGraph.order
Return a list of selfloop edges
data : bool
Return two tuples (u,v) (False) or three-tuples (u,v,data) (True)
Examples
>>> G=nx.Graph() >>> G.add_edge(1,1) >>> G.add_edge(1,2) >>> G.selfloop_edges() [(1, 1)] >>> G.selfloop_edges(data=True) [(1, 1, 1)]