This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.



Reverse the direction of all edges in the graph, in place.

This method modifies the graph instance to reverse the direction of all edges. It does so by iterating over all edges in the graph and removing each edge, then adding a new edge in the opposite direction with the same weight.

For Example:

import rustworkx as rx

graph = rx.PyDiGraph()

# Generate a path directed path graph with weights
    (0, 1, 3),
    (1, 2, 5),
    (2, 3, 2),
# Reverse edges

assert graph.weighted_edge_list() == [(3, 2, 2), (2, 1, 5), (1, 0, 3)];