a lot of changes. fixed random graph generation