A Network Approach to Risk Theory and Portfolio Selection