The recent crisis has highlighted the crucial role that existing linkages among banks and financial institutions plays in channeling and amplifying shocks hitting the system. The structure and evolution of such web of linkages can be fruitfully characterized using concepts borrowed from the theory of (complex) networks. This paper critically surveys recent theoretical work that exploits this concept to explain the sources of contagion and systemic risk in financial markets. We taxonomize existing contributions according to the impact of network connectivity, bank heterogeneity, existing uncertainty in financial markets, portfolio composition of the banks. We end with a discussion of the most important challenges faced by theoretical network-based models of systemic risk. These include a better understanding of the causal links between network structure and the likelihood of systemic risk and increasingly using the empirical knowledge about real-world financial-network structures to calibrate theoretical models.