NetworkX

Previous topic

networkx.Graph.nodes_with_selfloops

Next topic

networkx.Graph.order

Quick search

networkx.Graph.selfloop_edges

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