DiGraph.in_edges#

property DiGraph.in_edges#

A view of the in edges of the graph as G.in_edges or G.in_edges().

in_edges(self, nbunch=None, data=False, default=None):

Parameters:
nbunchsingle node, container, or all nodes (default= all nodes)

The view will only report edges incident to these nodes.

datastring or bool, optional (default=False)

The edge attribute returned in 3-tuple (u, v, ddict[data]). If True, return edge attribute dict in 3-tuple (u, v, ddict). If False, return 2-tuple (u, v).

defaultvalue, optional (default=None)

Value used for edges that don’t have the requested attribute. Only relevant if data is not True or False.

Returns:
in_edgesInEdgeView or InEdgeDataView

A view of edge attributes, usually it iterates over (u, v) or (u, v, d) tuples of edges, but can also be used for attribute lookup as edges[u, v]['foo'].

See also

edges

Examples

>>> G = nx.DiGraph()
>>> G.add_edge(1, 2, color='blue')
>>> G.in_edges()
InEdgeView([(1, 2)])
>>> G.in_edges(nbunch=2)
InEdgeDataView([(1, 2)])