‫So now we're going to create our remove edge function.
‫And as the name would imply, it's just going to remove the connection between two vertices.
‫In the adjacency list it will look like this.
‫So I'm going to move this down and bring that edge back because we haven't removed it yet and start
‫our code like this and we'll pass it to vertices vertex one and vertex two.
‫And we'll say adjacency list at Vertex one.
‫And when we do this, it's going to return the value and the key value pair and the value is going to
‫be this unordered set.
‫And when we return that we can use the member functions on unordered sets and we can say erase vertex
‫two and it removes Vertex two from that unordered set.
‫And then we can do it the other way and remove vertex one like this.
‫And of course, we can only do this if both of the vertices exist.
‫And we'll check to make sure that they both do exist with this if statement.
‫And if they do exist, we'll run those two lines of code and then we'll return.
‫True.
‫If one or both of them do not exist, will return false.
‫So that is our entire remove edge function.
‫We'll look at this code in a moment in vs code and when we do we'll create this graph and then we'll
‫do a remove edge between A and B and then our graph will look like this.
‫So now let's flip over to vs code and take a look at this.
‫So there is our Remove Edge member function that we just created added to our graph class and I'll scroll
‫up.
‫And in our main function this creates our graph.
‫These three lines create those three vertices A, B and C, and these three lines create the edges between
‫all of them.
‫And then with this line will print that out and I'll run this.
‫And you can see we have our three vertices and each of the vertices have edges with the other two vertices.
‫So I'm going to come over here and I'm going to add this line which will remove the edge between A and
‫B, and now I'll run this.
‫And you can see that the edge between A and B has been removed.
‫And that is our function for Remove Edge.