Update graph.py

Bug resolved