templates of graph theory algorithms