NetworkX

Previous topic

networkx.DiGraph.nodes_with_selfloops

Next topic

networkx.DiGraph.order

Quick search

networkx.DiGraph.selfloop_edges

DiGraph.selfloop_edges(data=False)

Return a list of selfloop edges

Parameters:

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)]