  A debt swap is an elementary edge swap in a directed, weighted graph, where
two edges with the same weight swap their targets. Debt swaps are a natural and
appealing operation in financial networks, in which nodes are banks and edges
represent debt contracts. They can improve the clearing payments and the
stability of these networks. However, their algorithmic properties are not
well-understood.
  We analyze the computational complexity of debt swapping in networks with
ranking-based clearing. Our main interest lies in semi-positive swaps, in which
no creditor strictly suffers and at least one strictly profits. These swaps
lead to a Pareto-improvement in the entire network. We consider network
optimization via sequences of $v$-improving debt swaps from which a given bank
$v$ strictly profits. We show that every sequence of semi-positive
$v$-improving swaps has polynomial length. In contrast, for arbitrary
$v$-improving swaps, the problem of reaching a network configuration that
allows no further swaps is PLS-complete. We identify cases in which short
sequences of semi-positive swaps exist even without the $v$-improving property.
  In addition, we study reachability problems, i.e., deciding if a sequence of
swaps exists between given initial and final networks. We identify a
polynomial-time algorithm for arbitrary swaps, show NP-hardness for
semi-positive swaps and even PSPACE-completeness for $v$-improving swaps or
swaps that only maintain a lower bound on the assets of a given bank $v$. A
variety of our results can be extended to arbitrary monotone clearing.
