Simple undirected graph class based on Sedgewick ch. 4.1