Add a bunch of component related functionality.
TODO: use undirected edges, since components expect it.
Also maybe make subclasses DirectedGraph and Tree