In the previous post we spoke about how to insert an edge between two vertices in a graph. In this post we are going to talk about how to remove a vertex from a graph. This is also going to be a very short post.

## The Code

Removing a vertex from our graph model only takes $$O(1)$$ time. However, before we do that we need to ensure that we remove all the edges between other vertices and the vertex we want to remove. This will take $$O(k)$$ time, where $$k$$ is the number of edges connected to the vertex of concern. Here’s the code:

public bool RemoveVertex(T vertex)
{
{
return false;
}

{
}