added algo for graph
algo imporve