Swap two edges in the graph while keeping the node degrees fixed.
A double-edge swap removes two randomly chosen edges u-v and x-y and creates the new edges u-x and v-y:
u--v u v
becomes | |
x--y x y
If either the edge u-x or v-y already exist no swap is performed and another attempt is made to find a suitable edge pair.
Parameters : | G : graph
nswap : integer (optional)
max_tries : integer (optional)
|
---|---|
Returns : | G : graph
|
Notes
Does not enforce any connectivity constraints.
The graph G is modified in place.