In computer science, a graph is a data structure that represents a set of objects (vertices or nodes) connected by links (edges or arcs).
Graphs are used to model pairwise relations between objects. A graph's main components are:
- Vertices (Nodes): The entities in a graph.
- Edges (Links): The connections between the vertices.
Edges can be
directed (indicating a one-way relationship) or
undirected (indicating a two-way relationship).
Graphs are widely used in various computer science domains like social networks, computer networks, and transportation systems, among others.