modified the script to generate a random graph