Written by the Fiveable Content Team โข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโขWritten by the Fiveable Content Team โข Last updated September 2025
Definition
Graphs are data structures that consist of nodes (vertices) and edges, where the edges represent relationships between the nodes. They are used to model connections or relationships between different entities.
Related terms
Adjacency Matrix: A way to represent a graph using a matrix where each cell represents whether there is an edge between two nodes.
Depth-First Search (DFS): An algorithm that explores as far as possible along each branch before backtracking in a graph.
Breadth-First Search (BFS): An algorithm that explores all the vertices of a graph in breadth-first order, i.e., it visits all the neighbors before moving on to their neighbors.