rustworkx.PyDAG.make_symmetric#
- PyDAG.make_symmetric(edge_payload_fn=None)#
Make edges in graph symmetric
This function iterates over all the edges in the graph, adding for each edge the reversed edge, unless one is already present. Note the edge insertion is not fixed and the edge indices are not guaranteed to be consistent between executions of this method on identical graphs.
- Parameters:
edge_payload (callable) – This optional argument takes in a callable which will be passed a single positional argument the data payload for an edge that will have a reverse copied in the graph. The returned value from this callable will be used as the data payload for the new edge created. If this is not specified then by default the data payload will be copied when the reverse edge is added. If there are parallel edges, then one of the edges (typically the one with the lower index, but this is not a guarantee) will be copied.