Update graph.py

Modified BFT()