Added undirected graph algorithm