Note

This documents the development version of NetworkX. Documentation for the current release can be found here.

networkx.DiGraph.reverse

DiGraph.reverse(copy=True)[source]

Returns the reverse of the graph.

The reverse is a graph with the same nodes and edges but with the directions of the edges reversed.

Parameters

copy (bool optional (default=True)) – If True, return a new DiGraph holding the reversed edges. If False, the reverse graph is created using a view of the original graph.