Updated to convert networkx sparse matrices to dense matrices so can be used with numpy arrays