C++ implementation of basic graph data structure, connectedness, bfs