Added support for undirected versus directed graphs.