public SimpleGraph(int vertexCount) { var vertices = new Vertex[vertexCount]; for (int id = 0; id < vertexCount; ++id) { vertices[id] = new Vertex(this, id); } Vertices = vertices; }
public bool HasEdge(Vertex firstVertex, Vertex secondVertex) => firstVertex.HasNeighbor(secondVertex);
public void RemoveEdge(Vertex firstVertex, Vertex secondVertex) { firstVertex.RemoveNeighbor(secondVertex); secondVertex.RemoveNeighbor(firstVertex); }
public void AddEdge(Vertex firstVertex, Vertex secondVertex) { firstVertex.AddNeighbor(secondVertex); secondVertex.AddNeighbor(firstVertex); }