Renamed some stuff. Also added a routine to convert graphs from one type to another. How should this be done for matrices? Could be a problem if val array has to be rearranged.