algorithms for graphs 5543417