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