This course has been updated into a 4 part series! We now recommend you take the A Practical Guide to Algorithms with JavaScript course.

Check out a free preview of the full Data Structures and Algorithms in JavaScript course:
The "Exercise: Implement a Graph" Lesson is part of the full, Data Structures and Algorithms in JavaScript course featured in this preview video. Here's what you'd learn in this lesson:

In this exercise, you will implement the entire Graph class except for any removal or traversing methods.

Get Unlimited Access Now

Transcript from the "Exercise: Implement a Graph" Lesson

>> Bianca Gandolfo: Exercise time. We are going to implement a graph, so let's go into this really quick, and I'll tell you which ones.
>> Bianca Gandolfo: So let's see.
>> Bianca Gandolfo: Blah, blah, blah.
>> Bianca Gandolfo: Let's do addNode. Let's do addNode, contains, and addEdge.
>> Bianca Gandolfo: So do everything except for removals and traversing.

>> Bianca Gandolfo: So we want to check for edges, addEdges, and no looping. So no for each. So hasEdge, addEdge, contains, addNode. Does that make sense? No traversing, no removal.