Return a list of edges.
Edges are returned as tuples with optional data in the order (node, neighbor, data).
Parameters : | nbunch : iterable container, optional (default= all nodes)
data : bool, optional (default=False)
|
---|---|
Returns : | edge_list: list of edge tuples :
|
See also
Notes
Nodes in nbunch that are not in the graph will be (quietly) ignored.
Examples
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_path([0,1,2,3])
>>> G.edges()
[(0, 1), (1, 2), (2, 3)]
>>> G.edges(data=True) # default edge data is {} (empty dictionary)
[(0, 1, {}), (1, 2, {}), (2, 3, {})]
>>> G.edges([0,3])
[(0, 1), (3, 2)]
>>> G.edges(0)
[(0, 1)]