Theory emphasizes the central role of the structure of networks in the behavior of financial systems and their response to policy. Real-world networks, however, are rarely directly observable: Banks’ assets and liabilities are typically known, but not who is lending how much and to whom. We first show how to simulate realistic networks that are based on balance-sheet information by minimizing costs where there is a fixed cost to forming a link. Second, we also show how to do this for a model with fixed costs that are decreasing in the number of links. To approach the optimization problem, we develop a new algorithm based on the transportation planning literature. Computational experiments find that the resulting networks are not only consistent with the balance sheets, but also resemble real-world financial networks in their density (which is sparse but not minimally dense) and in their core-periphery and disassortative structure.