/// <summary> /// Delete the vertex, along with all its adjacenct edges. /// </summary> private void Vertex_KeyPress_Delete(object sender, KeyPressEventArgs e) { int vertexNameIndex = (sender as Vertex).GetNumberIndex(); vertexNameUsed[vertexNameIndex] = false; if (vertexNameIndex < defaultVertexNameCounter - 'A') { defaultVertexNameCounter = Convert.ToChar(vertexNameIndex + 'A'); } vertices.Remove(sender as Vertex); foreach (Vertex v in vertices) { if (v.ContainsEdge(sender as Vertex)) { v.RemoveEdge(sender as Vertex); } } mapMatrix.RemoveVertex(vertexNameIndex); mapList.RemoveVertex(vertexNameIndex); ResetBoard(); vStart = null; vFinish = null; }