Some code for generating networks in Matlab