edge_replace
Signature/Parameters
Replace an existing edge with a new one in a single operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
remove
|
tuple[str, str] or tuple[tuple[str, str], tuple[str, str]] or set[str]
|
Edge specification to be removed. Formats follow the accepted edge types for the graph and support undirected and bidirected symmetry. |
required |
add
|
tuple[str, str] or tuple[tuple[str, str], tuple[str, str]] or set[str]
|
Edge specification to be added after removal. |
required |
Returns:
| Type | Description |
|---|---|
DAG
|
A |
Examples:
>>> G = DAG(graph="X -> Y")
>>> G = G.edge_replace(("X", "Y"), ("X", "Z"))
>>> ("X", "Y") in G.directed, ("X", "Z") in G.directed
(False, True)