brb fixing the graph algorithm