algorithms for graphs 320843