Segment graphs, depth-first cycle bases, 3-connectivity, and planarity of graphs