Graph Theory Python