- 1
Graphs are the perfect data structure for modeling networks, which make them an indispensable piece of your data structure toolkit. They’re composed of nodes, or

*vertices*, which hold data, and _… - 2
Graphs have varying degrees of connection. The higher the ratio of edges to vertices, the more connected the graph. This graph represents a social network; people are vertices and edges are friend…

- 3
We’re building a graph of favorite neighborhood destinations (vertices) and routes (edges), but not all edges are equal. It takes longer to travel between […] and […] than it does to trave…

- 4
Imagine you’re a superhero escaping a villain’s lair. As you move from perilous room to perilous room, the doors close immediately behind you, barring any return. For this dramatic example, we n…

- 5
We typically represent the vertex-edge relationship of a graph in two ways: an adjacency list or an adjacency matrix. An adjacency matrix is a spreadsheet. Across the top, every vertex in the gr…

- 6
Graphs are an essential data structure in computer science for modeling networks. Let’s review some key terms:

*[…] : A node in a graph.*[…] : A connection between two vertices. * […] …

- 1
In this lesson, we’ll build a robust implementation of the graph data structure. With just two classes, […] and […] , we can implement a variety of graphs that satisfy the requirements of m…

- 2
Let’s start with our […] class. This class is responsible for storing information about individual vertices in our graph. In our railway network, instances of […] will represent train stat…

- 3
We’ll continue building out the […] class. Remember, it’s responsible for knowing which other vertices are connected. These connections are the edges of our graph implementation. A key in the…

- 4
We’ve built a class to store information and connections between individual vertices, but we need another class that keeps track of the big picture. Our […] class will track

**all**the vert… - 5
We’re keeping things organized by storing our classes in separate files, so let’s do a brief review on how to use code from another file. Python gives us the ability to

*import*code from another … - 6
We’d like our […] class to be able to set edges between the stored vertices. An instance of […] is either directed or undirected, which affects how edges work between two vertices. As a re…

- 7
So far our […] class has stored edges inside of a dictionary with keys of the connected vertex’s name and the value simply set to […] . We can make our implementation support edge weights …

- 8
Our railway has grown to four stations with two connecting tracks. How can we tell a passenger which stations are reachable from Harwick? […] Our […] class needs to determine whether a p…

- 9
Our pathfinding method is almost complete. Let’s take a step back and think how a passenger in Harwick station could find their way to Callan. First, they’d look for all the stations connected to…

- 10
Our pathfinding method works when a path exists, but there is a serious bug!

**We’re not accounting for cycles in our graph.**Consider the following undirected Graph: […] Peel connects to H… - 11
Fantastic work! We’ve implemented a robust graph data structure in Python. Our two classes, […] and […] are capable of representing the typical variations in graphs that occur in many diff…

## What you'll create

Portfolio projects that showcase your new skills

## How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory