Add an undirected graph type.
Return an error from TopoSort instead of panicking.