A graph is a fundamental data structure in computer science consisting of vertices and edges. Vertices represent data points, while edges represent connections between them. Key concepts include adjacent vertices which are directly connected, degree which is the number of connections a vertex has, paths which are sequences of connected vertices, and cycles which are paths that return to the starting vertex.
Graphs can be classified in several ways. Directed graphs have edges with direction, while undirected graphs have bidirectional connections. Weighted graphs assign values to edges representing costs or distances. Connected graphs have paths between all vertices, while disconnected graphs have isolated components. Trees are special connected acyclic graphs, and complete graphs have edges between every pair of vertices.