---
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", "Milk Factory", "940", "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", "Family Tree", "833", "Hard", false, ["tree"]),
    ]
  }
};

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.

## Tutorial

<resources>
  <resource source="CSA" title="Introduction to Graphs" url="introduction_to_graphs" starred>interactive</resource>
  <resource source="CSA" title="Graph Representations" url="graph_representation" starred>interactive - adjacency lists and matrices</resource>
  <resource source="CPH" title="11 - Basics of Graphs" starred>graph terminology, representation</resource>
  <resource source="IUSACO" title="10.1 to 10.3 - Graph Theory" starred>graph basics and representation, trees</resource>
  <resource source="PAPS" title="6.4 - Graphs">adjacency matrices, lists, maps</resource>
  <resource source="TC" title="Intro to Graphs Section 1" url="introduction-to-graphs-and-their-data-structures-section-1"></resource>
</resources>

## USACO Bronze Problems

(what are you expected to know?)

(add some more)

<problems-list problems={metadata.problems.general} />