networkx.classes.graphviews.reverse_view¶
-
reverse_view
(G)[source]¶ View of
G
with edge directions reversedreverse_view
returns a read-only view of the input graph where edge directions are reversed.Identical to digraph.reverse(copy=False)
- Parameters
G (networkx.DiGraph)
- Returns
graph
- Return type
Examples
>>> import networkx as nx >>> G = nx.DiGraph() >>> G.add_edge(1, 2) >>> G.add_edge(2, 3) >>> G.edges() OutEdgeView([(1, 2), (2, 3)])
>>> view = nx.reverse_view(G) >>> view.edges() OutEdgeView([(2, 1), (3, 2)])