Graph theory is the study of graphs. A graph consists of vertices and edges connecting pairs of vertices; graphs are usually used to represent relationships between vertices. A vertex is a basic element, and an edge connects vertices, so a graph can be represented by its vertices and edges.