Added additional functions for undirected graphs.