Return an iterator over the edges.
Edges are returned as tuples with optional data and keys in the order (node, neighbor, key, data).
Parameters : | nbunch : iterable container, optional (default= all nodes)
data : bool, optional (default=False)
keys : bool, optional (default=False)
|
---|---|
Returns : | edge_iter : iterator
|
See also
Notes
Nodes in nbunch that are not in the graph will be (quietly) ignored.
Examples
>>> G = nx.MultiGraph() # or MultiDiGraph
>>> G.add_path([0,1,2,3])
>>> [e for e in G.edges_iter()]
[(0, 1), (1, 2), (2, 3)]
>>> list(G.edges_iter(data=True)) # default data is {} (empty dict)
[(0, 1, {}), (1, 2, {}), (2, 3, {})]
>>> list(G.edges(keys=True)) # default keys are integers
[(0, 1, 0), (1, 2, 0), (2, 3, 0)]
>>> list(G.edges(data=True,keys=True)) # default keys are integers
[(0, 1, 0, {}), (1, 2, 0, {}), (2, 3, 0, {})]
>>> list(G.edges_iter([0,3]))
[(0, 1), (3, 2)]
>>> list(G.edges_iter(0))
[(0, 1)]