Note

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.

rustworkx.PyGraph.to_directed#

PyGraph.to_directed()#

Generate a new PyDiGraph object from this graph

This will create a new PyDiGraph object from this graph. All edges in this graph will result in a bidirectional edge pair in the output graph.

Note

The node indices in the output PyDiGraph may differ if nodes have been removed.

Returns:

A new PyDiGraph object with a bidirectional edge pair for each edge in this graph. Also all node and edge weights/data payloads are copied by reference to the output graph

Return type:

PyDiGraph