Quick implementation of graph class, saved for future use.