algorithms for graphs 2787892