Added random graph generation; some fixes