Update of Graph Algorithm