Return a list of selfloop edges.
A selfloop edge has the same node at both ends.
Parameters: | data : bool, optional (default=False)
keys : bool, optional (default=False)
|
---|---|
Returns: | edgelist : list of edge tuples
|
See also
selfloop_nodes, number_of_selfloops
Examples
>>> G = nx.MultiGraph() # or MultiDiGraph
>>> G.add_edge(1,1)
>>> G.add_edge(1,2)
>>> G.selfloop_edges()
[(1, 1)]
>>> G.selfloop_edges(data=True)
[(1, 1, {})]
>>> G.selfloop_edges(keys=True)
[(1, 1, 0)]
>>> G.selfloop_edges(keys=True, data=True)
[(1, 1, 0, {})]