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.
Think of a social network where each person is represented by a node, and the friendships between them are represented by edges. Just like how you can see who is friends with whom on a social network, graphs allow us to visualize and analyze relationships between different entities.
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.
Study guides for the entire semester
200k practice questions
Glossary of 50k key terms - memorize important vocab
© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.