---
id: intro-graphs
title: Introduction to Graphs
author: Darren Yao, Benjamin Qi
description: "?"
frequency: 2
---
import { Problem } from "../models";
export const metadata = {
problems: {
general: [
new Problem("Silver", "Grass Planting", "894", "Normal", false, ["tree"]),
new Problem("Bronze", "The Great Revegetation", "916", "Hard", false, []),
new Problem("Bronze", "Livestock Lineup", "965", "Hard", false, []),
new Problem("Bronze", "Milk Factory", "940", "Hard", false, ["tree"]),
new Problem("Bronze", "Family Tree", "833", "Hard", false, ["tree"]),
new Problem("Bronze", "Swapity Swap", "1013", "Hard", false, ["permutation"], "Hint: One option is to keep swapping until the permutation returns to its original state (but can you do better?)."),
new Problem("Bronze", "Cow Evolution", "941", "Hard", false, [], ""),
]
}
};
Graphs can be used to represent many things, from images to wireless signals, but one of the simplest analogies is to a map. Consider a map with several cities and bidirectional roads connecting the cities. Some problems relating to graphs are:
- Is city $A$ connected to city $B$? Consider a region to be a group of cities such that each city in the group can reach any other city in said group, but no other cities. How many regions are in this map, and which cities are in which region?
- What's the shortest distance I have to travel to get from city $A$ to city $B$?
Both of these tasks will be covered in higher divisions. For now, it suffices to learn how graphs are represented.
interactive
interactive - adjacency lists and matrices
graph terminology, representation
graph basics and representation, trees
adjacency matrices, lists, maps
## Problems
(short recap of what you should know for bronze)