Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.algorithms.operators.unary.reverse

reverse(G, copy=True)[source]

Return the reverse directed graph of G.

Parameters:
  • G (directed graph) – A NetworkX directed graph
  • copy (bool) – If True, then a new graph is returned. If False, then the graph is reversed in place.
Returns:

H – The reversed G.

Return type:

directed graph